Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::mp4::TrackRunIterator Class Reference

Public Member Functions

 TrackRunIterator (const Movie *moov)
 
bool Init ()
 
bool Init (const MovieFragment &moof)
 
bool IsRunValid () const
 
bool IsSampleValid () const
 
void AdvanceRun ()
 
void AdvanceSample ()
 
bool AuxInfoNeedsToBeCached ()
 
bool CacheAuxInfo (const uint8_t *buf, int size)
 
int64_t GetMaxClearOffset ()
 
const AudioSampleEntryaudio_description () const
 Only valid if is_audio() is true.
 
const VideoSampleEntryvideo_description () const
 Only valid if is_video() is true.
 
std::unique_ptr< DecryptConfigGetDecryptConfig ()
 
Properties of the current run. Only valid if IsRunValid().
uint32_t track_id () const
 
int64_t aux_info_offset () const
 
int aux_info_size () const
 
bool is_encrypted () const
 
bool is_audio () const
 
bool is_video () const
 
Properties of the current sample. Only valid if IsSampleValid().
int64_t sample_offset () const
 
int sample_size () const
 
int64_t dts () const
 
int64_t cts () const
 
int64_t duration () const
 
bool is_keyframe () const
 

Detailed Description

Definition at line 25 of file track_run_iterator.h.

Constructor & Destructor Documentation

◆ TrackRunIterator()

shaka::media::mp4::TrackRunIterator::TrackRunIterator ( const Movie moov)
explicit

Create a new TrackRunIterator from movie box.

Parameters
moovshould not be NULL.

Definition at line 89 of file track_run_iterator.cc.

Member Function Documentation

◆ AdvanceRun()

void shaka::media::mp4::TrackRunIterator::AdvanceRun ( )

Advance iterator to the next run. Require that the iterator point to a valid run.

Definition at line 442 of file track_run_iterator.cc.

◆ AdvanceSample()

void shaka::media::mp4::TrackRunIterator::AdvanceSample ( )

Advance iterator to the next sample. Require that the iterator point to a valid sample.

Definition at line 455 of file track_run_iterator.cc.

◆ AuxInfoNeedsToBeCached()

bool shaka::media::mp4::TrackRunIterator::AuxInfoNeedsToBeCached ( )
Returns
true if this track run has auxiliary information and has not yet been cached. Only valid if IsRunValid().

Definition at line 464 of file track_run_iterator.cc.

◆ CacheAuxInfo()

bool shaka::media::mp4::TrackRunIterator::CacheAuxInfo ( const uint8_t *  buf,
int  size 
)

Caches the CENC data from the given buffer.

Parameters
bufmust be a buffer starting at the offset given by cenc_offset().
sizemust be at least cenc_size().
Returns
true on success, false on error.

Definition at line 471 of file track_run_iterator.cc.

◆ GetDecryptConfig()

std::unique_ptr< DecryptConfig > shaka::media::mp4::TrackRunIterator::GetDecryptConfig ( )

Only call when is_encrypted() is true and AuxInfoNeedsToBeCached() is false. Result is owned by caller.

Definition at line 605 of file track_run_iterator.cc.

◆ GetMaxClearOffset()

int64_t shaka::media::mp4::TrackRunIterator::GetMaxClearOffset ( )
Returns
the maximum buffer location at which no data earlier in the stream will be required in order to read the current or any subsequent sample. You may clear all data up to this offset before reading the current sample safely. Result is in the same units as offset() (for Media Source this is in bytes past the head of the MOOF box).

Definition at line 507 of file track_run_iterator.cc.

◆ Init() [1/2]

bool shaka::media::mp4::TrackRunIterator::Init ( )

For non-fragmented mp4, moov contains all the chunk information; This function sets up the iterator to access all the chunks. For fragmented mp4, chunk and sample information are generally contained in moof. This function is a no-op in this case. Init(moof) will be called later after parsing moof.

Returns
true on success, false otherwise.

Definition at line 162 of file track_run_iterator.cc.

◆ Init() [2/2]

bool shaka::media::mp4::TrackRunIterator::Init ( const MovieFragment moof)

Set up the iterator to handle all the runs from the current fragment.

Returns
true on success, false otherwise.

Definition at line 287 of file track_run_iterator.cc.

◆ IsRunValid()

bool shaka::media::mp4::TrackRunIterator::IsRunValid ( ) const
Returns
true if the iterator points to a valid run, false if past the last run.

Definition at line 495 of file track_run_iterator.cc.

◆ IsSampleValid()

bool shaka::media::mp4::TrackRunIterator::IsSampleValid ( ) const
Returns
true if the iterator points to a valid sample, false if past the last sample.

Definition at line 497 of file track_run_iterator.cc.


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