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::WebMMediaParser shaka::media::WebVttParser shaka::media::mp2t::Mp2tMediaParser shaka::media::mp4::MP4MediaParser shaka::media::wvm::WvmMediaParser

Public Types

typedef std::function< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB
 
typedef std::function< bool(uint32_t track_id, std::shared_ptr< MediaSample > media_sample)> NewMediaSampleCB
 
typedef std::function< bool(uint32_t track_id, std::shared_ptr< TextSample > text_sample)> NewTextSampleCB
 

Public Member Functions

virtual void Init (const InitCB &init_cb, const NewMediaSampleCB &new_media_sample_cb, const NewTextSampleCB &new_text_sample_cb, KeySource *decryption_key_source)=0
 
virtual bool Flush ()=0
 
virtual bool Parse (const uint8_t *buf, int size)=0
 

Detailed Description

Definition at line 26 of file media_parser.h.

Member Typedef Documentation

◆ InitCB

typedef std::function<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 36 of file media_parser.h.

◆ NewMediaSampleCB

typedef std::function<bool(uint32_t track_id, std::shared_ptr<MediaSample> media_sample)> shaka::media::MediaParser::NewMediaSampleCB

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 45 of file media_parser.h.

◆ NewTextSampleCB

typedef std::function<bool(uint32_t track_id, std::shared_ptr<TextSample> text_sample)> shaka::media::MediaParser::NewTextSampleCB

Called when a new text sample has been parsed.

Parameters
track_idis the track id of the new sample.
text_sampleis the new text 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 54 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::WebVttParser, shaka::media::WebMMediaParser, shaka::media::mp4::MP4MediaParser, and shaka::media::mp2t::Mp2tMediaParser.

◆ Init()

virtual void shaka::media::MediaParser::Init ( const InitCB init_cb,
const NewMediaSampleCB new_media_sample_cb,
const NewTextSampleCB new_text_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_media_sample_cbwill be called each time a new media sample is available from the parser.
new_text_sample_cbwill be called each time a new text sample is available from the parser.
decryption_key_sourcethe key source to decrypt the frames. May be NULL, and caller retains ownership.

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

◆ 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::WebVttParser, shaka::media::WebMMediaParser, shaka::media::mp4::MP4MediaParser, and shaka::media::mp2t::Mp2tMediaParser.


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