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

#include <fragmenter.h>

Public Member Functions

 Fragmenter (std::shared_ptr< const StreamInfo > info, TrackFragment *traf, int64_t edit_list_offset)
 
Status AddSample (const MediaSample &sample)
 
Status InitializeFragment (int64_t first_sample_dts)
 
Status FinalizeFragment ()
 Finalize and optimize the fragment.
 
void GenerateSegmentReference (SegmentReference *reference) const
 Fill reference with current fragment information.
 
void ClearFragmentFinalized ()
 
int64_t fragment_duration () const
 
int64_t first_sap_time () const
 
int64_t earliest_presentation_time () const
 
bool fragment_initialized () const
 
bool fragment_finalized () const
 
BufferWriterdata ()
 
const std::vector< KeyFrameInfo > & key_frame_infos () const
 

Protected Member Functions

TrackFragmenttraf ()
 
template<typename T >
bool OptimizeSampleEntries (std::vector< T > *entries, T *default_value)
 

Detailed Description

Fragmenter is responsible for the generation of MP4 fragments, i.e. 'traf' box and corresponding 'mdat' box.

Definition at line 34 of file fragmenter.h.

Constructor & Destructor Documentation

◆ Fragmenter()

shaka::media::mp4::Fragmenter::Fragmenter ( std::shared_ptr< const StreamInfo info,
TrackFragment traf,
int64_t  edit_list_offset 
)
Parameters
infocontains stream information.
trafpoints to a TrackFragment box.
edit_list_offsetis the edit list offset that is encoded in Edit List. It should be 0 if there is no EditList.

Definition at line 52 of file fragmenter.cc.

Member Function Documentation

◆ AddSample()

Status shaka::media::mp4::Fragmenter::AddSample ( const MediaSample sample)

Add a sample to the fragmenter.

Parameters
samplepoints to the sample to be added.
Returns
OK on success, an error status otherwise.

Definition at line 67 of file fragmenter.cc.

◆ InitializeFragment()

Status shaka::media::mp4::Fragmenter::InitializeFragment ( int64_t  first_sample_dts)

Initialize the fragment with default data.

Parameters
first_sample_dtsspecifies the decoding timestamp for the first sample for this fragment.
Returns
OK on success, an error status otherwise.

Definition at line 131 of file fragmenter.cc.

◆ OptimizeSampleEntries()

template<typename T >
bool shaka::media::mp4::Fragmenter::OptimizeSampleEntries ( std::vector< T > *  entries,
T *  default_value 
)
protected

Optimize sample entries table. If all values in entries are identical, then entries is cleared and the value is assigned to default_value; otherwise it is a NOP. Return true if the table is optimized.

Definition at line 108 of file fragmenter.h.


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