DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | List of all members
shaka::media::Demuxer Class Reference

#include <demuxer.h>

Inheritance diagram for shaka::media::Demuxer:
shaka::media::MediaHandler

Public Member Functions

 Demuxer (const std::string &file_name)
 
void SetKeySource (std::unique_ptr< KeySource > key_source)
 
Status Run ()
 
void Cancel ()
 
MediaContainerName container_name ()
 
Status SetHandler (const std::string &stream_label, std::shared_ptr< MediaHandler > handler)
 
void SetLanguageOverride (const std::string &stream_label, const std::string &language_override)
 
void set_dump_stream_info (bool dump_stream_info)
 
- Public Member Functions inherited from shaka::media::MediaHandler
Status SetHandler (int 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 availble output stream index.
 
Status Initialize ()
 

Protected Member Functions

MediaHandler implementation overrides.
Status InitializeInternal () override
 
Status Process (std::unique_ptr< StreamData > stream_data) override
 
bool ValidateOutputStreamIndex (int stream_index) const override
 Validate if the stream at the specified index actually exists.
 
- Protected Member Functions inherited from shaka::media::MediaHandler
virtual Status OnFlushRequest (int input_stream_index)
 Event handler for flush request at the specific input stream index.
 
bool initialized ()
 
int num_input_streams ()
 
Status Dispatch (std::unique_ptr< StreamData > stream_data)
 
Status DispatchPeriodInfo (int stream_index, std::shared_ptr< PeriodInfo > period_info)
 Dispatch the period info to downstream handlers.
 
Status DispatchStreamInfo (int stream_index, std::shared_ptr< StreamInfo > stream_info)
 Dispatch the stream info to downstream handlers.
 
Status DispatchEncryptionConfig (int stream_index, std::unique_ptr< EncryptionConfig > encryption_config)
 Dispatch the encryption config to downstream handlers.
 
Status DispatchMediaSample (int stream_index, std::shared_ptr< MediaSample > media_sample)
 Dispatch the media sample to downstream handlers.
 
Status DispatchMediaEvent (int stream_index, std::shared_ptr< MediaEvent > media_event)
 Dispatch the media event to downstream handlers.
 
Status DispatchSegmentInfo (int stream_index, std::shared_ptr< SegmentInfo > segment_info)
 Dispatch the segment info to downstream handlers.
 
Status FlushDownstream (int output_stream_index)
 Flush the downstream connected at the specified output stream index.
 
int num_input_streams () const
 
int next_output_stream_index () const
 
const std::map< int, std::pair
< std::shared_ptr
< MediaHandler >, int > > & 
output_handlers ()
 

Detailed Description

Demuxer is responsible for extracting elementary stream samples from a media file, e.g. an ISO BMFF file.

Definition at line 32 of file demuxer.h.

Constructor & Destructor Documentation

shaka::media::Demuxer::Demuxer ( const std::string &  file_name)
explicit
Parameters
file_namespecifies the input source. It uses prefix matching to create a proper File object. The user can extend File to support a custom File object with its own prefix.

Definition at line 70 of file demuxer.cc.

Member Function Documentation

void shaka::media::Demuxer::Cancel ( )

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

Definition at line 119 of file demuxer.cc.

MediaContainerName shaka::media::Demuxer::container_name ( )
inline
Returns
Container name (type). Value is CONTAINER_UNKNOWN if the demuxer is not initialized.

Definition at line 56 of file demuxer.h.

Status shaka::media::Demuxer::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 80 of file demuxer.h.

Status shaka::media::Demuxer::Process ( std::unique_ptr< StreamData stream_data)
inlineoverrideprotectedvirtual

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 81 of file demuxer.h.

Status shaka::media::Demuxer::Run ( )

Drive the remuxing from demuxer side (push). Read the file and push the Data to Muxer until Eof.

Definition at line 82 of file demuxer.cc.

Status shaka::media::Demuxer::SetHandler ( const std::string &  stream_label,
std::shared_ptr< MediaHandler handler 
)

Set the handler for the specified stream.

Parameters
stream_labelcan be 'audio', 'video', or stream number (zero based).
handleris the handler for the specified stream.

Definition at line 123 of file demuxer.cc.

void shaka::media::Demuxer::SetKeySource ( std::unique_ptr< KeySource key_source)

Set the KeySource for media decryption.

Parameters
key_sourcepoints to the source of decryption keys. The key source must support fetching of keys for the type of media being demuxed.

Definition at line 78 of file demuxer.cc.

void shaka::media::Demuxer::SetLanguageOverride ( const std::string &  stream_label,
const std::string &  language_override 
)

Override the language in the specified stream. If the specified stream is a video stream or invalid, this function is a no-op.

Parameters
stream_labelcan be 'audio', 'video', or stream number (zero based).
language_overrideis the new language.

Definition at line 133 of file demuxer.cc.


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