|
Native Player
1.0
|
#include <stream_manager.h>
Public Member Functions | |
| StreamManager (pp::InstanceHandle instance, StreamType type) | |
| ~StreamManager () | |
| bool | Initialize (std::unique_ptr< MediaSegmentSequence > segment_sequence, std::shared_ptr< Samsung::NaClPlayer::ESDataSource > es_data_source, std::function< void(StreamType)> stream_configured_callback, Samsung::NaClPlayer::DRMType drm_type=Samsung::NaClPlayer::DRMType_Unknown) |
| void | SetMediaSegmentSequence (std::unique_ptr< MediaSegmentSequence > segment_sequence) |
| Samsung::NaClPlayer::TimeTicks | UpdateBuffer (Samsung::NaClPlayer::TimeTicks playback_time) |
| bool | IsInitialized () |
This class manages a single NaCl Player elementary stream.
StreamManager responsibility is to manage a single NaCl Player elementary stream (i.e. either an audio or a video stream, each stream managed by a separate StreamManager instance). The elementary stream is represented by a MediaSegmentSequence object associated with an instance of this class. Media segments are acquired by the StreamManager object during playback and then demuxed into a series of ElementaryStreamPacket objects which are delivered to NaCl Player. Demuxing is done by using StreamDemuxer.
This class implements the ElementaryStreamListener interface, which allows to receive notifications regarding an internal NaCl Player elementary stream packet buffer's state. This information is used to control a speed at which elementary stream packets are sent to NaCl Player.
It is StreamManager responsibility to configure an elementary stream it manages. When the StreamDemuxer object discovers a configuration of the associated MediaSegmentSequence, this class properly configures NaCl Player using the discovered configuration.
At any given time, an initialized StreamManager manages only one particular representation of the stream, which is associated with the used MediaSegmentSequence object. However, the representation (media segment sequence) can be changed.
MediaSegmentSequence StreamDemuxer Samsung::NaClPlayer::ElementaryStreamListener Definition at line 79 of file stream_manager.h.
|
explicit |
Creates a StreamManager object and opens a stream of a given type in a give player. Newly created object must be initialized using the Initialize() method before use.
StreamManager object per stream type should exist for any given player at any given time.| [in] | instance | An InstanceHandle identifying a Native Player object. |
| [in] | type | A stream type for which the StreamManager object is constructed. |
| StreamManager::~StreamManager | ( | ) |
Destroys a StreamManager object and closes a stream it manages.
| bool StreamManager::Initialize | ( | std::unique_ptr< MediaSegmentSequence > | segment_sequence, |
| std::shared_ptr< Samsung::NaClPlayer::ESDataSource > | es_data_source, | ||
| std::function< void(StreamType)> | stream_configured_callback, | ||
| Samsung::NaClPlayer::DRMType | drm_type = Samsung::NaClPlayer::DRMType_Unknown |
||
| ) |
Initializes a StreamManager object, associating it with a segment_sequence and enabling it to deliver elementary stream packets from that sequence to NaCl Player.
This method must be called before a given es_data_source is attached to NaCl Player (i.e. before media stream configuration is completed and thus before EsDashPlayerController::OnStreamConfigured() for the managed stream is called).
| [in] | segment_sequence | A source of elementary stream packets to be used in this stream. |
| [in] | es_data_source | NaCl Player data source which will consume elementary stream packets. |
| [in] | stream_configured_callback | A callback which will be called whenever a new stream configuration is discovered and successfully applied to NaCl Player. |
| [in] | drm_type | A DRM scheme used by the managed stream. If no DRM is in use, use Samsung::NaClPlayer::DRMType_Unknown. |
true if an initialization was successfull, or false otherwise. | bool StreamManager::IsInitialized | ( | ) |
Checks if this StreamManager was initialized, i.e. Initialize() was successfully called on this object before and thus internal demuxer is properly initialized.
true value if this StreamManager is in a proper and useable state, or a false otherwise. | void StreamManager::SetMediaSegmentSequence | ( | std::unique_ptr< MediaSegmentSequence > | segment_sequence | ) |
Changes a MediaSegmentSequence object associated with this stream. This method resets internal demuxer to parse a given new media segment, usually causing a change in a stream configuration.
This method allows to change a representation of this media stream by providing a MediaSegmentSequence of the new representation.
| [in] | segment_sequence | A new source of elementary stream packets to be used in this stream. |
| Samsung::NaClPlayer::TimeTicks StreamManager::UpdateBuffer | ( | Samsung::NaClPlayer::TimeTicks | playback_time | ) |
Checks if there is enough data buffered for this stream and initiates data download and parsing if there is not enough buffered elementary stream packets. Additionally, this method sends elementary stream packets to NaCl Player for a playback.
UpdateBuffer() should be called periodically to keep playback going.
| [in] | playback_time | A current playback time. |