Documentation
¶
Overview ¶
Package aac decodes MPEG-4 AAC-LC (ISO/IEC 14496-3 audio object type 2) to interleaved signed 16-bit PCM in pure Go: one raw_data_block per call, as MP4 and Matroska carry them, in channel configurations 1 to 7 (mono to 7.1).
Index ¶
Constants ¶
const FrameSize = 1024
FrameSize is the samples per channel each frame decodes to.
Variables ¶
var ( // ErrInvalid is a malformed AudioSpecificConfig or frame. ErrInvalid = errors.New("invalid AAC data") // ErrUnsupported is a stream outside AAC-LC: another audio object // type (HE-AAC's SBR and PS among them), 960-sample frames, a // program config element instead of a channel configuration, or a // coupling channel element. ErrUnsupported = errors.New("unsupported AAC stream") )
Decoding fails with these, wrapped with what was being decoded.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SampleRate is the sampling rate in Hz.
SampleRate int
// Channels is the number of output channels.
Channels int
// contains filtered or unexported fields
}
Config is a stream's AudioSpecificConfig (1.6.2.1), the part an AAC-LC decoder needs.
func ParseConfig ¶
ParseConfig reads an AudioSpecificConfig, as MP4's esds and Matroska's CodecPrivate carry it.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes an AAC-LC stream's raw data blocks, one 1024-sample frame per packet, to interleaved signed 16-bit PCM in the channel order of its configuration (front centre first: C, L, R, then the surround pairs, then LFE). Perceptual noise substitution uses the standard's correlated noise in mid/side bands; dynamic range control data is ignored. A Decoder decodes one stream in order and belongs to one goroutine.
func NewDecoder ¶
NewDecoder reads the stream's AudioSpecificConfig. The first one builds the transform, window and codebook tables every Decoder shares.