DASH Media Packaging SDK
|
#include <muxer.h>
Public Member Functions | |
Muxer (const MuxerOptions &options) | |
void | SetKeySource (KeySource *encryption_key_source, uint32_t max_sd_pixels, uint32_t max_hd_pixels, uint32_t max_uhd1_pixels, double clear_lead_in_seconds, double crypto_period_duration_in_seconds, FourCC protection_scheme) |
void | Cancel () |
void | SetMuxerListener (std::unique_ptr< MuxerListener > muxer_listener) |
void | SetProgressListener (std::unique_ptr< ProgressListener > progress_listener) |
const std::vector < std::shared_ptr< StreamInfo > > & | streams () const |
void | set_clock (base::Clock *clock) |
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 | |
const MuxerOptions & | options () const |
KeySource * | encryption_key_source () |
uint32_t | max_sd_pixels () const |
uint32_t | max_hd_pixels () const |
uint32_t | max_uhd1_pixels () const |
double | clear_lead_in_seconds () const |
double | crypto_period_duration_in_seconds () const |
MuxerListener * | muxer_listener () |
ProgressListener * | progress_listener () |
base::Clock * | clock () |
FourCC | protection_scheme () const |
MediaHandler implementation overrides. | |
Status | InitializeInternal () override |
Status | Process (std::unique_ptr< StreamData > stream_data) override |
Status | OnFlushRequest (int 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 (int stream_index) const |
Validate if the stream at the specified index actually exists. | |
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 () |
Muxer is responsible for taking elementary stream samples and producing media containers. An optional KeySource can be provided to Muxer to generate encrypted outputs.
void shaka::media::Muxer::Cancel | ( | ) |
|
inlineoverrideprotectedvirtual |
Internal implementation of initialize. Note that it should only initialize the MediaHandler itself. Downstream handlers are handled in Initialize().
Implements shaka::media::MediaHandler.
|
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.
|
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 base::Time::Now() to generate the time-stamps.
clock | is the Clock to be injected. |
void shaka::media::Muxer::SetKeySource | ( | KeySource * | encryption_key_source, |
uint32_t | max_sd_pixels, | ||
uint32_t | max_hd_pixels, | ||
uint32_t | max_uhd1_pixels, | ||
double | clear_lead_in_seconds, | ||
double | crypto_period_duration_in_seconds, | ||
FourCC | protection_scheme | ||
) |
Set encryption key source.
encryption_key_source | points to the encryption key source. The caller retains ownership, and should not be NULL. |
max_sd_pixels | specifies the threshold to determine whether a video track should be considered as SD. If the max pixels per frame is no higher than max_sd_pixels, it is SD. |
max_hd_pixels | specifies the threshold to determine whether a video track should be considered as HD. If the max pixels per frame is higher than max_sd_pixels, but no higher than max_hd_pixels, it is HD. |
max_uhd1_pixels | specifies the threshold to determine whether a video track should be considered as UHD1. If the max pixels per frame is higher than max_hd_pixels, but no higher than max_uhd1_pixels, it is UHD1. Otherwise it is UHD2. |
clear_lead_in_seconds | specifies clear lead duration in seconds. |
crypto_period_duration_in_seconds | specifies crypto period duration in seconds. A positive value means key rotation is enabled, the key source must support key rotation in this case. |
protection_scheme | specifies the protection scheme: 'cenc', 'cens', 'cbc1', 'cbcs'. |
void shaka::media::Muxer::SetMuxerListener | ( | std::unique_ptr< MuxerListener > | muxer_listener | ) |
Set a MuxerListener event handler for this object.
muxer_listener | should not be NULL. |
void shaka::media::Muxer::SetProgressListener | ( | std::unique_ptr< ProgressListener > | progress_listener | ) |
Set a ProgressListener event handler for this object.
progress_listener | should not be NULL. |