Shaka Packager SDK
Public Member Functions | Protected Member Functions | List of all members
shaka::media::Muxer Class Referenceabstract

#include <muxer.h>

Inheritance diagram for shaka::media::Muxer:
shaka::media::MediaHandler shaka::media::PackedAudioWriter shaka::media::TextMuxer shaka::media::mp2t::TsMuxer shaka::media::mp4::MP4Muxer shaka::media::webm::WebMMuxer shaka::media::ttml::TtmlMuxer shaka::media::webvtt::WebVttMuxer

Public Member Functions

 Muxer (const MuxerOptions &options)
 
void Cancel ()
 
void SetMuxerListener (std::unique_ptr< MuxerListener > muxer_listener)
 
void SetProgressListener (std::unique_ptr< ProgressListener > progress_listener)
 
const std::vector< std::shared_ptr< const StreamInfo > > & streams () const
 
void set_clock (std::shared_ptr< Clock > clock)
 
- Public Member Functions inherited from shaka::media::MediaHandler
Status SetHandler (size_t output_stream_index, std::shared_ptr< MediaHandler > handler)
 Connect downstream handler at the specified output stream index.
 
Status AddHandler (std::shared_ptr< MediaHandler > handler)
 Connect downstream handler to the next available output stream index.
 
Status Initialize ()
 
bool IsConnected ()
 Validate if the handler is connected to its upstream handler.
 

Protected Member Functions

const MuxerOptionsoptions () const
 
MuxerListenermuxer_listener ()
 
ProgressListenerprogress_listener ()
 
uint64_t Now () const
 
MediaHandler implementation overrides.
Status InitializeInternal () override
 
Status Process (std::unique_ptr< StreamData > stream_data) override
 
Status OnFlushRequest (size_t input_stream_index) override
 Event handler for flush request at the specific input stream index.
 
- Protected Member Functions inherited from shaka::media::MediaHandler
virtual bool ValidateOutputStreamIndex (size_t stream_index) const
 Validate if the stream at the specified index actually exists.
 
Status Dispatch (std::unique_ptr< StreamData > stream_data) const
 
Status DispatchStreamInfo (size_t stream_index, std::shared_ptr< const StreamInfo > stream_info) const
 Dispatch the stream info to downstream handlers.
 
Status DispatchMediaSample (size_t stream_index, std::shared_ptr< const MediaSample > media_sample) const
 Dispatch the media sample to downstream handlers.
 
Status DispatchTextSample (size_t stream_index, std::shared_ptr< const TextSample > text_sample) const
 Dispatch the text sample to downstream handlers.
 
Status DispatchSegmentInfo (size_t stream_index, std::shared_ptr< const SegmentInfo > segment_info) const
 Dispatch the segment info to downstream handlers.
 
Status DispatchScte35Event (size_t stream_index, std::shared_ptr< const Scte35Event > scte35_event) const
 Dispatch the scte35 event to downstream handlers.
 
Status DispatchCueEvent (size_t stream_index, std::shared_ptr< const CueEvent > cue_event) const
 Dispatch the cue event to downstream handlers.
 
Status FlushDownstream (size_t output_stream_index)
 Flush the downstream connected at the specified output stream index.
 
Status FlushAllDownstreams ()
 Flush all connected downstream handlers.
 
bool initialized ()
 
size_t num_input_streams () const
 
size_t next_output_stream_index () const
 
const std::map< size_t, std::pair< std::shared_ptr< MediaHandler >, size_t > > & output_handlers ()
 

Additional Inherited Members

- Static Public Member Functions inherited from shaka::media::MediaHandler
static Status Chain (const std::vector< std::shared_ptr< MediaHandler >> &list)
 

Detailed Description

Muxer is responsible for taking elementary stream samples and producing media containers. An optional KeySource can be provided to Muxer to generate encrypted outputs.

Definition at line 30 of file muxer.h.

Member Function Documentation

◆ Cancel()

void shaka::media::Muxer::Cancel ( )

Cancel a muxing job in progress. Will cause Run to exit with an error status of type CANCELLED.

Definition at line 35 of file muxer.cc.

◆ InitializeInternal()

Status shaka::media::Muxer::InitializeInternal ( )
inlineoverrideprotectedvirtual

Internal implementation of initialize. Note that it should only initialize the MediaHandler itself. Downstream handlers are handled in Initialize().

Implements shaka::media::MediaHandler.

Definition at line 62 of file muxer.h.

◆ Process()

Status shaka::media::Muxer::Process ( std::unique_ptr< StreamData stream_data)
overrideprotectedvirtual

Process the incoming stream data. Note that (1) stream_data.stream_index should be the input stream index; (2) The implementation needs to call DispatchXxx to dispatch the processed stream data to the downstream handlers after finishing processing if needed.

Implements shaka::media::MediaHandler.

Definition at line 48 of file muxer.cc.

◆ set_clock()

void shaka::media::Muxer::set_clock ( std::shared_ptr< Clock clock)
inline

Inject clock, mainly used for testing. The injected clock will be used to generate the creation time-stamp and modification time-stamp of the muxer output. If no clock is injected, the code uses std::chrone::system_clock::now() to generate the time-stamps.

Parameters
clockis the Clock to be injected.

Definition at line 57 of file muxer.h.

◆ SetMuxerListener()

void shaka::media::Muxer::SetMuxerListener ( std::unique_ptr< MuxerListener muxer_listener)

Set a MuxerListener event handler for this object.

Parameters
muxer_listenershould not be NULL.

Definition at line 39 of file muxer.cc.

◆ SetProgressListener()

void shaka::media::Muxer::SetProgressListener ( std::unique_ptr< ProgressListener progress_listener)

Set a ProgressListener event handler for this object.

Parameters
progress_listenershould not be NULL.

Definition at line 43 of file muxer.cc.


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