Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::mp2t::AudioHeader Class Referenceabstract
Inheritance diagram for shaka::media::mp2t::AudioHeader:
shaka::media::mp2t::Ac3Header shaka::media::mp2t::AdtsHeader shaka::media::mp2t::Mpeg1Header

Public Member Functions

virtual bool IsSyncWord (const uint8_t *buf) const =0
 
virtual size_t GetMinFrameSize () const =0
 
virtual size_t GetSamplesPerFrame () const =0
 
virtual bool Parse (const uint8_t *audio_frame, size_t audio_frame_size)=0
 
virtual size_t GetHeaderSize () const =0
 
virtual size_t GetFrameSize () const =0
 
virtual size_t GetFrameSizeWithoutParsing (const uint8_t *data, size_t num_bytes) const =0
 
virtual void GetAudioSpecificConfig (std::vector< uint8_t > *buffer) const =0
 
virtual uint8_t GetObjectType () const =0
 
virtual uint32_t GetSamplingFrequency () const =0
 
virtual uint8_t GetNumChannels () const =0
 

Detailed Description

Definition at line 18 of file audio_header.h.

Member Function Documentation

◆ GetAudioSpecificConfig()

virtual void shaka::media::mp2t::AudioHeader::GetAudioSpecificConfig ( std::vector< uint8_t > *  buffer) const
pure virtual

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.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetFrameSize()

virtual size_t shaka::media::mp2t::AudioHeader::GetFrameSize ( ) const
pure virtual

Should only be called after a successful Parse.

Returns
the size of frame (header + payload).

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetFrameSizeWithoutParsing()

virtual size_t shaka::media::mp2t::AudioHeader::GetFrameSizeWithoutParsing ( const uint8_t *  data,
size_t  num_bytes 
) const
pure virtual

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

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

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetHeaderSize()

virtual size_t shaka::media::mp2t::AudioHeader::GetHeaderSize ( ) const
pure virtual

Should only be called after a successful Parse.

Returns
The size of audio header.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetMinFrameSize()

virtual size_t shaka::media::mp2t::AudioHeader::GetMinFrameSize ( ) const
pure virtual

◆ GetNumChannels()

virtual uint8_t shaka::media::mp2t::AudioHeader::GetNumChannels ( ) const
pure virtual

Should only be called after a successful Parse.

Returns
Number of channels for this frame.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetObjectType()

virtual uint8_t shaka::media::mp2t::AudioHeader::GetObjectType ( ) const
pure virtual

Should only be called after a successful Parse.

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

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetSamplesPerFrame()

virtual size_t shaka::media::mp2t::AudioHeader::GetSamplesPerFrame ( ) const
pure virtual
Returns
Number of audio samples per frame.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ GetSamplingFrequency()

virtual uint32_t shaka::media::mp2t::AudioHeader::GetSamplingFrequency ( ) const
pure virtual

Should only be called after a successful Parse.

Returns
The sampling frequency for this frame.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ IsSyncWord()

virtual bool shaka::media::mp2t::AudioHeader::IsSyncWord ( const uint8_t *  buf) const
pure virtual

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.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.

◆ Parse()

virtual bool shaka::media::mp2t::AudioHeader::Parse ( const uint8_t *  audio_frame,
size_t  audio_frame_size 
)
pure virtual

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.

Implemented in shaka::media::mp2t::Mpeg1Header, shaka::media::mp2t::AdtsHeader, and shaka::media::mp2t::Ac3Header.


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