aac

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package aac - parse and generate AAC meta data including ADTS headers.

Index

Constants

View Source
const (
	// AAClc - AAC-LC Low Complexity
	AAClc = 2
	// HEAACv1 - HE-AAC version 1 with SBR
	HEAACv1 = 5
	// HEAACv2 - HE-AAC version 2 with SBR and PS
	HEAACv2 = 29
)

Variables

View Source
var FrequencyTable = map[byte]int{
	0:  96000,
	1:  88200,
	2:  64000,
	3:  48000,
	4:  44100,
	5:  32000,
	6:  24000,
	7:  22050,
	8:  16000,
	9:  12000,
	10: 11025,
	11: 8000,
	12: 7350,
}

FrequencyTable maps frequency index to sample rate in Hz

View Source
var ReverseFrequencies = map[int]byte{
	96000: 0,
	88200: 1,
	64000: 2,
	48000: 3,
	44100: 4,
	32000: 5,
	24000: 6,
	22050: 7,
	16000: 8,
	12000: 9,
	11025: 10,
	8000:  11,
	7350:  12,
}

ReverseFrequencies converts sample frequency to index

Functions

This section is empty.

Types

type ADTSHeader

type ADTSHeader struct {
	ID                     byte // 0 is MPEG-4, 1 is MPEG-2
	ObjectType             byte
	SamplingFrequencyIndex byte
	ChannelConfig          byte
	HeaderLength           byte // Should be 7 or 9
	PayloadLength          uint16
	BufferFullness         uint16
}

ADTSHeader - data for an unencrypted ADTS Header with one AAC frame. Not used in mp4 files, but in MPEG-2 TS. Defined in ISO/IEC 13818-7

func DecodeADTSHeader added in v0.22.0

func DecodeADTSHeader(r io.Reader) (header *ADTSHeader, offset int, err error)

DecodeADTSHeader by first looking for sync word

func NewADTSHeader

func NewADTSHeader(samplingFrequency int, channelConfig byte, objectType byte, plLen uint16) (*ADTSHeader, error)

NewADTSHeader - create a new ADTS header

func (ADTSHeader) Encode

func (a ADTSHeader) Encode() []byte

Encode - encode ADTSHeader into byte slice

func (ADTSHeader) Frequency added in v0.30.0

func (a ADTSHeader) Frequency() uint16

Frequency looks up the sampling frequency for index in ADTSHeader

type AudioSpecificConfig

type AudioSpecificConfig struct {
	ObjectType           byte
	ChannelConfiguration byte // Defined in Table 1.19
	SamplingFrequency    int
	ExtensionFrequency   int
	SBRPresentFlag       bool
	PSPresentFlag        bool
}

AudioSpecificConfig according to ISO/IEC 14496-3 Syntax specified in Table 1.15

func DecodeAudioSpecificConfig

func DecodeAudioSpecificConfig(r io.Reader) (*AudioSpecificConfig, error)

DecodeAudioSpecificConfig -

func (*AudioSpecificConfig) Encode

func (a *AudioSpecificConfig) Encode(w io.Writer) error

Encode - write AudioSpecificConfig to w for AAC-LC and HE-AAC

Jump to

Keyboard shortcuts

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