Shaka Packager SDK
Classes | Public Types | Public Member Functions | List of all members
shaka::media::WebMClusterParser Class Reference
Inheritance diagram for shaka::media::WebMClusterParser:
shaka::media::WebMParserClient

Public Types

enum  { kDefaultAudioBufferDurationInMs = 23 , kDefaultVideoBufferDurationInMs = 63 }
 

Public Member Functions

 WebMClusterParser (int64_t timecode_scale, std::shared_ptr< AudioStreamInfo > audio_stream_info, std::shared_ptr< VideoStreamInfo > video_stream_info, const VPCodecConfigurationRecord &vp_config, int64_t audio_default_duration, int64_t video_default_duration, const WebMTracksParser::TextTracks &text_tracks, const std::set< int64_t > &ignored_tracks, const std::string &audio_encryption_key_id, const std::string &video_encryption_key_id, const MediaParser::NewMediaSampleCB &new_sample_cb, const MediaParser::InitCB &init_cb, KeySource *decryption_key_source)
 
void Reset ()
 Resets the parser state so it can accept a new cluster.
 
bool Flush ()
 
int Parse (const uint8_t *buf, int size)
 
int64_t cluster_start_time () const
 
bool cluster_ended () const
 
- Public Member Functions inherited from shaka::media::WebMParserClient
virtual bool OnFloat (int id, double val)
 
virtual bool OnString (int id, const std::string &str)
 

Additional Inherited Members

- Protected Member Functions inherited from shaka::media::WebMParserClient
 DISALLOW_COPY_AND_ASSIGN (WebMParserClient)
 

Detailed Description

Definition at line 24 of file webm_cluster_parser.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Numbers chosen to estimate the duration of a buffer if none is set and there is not enough information to get a better estimate.

Enumerator
kDefaultAudioBufferDurationInMs 

Common 1k samples @44.1kHz.

kDefaultVideoBufferDurationInMs 

Chosen to represent 16fps duration, which will prevent MSE stalls in videos with frame-rates as low as 8fps.

Definition at line 28 of file webm_cluster_parser.h.

Constructor & Destructor Documentation

◆ WebMClusterParser()

shaka::media::WebMClusterParser::WebMClusterParser ( int64_t  timecode_scale,
std::shared_ptr< AudioStreamInfo audio_stream_info,
std::shared_ptr< VideoStreamInfo video_stream_info,
const VPCodecConfigurationRecord vp_config,
int64_t  audio_default_duration,
int64_t  video_default_duration,
const WebMTracksParser::TextTracks &  text_tracks,
const std::set< int64_t > &  ignored_tracks,
const std::string &  audio_encryption_key_id,
const std::string &  video_encryption_key_id,
const MediaParser::NewMediaSampleCB new_sample_cb,
const MediaParser::InitCB init_cb,
KeySource decryption_key_source 
)

Create a WebMClusterParser from given parameters.

Parameters
timecode_scaleindicates timecode scale for the clusters.
audio_stream_inforeferences audio stream information. It will be NULL if there are no audio tracks available.
video_stream_inforeferences video stream information. It will be NULL if there are no video tracks available.
vp_configreferences vp configuration record. Only useful for video.
audio_default_durationindicates default duration for audio samples.
video_default_durationindicates default duration for video samples.
text_trackscontains text track information.
ignored_trackscontains a list of ignored track ids.
audio_encryption_key_idindicates the encryption key id for audio samples if there is an audio stream and the audio stream is encrypted. It is empty otherwise.
video_encryption_key_idindicates the encryption key id for video samples if there is a video stream and the video stream is encrypted. It is empty otherwise.
new_sample_cbis the callback to emit new samples.
init_cbis the callback to initialize streams.
decryption_key_sourcepoints to a decryption key source to fetch decryption keys. Should not be NULL if the tracks are encrypted.

Definition at line 31 of file webm_cluster_parser.cc.

Member Function Documentation

◆ cluster_ended()

bool shaka::media::WebMClusterParser::cluster_ended ( ) const
inline
Returns
true if the last Parse() call stopped at the end of a cluster.

Definition at line 154 of file webm_cluster_parser.h.

◆ Flush()

bool shaka::media::WebMClusterParser::Flush ( )

Flush data currently in the parser and reset the parser so it can accept a new cluster.

Returns
true on success, false otherwise.

Definition at line 93 of file webm_cluster_parser.cc.

◆ Parse()

int shaka::media::WebMClusterParser::Parse ( const uint8_t *  buf,
int  size 
)

Parses a WebM cluster element in |buf|.

Returns
-1 if the parse fails.
0 if more data is needed.
The number of bytes parsed on success.

Definition at line 101 of file webm_cluster_parser.cc.


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