mpeg4audio

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: MIT Imports: 2 Imported by: 78

Documentation

Overview

Package mpeg4audio contains utilities to work with MPEG-4 audio codecs.

Index

Constants

View Source
const (
	// MaxAccessUnitSize is the maximum size of an access unit.
	MaxAccessUnitSize = 5 * 1024

	// SamplesPerAccessUnit is the number of samples contained by an access unit.
	SamplesPerAccessUnit = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ADTSPacket

type ADTSPacket struct {
	Type         ObjectType
	SampleRate   int
	ChannelCount int
	AU           []byte
}

ADTSPacket is an ADTS frame. Specification: ISO 14496-3, Table 1.A.5

type ADTSPackets

type ADTSPackets []*ADTSPacket

ADTSPackets is a group od ADTS packets.

func (ADTSPackets) Marshal

func (ps ADTSPackets) Marshal() ([]byte, error)

Marshal encodes ADTS packets into an ADTS stream.

func (*ADTSPackets) Unmarshal

func (ps *ADTSPackets) Unmarshal(buf []byte) error

Unmarshal decodes an ADTS stream into ADTS packets.

type AudioSpecificConfig added in v0.3.0

type AudioSpecificConfig struct {
	Type         ObjectType
	SampleRate   int
	ChannelCount int

	// SBR / PS specific
	ExtensionType       ObjectType
	ExtensionSampleRate int

	FrameLengthFlag    bool
	DependsOnCoreCoder bool
	CoreCoderDelay     uint16
}

AudioSpecificConfig is an AudioSpecificConfig. Specification: ISO 14496-3, 1.6.2.1

func (AudioSpecificConfig) Marshal added in v0.3.0

func (c AudioSpecificConfig) Marshal() ([]byte, error)

Marshal encodes a Config.

func (*AudioSpecificConfig) Unmarshal added in v0.3.0

func (c *AudioSpecificConfig) Unmarshal(buf []byte) error

Unmarshal decodes a Config.

func (*AudioSpecificConfig) UnmarshalFromPos added in v0.3.0

func (c *AudioSpecificConfig) UnmarshalFromPos(buf []byte, pos *int) error

UnmarshalFromPos decodes a Config.

type Config

type Config = AudioSpecificConfig

Config is an alias for AudioSpecificConfig.

type ObjectType

type ObjectType int

ObjectType is a MPEG-4 Audio object type. Specification: ISO 14496-3, Table 1.17

const (
	ObjectTypeAACLC ObjectType = 2
	ObjectTypeSBR   ObjectType = 5
	ObjectTypePS    ObjectType = 29
)

supported types.

type StreamMuxConfig added in v0.3.0

type StreamMuxConfig struct {
	NumSubFrames     uint
	Programs         []*StreamMuxConfigProgram
	OtherDataPresent bool
	OtherDataLenBits uint32
	CRCCheckPresent  bool
	CRCCheckSum      uint8
}

StreamMuxConfig is a StreamMuxConfig. Specification: ISO 14496-3, Table 1.42

func (StreamMuxConfig) Marshal added in v0.3.0

func (c StreamMuxConfig) Marshal() ([]byte, error)

Marshal encodes a StreamMuxConfig.

func (*StreamMuxConfig) Unmarshal added in v0.3.0

func (c *StreamMuxConfig) Unmarshal(buf []byte) error

Unmarshal decodes a StreamMuxConfig.

type StreamMuxConfigLayer added in v0.3.0

type StreamMuxConfigLayer struct {
	AudioSpecificConfig       *AudioSpecificConfig
	FrameLengthType           uint
	LatmBufferFullness        uint
	FrameLength               uint
	CELPframeLengthTableIndex uint
	HVXCframeLengthTableIndex bool
}

StreamMuxConfigLayer is a layer of a StreamMuxConfig.

type StreamMuxConfigProgram added in v0.3.0

type StreamMuxConfigProgram struct {
	Layers []*StreamMuxConfigLayer
}

StreamMuxConfigProgram is a program of a StreamMuxConfig.

Jump to

Keyboard shortcuts

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