flac

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2015 License: ISC Imports: 7 Imported by: 0

README

flac

Build Status Coverage Status GoDoc

This package provides access to FLAC (Free Lossless Audio Codec) streams.

Documentation

Documentation provided by GoDoc.

  • flac: provides access to FLAC (Free Lossless Audio Codec) streams.
    • frame: implements access to FLAC audio frames.
    • meta: implements access to FLAC metadata blocks.

Changes

  • Version 1.0.2

  • Version 1.0.1

    • Fix two subframe decoding bugs (see #7). Thanks to Jonathan MacMillan.
    • Add frame decoding test cases.

Public domain

The source code and any original content of this repository is hereby released into the public domain.

Documentation

Overview

Package flac provides access to FLAC (Free Lossless Audio Codec) streams.

A brief introduction of the FLAC stream format [1] follows. Each FLAC stream starts with a 32-bit signature ("fLaC"), followed by one or more metadata blocks, and then one or more audio frames. The first metadata block (StreamInfo) describes the basic properties of the audio stream and it is the only mandatory metadata block. Subsequent metadata blocks may appear in an arbitrary order.

Please refer to the documentation of the meta [2] and the frame [3] packages for a brief introduction of their respective formats.

[1]: https://www.xiph.org/flac/format.html#stream
[2]: https://godoc.org/gopkg.in/mewkiz/flac.v1/meta
[3]: https://godoc.org/gopkg.in/mewkiz/flac.v1/frame

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

type Stream struct {
	// The StreamInfo metadata block describes the basic properties of the FLAC
	// audio stream.
	Info *meta.StreamInfo
	// Zero or more metadata blocks.
	Blocks []*meta.Block
	// contains filtered or unexported fields
}

A Stream contains the metadata blocks and provides access to the audio frames of a FLAC stream.

ref: https://www.xiph.org/flac/format.html#stream

func New

func New(r io.Reader) (stream *Stream, err error)

New creates a new Stream for accessing the audio samples of r. It reads and parses the FLAC signature and the StreamInfo metadata block, but skips all other metadata blocks.

Call Stream.Next to parse the frame header of the next audio frame, and call Stream.ParseNext to parse the entire next frame including audio samples.

func Open

func Open(path string) (stream *Stream, err error)

Open creates a new Stream for accessing the audio samples of path. It reads and parses the FLAC signature and the StreamInfo metadata block, but skips all other metadata blocks.

Call Stream.Next to parse the frame header of the next audio frame, and call Stream.ParseNext to parse the entire next frame including audio samples.

Note: The Close method of the stream must be called when finished using it.

func Parse

func Parse(r io.Reader) (stream *Stream, err error)

Parse creates a new Stream for accessing the metadata blocks and audio samples of r. It reads and parses the FLAC signature and all metadata blocks.

Call Stream.Next to parse the frame header of the next audio frame, and call Stream.ParseNext to parse the entire next frame including audio samples.

func ParseFile

func ParseFile(path string) (stream *Stream, err error)

ParseFile creates a new Stream for accessing the metadata blocks and audio samples of path. It reads and parses the FLAC signature and all metadata blocks.

Call Stream.Next to parse the frame header of the next audio frame, and call Stream.ParseNext to parse the entire next frame including audio samples.

Note: The Close method of the stream must be called when finished using it.

func (*Stream) Close

func (stream *Stream) Close() error

Close closes the stream if opened through a call to Open or ParseFile, and performs no operation otherwise.

func (*Stream) Next

func (stream *Stream) Next() (f *frame.Frame, err error)

Next parses the frame header of the next audio frame. It returns io.EOF to signal a graceful end of FLAC stream.

Call Frame.Parse to parse the audio samples of its subframes.

func (*Stream) ParseNext

func (stream *Stream) ParseNext() (f *frame.Frame, err error)

ParseNext parses the entire next frame including audio samples. It returns io.EOF to signal a graceful end of FLAC stream.

Directories

Path Synopsis
Package frame implements access to FLAC audio frames.
Package frame implements access to FLAC audio frames.
Package meta implements access to FLAC metadata blocks.
Package meta implements access to FLAC metadata blocks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL