Documentation
¶
Overview ¶
Package adts builds and parses Audio Data Transport Stream headers.
Index ¶
Constants ¶
const ( // HeaderSize is the size of an ADTS header without a CRC. HeaderSize = 7 // CRCSize is the size of the optional CRC that follows the header when // protection_absent is zero (one raw data block per frame). CRCSize = 2 // MaxFrameLength is the largest value representable by adts_frame_length. MaxFrameLength = 1<<13 - 1 // VariableBitRateBufferFullness marks a variable-rate stream. VariableBitRateBufferFullness = 0x7ff )
Variables ¶
var ( // ErrShortHeader reports input shorter than one CRC-free ADTS header. ErrShortHeader = errors.New("ADTS header is shorter than 7 bytes") // ErrSyncWord reports a missing 12-bit ADTS syncword. ErrSyncWord = errors.New("invalid ADTS syncword") )
Functions ¶
Types ¶
type Header ¶
type Header struct {
// MPEGID is zero for MPEG-4 and one for MPEG-2.
MPEGID uint8
// Profile is the two-bit ADTS profile value; AAC-LC is 1 (AOT minus one).
Profile uint8
SamplingFrequencyIndex uint8
ChannelConfiguration uint8
FrameLength int
BufferFullness uint16
NumRawDataBlocks uint8
// CRCPresent mirrors protection_absent == 0: a 16-bit CRC follows the
// header. Build always emits CRC-free headers.
CRCPresent bool
}
Header holds the fixed and variable fields of a seven-byte ADTS header. Field widths and meanings follow ISO/IEC 13818-7 section 6.2.1.
func Parse ¶
Parse reads an ADTS fixed_header() and variable_header() — ISO/IEC 13818-7 section 6.2.1.
func (Header) PayloadOffset ¶
PayloadOffset returns the offset of the raw data blocks within the frame: the header plus the optional CRC.