Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFormat = errors.New("audio: unknown format")
ErrFormat indicates that decoding encountered an unknown format.
Functions ¶
func RegisterFormat ¶
func RegisterFormat(name, magic string, decode DecodeFunc, decodeCfg DecodeConfigFunc)
RegisterFormat registers an audio format for use by Decode. Name is the name of the format, like "mp3" or "wav". Magic is the magic prefix that identifies the format's encoding. The magic string can contain "?" wildcards that each match any one byte. Decode is the function that decodes the encoded audio. decodeCfg is the function that decodes just its configuration.
Types ¶
type Config ¶
type Config struct { }
Config holds an audio's configurations.
func DecodeConfig ¶
func DecodeConfig(r io.ReadSeeker) (Config, string, error)
DecodeConfig decodes the basic configurations of an audio that has been encoded in a registered format. The string returned is the format name used during format registration. Format registration is typically done by an init function in the codec-specific package.
type DecodeConfigFunc ¶
type DecodeConfigFunc = func(io.ReadSeeker) (Config, error)
DecodeConfigFunc prototype.
type Decoded ¶
type Decoded interface { io.ReadSeeker // SampleRate returns the sample rate like 44100. SampleRate() int // Channels returns the number of channels. One channel is mono playback. // Two channels are stereo playback. No other values are supported. Channels() int // BytesPerSample returns the number of bytes per sample per channel. // The usual value is 2. Only values 1 and 2 are supported. BytesPerSample() int // Length returns the total size in bytes. It returns -1 when the total size is not // available. e.g. when the given source is not io.Seeker. Length() int64 }
Decoded represents a decoded audio.