Shaka Packager SDK
Public Types | Public Member Functions | List of all members
shaka::media::MediaParser Class Referenceabstract
Inheritance diagram for shaka::media::MediaParser:
shaka::media::mp2t::Mp2tMediaParser shaka::media::mp4::MP4MediaParser shaka::media::WebMMediaParser shaka::media::wvm::WvmMediaParser

Public Types

typedef base::Callback< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB
 
typedef base::Callback< bool(uint32_t track_id, const std::shared_ptr< MediaSample > &media_sample)> NewSampleCB
 

Public Member Functions

virtual void Init (const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source)=0
 
virtual bool Flush () WARN_UNUSED_RESULT=0
 
virtual bool Parse (const uint8_t *buf, int size) WARN_UNUSED_RESULT=0
 

Detailed Description

Definition at line 24 of file media_parser.h.

Member Typedef Documentation

◆ InitCB

typedef base::Callback<void( const std::vector<std::shared_ptr<StreamInfo> >& stream_info)> shaka::media::MediaParser::InitCB

Called upon completion of parser initialization.

Parameters
stream_infocontains the stream info of all the elementary streams within this file.

Definition at line 34 of file media_parser.h.

◆ NewSampleCB

typedef base::Callback<bool(uint32_t track_id, const std::shared_ptr<MediaSample>& media_sample)> shaka::media::MediaParser::NewSampleCB

Called when a new media sample has been parsed.

Parameters
track_idis the track id of the new sample.
media_sampleis the new media sample.
Returns
true if the sample is accepted, false if something was wrong with the sample and a parsing error should be signaled.

Definition at line 43 of file media_parser.h.

Member Function Documentation

◆ Flush()

virtual bool shaka::media::MediaParser::Flush ( )
pure virtual

Flush data currently in the parser and put the parser in a state where it can receive data for a new seek point.

Returns
true if successful, false otherwise.

Implemented in shaka::media::wvm::WvmMediaParser, shaka::media::mp4::MP4MediaParser, shaka::media::mp2t::Mp2tMediaParser, and shaka::media::WebMMediaParser.

◆ Init()

virtual void shaka::media::MediaParser::Init ( const InitCB init_cb,
const NewSampleCB new_sample_cb,
KeySource decryption_key_source 
)
pure virtual

Initialize the parser with necessary callbacks. Must be called before any data is passed to Parse().

Parameters
init_cbwill be called once enough data has been parsed to determine the initial stream configurations.
new_sample_cbwill be called each time a new media sample is available from the parser. May be NULL, and caller retains ownership.

Implemented in shaka::media::wvm::WvmMediaParser, shaka::media::mp4::MP4MediaParser, shaka::media::mp2t::Mp2tMediaParser, and shaka::media::WebMMediaParser.

◆ Parse()

virtual bool shaka::media::MediaParser::Parse ( const uint8_t *  buf,
int  size 
)
pure virtual

Should be called when there is new data to parse.

Returns
true if successful.

Implemented in shaka::media::wvm::WvmMediaParser, shaka::media::mp4::MP4MediaParser, shaka::media::mp2t::Mp2tMediaParser, and shaka::media::WebMMediaParser.


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