Shaka Packager SDK
List of all members
shaka::media::mp2t::AdtsHeader Class Reference

#include <adts_header.h>

Inheritance diagram for shaka::media::mp2t::AdtsHeader:
shaka::media::mp2t::AudioHeader

Public Member Functions

AudioHeader implementation overrides.
bool IsSyncWord (const uint8_t *buf) const override
 
size_t GetMinFrameSize () const override
 
size_t GetSamplesPerFrame () const override
 
bool Parse (const uint8_t *adts_frame, size_t adts_frame_size) override
 
size_t GetHeaderSize () const override
 
size_t GetFrameSize () const override
 
size_t GetFrameSizeWithoutParsing (const uint8_t *data, size_t num_bytes) const override
 
void GetAudioSpecificConfig (std::vector< uint8_t > *buffer) const override
 
uint8_t GetObjectType () const override
 
uint32_t GetSamplingFrequency () const override
 
uint8_t GetNumChannels () const override
 

Detailed Description

Class which parses ADTS frame (header / metadata) and synthesizes AudioSpecificConfig from audio frame content.

Definition at line 21 of file adts_header.h.

Member Function Documentation

◆ GetAudioSpecificConfig()

void shaka::media::mp2t::AdtsHeader::GetAudioSpecificConfig ( std::vector< uint8_t > *  buffer) const
overridevirtual

Synthesize an AudioSpecificConfig record from the fields within the audio header. Should only be called after a successful Parse.

Parameters
[out]bufferis a pointer to a vector to contain the AudioSpecificConfig.
Returns
true if successful, false otherwise.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 101 of file adts_header.cc.

◆ GetFrameSize()

size_t shaka::media::mp2t::AdtsHeader::GetFrameSize ( ) const
overridevirtual

Should only be called after a successful Parse.

Returns
the size of frame (header + payload).

Implements shaka::media::mp2t::AudioHeader.

Definition at line 90 of file adts_header.cc.

◆ GetFrameSizeWithoutParsing()

size_t shaka::media::mp2t::AdtsHeader::GetFrameSizeWithoutParsing ( const uint8_t *  data,
size_t  num_bytes 
) const
overridevirtual

Obtain the size of the frame from the header data without doing a full Parse.

Returns
the size of the frame (header + payload).

Implements shaka::media::mp2t::AudioHeader.

Definition at line 94 of file adts_header.cc.

◆ GetHeaderSize()

size_t shaka::media::mp2t::AdtsHeader::GetHeaderSize ( ) const
overridevirtual

Should only be called after a successful Parse.

Returns
The size of audio header.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 85 of file adts_header.cc.

◆ GetMinFrameSize()

size_t shaka::media::mp2t::AdtsHeader::GetMinFrameSize ( ) const
overridevirtual
Returns
The minium frame size.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 40 of file adts_header.cc.

◆ GetNumChannels()

uint8_t shaka::media::mp2t::AdtsHeader::GetNumChannels ( ) const
overridevirtual

Should only be called after a successful Parse.

Returns
Number of channels for this frame.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 120 of file adts_header.cc.

◆ GetObjectType()

uint8_t shaka::media::mp2t::AdtsHeader::GetObjectType ( ) const
overridevirtual

Should only be called after a successful Parse.

Returns
The audio profile for this frame. Only meaningful for AAC.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 111 of file adts_header.cc.

◆ GetSamplesPerFrame()

size_t shaka::media::mp2t::AdtsHeader::GetSamplesPerFrame ( ) const
overridevirtual
Returns
Number of audio samples per frame.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 44 of file adts_header.cc.

◆ GetSamplingFrequency()

uint32_t shaka::media::mp2t::AdtsHeader::GetSamplingFrequency ( ) const
overridevirtual

Should only be called after a successful Parse.

Returns
The sampling frequency for this frame.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 115 of file adts_header.cc.

◆ IsSyncWord()

bool shaka::media::mp2t::AdtsHeader::IsSyncWord ( const uint8_t *  buf) const
overridevirtual

Check if the leading word (2 bytes) is sync signal.

Parameters
bufpoints to the buffer to be checked. Must be at least 2 bytes.
Returns
true if corresponds to a syncword.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 36 of file adts_header.cc.

◆ Parse()

bool shaka::media::mp2t::AdtsHeader::Parse ( const uint8_t *  audio_frame,
size_t  audio_frame_size 
)
overridevirtual

Parse a partial audio frame, extracting the fields within. Only audio frame header / metadata is parsed. The audio_frame_size must contain the full header / metadata.

Parameters
audio_frameis an input parameter pointing to an audio frame.
audio_frame_sizeis the size, in bytes of the input data. It can be smaller than the actual frame size, but it should not be smaller than the header size.
Returns
true if successful, false otherwise.

Implements shaka::media::mp2t::AudioHeader.

Definition at line 49 of file adts_header.cc.


The documentation for this class was generated from the following files: