Rialto
0.1
Rialto media pipeline API
|
The definition of the IMediaPipeline interface. More...
#include <IMediaPipeline.h>
Classes | |
class | MediaSegment |
A class that represents a media segment. More... | |
class | MediaSegmentAudio |
A class that represents media source audio data. More... | |
class | MediaSegmentVideo |
A class that represents media source video data. More... | |
class | MediaSource |
A class that represents a source of media data. More... | |
class | MediaSourceAudio |
A class that represents media source audio derived from MediaSource class, which represents the source of media data. More... | |
class | MediaSourceAV |
A class that represents media source audio and video derived from MediaSource class, which represents the source of media data. More... | |
class | MediaSourceSubtitle |
A class that represents media source subtitle derived from media source video data. More... | |
class | MediaSourceVideo |
A class that represents media source video derived from MediaSource class, which represents the source of media data. More... | |
class | MediaSourceVideoDolbyVision |
A class that represents media source video dolby vision derived from media source video data. More... | |
Public Types | |
typedef std::vector< std::unique_ptr< MediaSegment > > | MediaSegmentVector |
A vector that contains one or more media segments. | |
Public Member Functions | |
IMediaPipeline (const IMediaPipeline &)=delete | |
IMediaPipeline & | operator= (const IMediaPipeline &)=delete |
IMediaPipeline (IMediaPipeline &&)=delete | |
IMediaPipeline & | operator= (IMediaPipeline &&)=delete |
virtual std::weak_ptr< IMediaPipelineClient > | getClient ()=0 |
Returns the media player client. More... | |
virtual bool | load (MediaType type, const std::string &mimeType, const std::string &url)=0 |
Loads the media and backend delegate. More... | |
virtual bool | attachSource (const std::unique_ptr< MediaSource > &source)=0 |
Attaches a source stream to the backend. More... | |
virtual bool | removeSource (int32_t id)=0 |
Unattaches a source. More... | |
virtual bool | allSourcesAttached ()=0 |
Notifies Rialto Server that all sources were attached. More... | |
virtual bool | play ()=0 |
Starts playback of the media. More... | |
virtual bool | pause ()=0 |
Pauses playback of the media. More... | |
virtual bool | stop ()=0 |
Stops playback of the media. More... | |
virtual bool | setPlaybackRate (double rate)=0 |
Set the playback rate. More... | |
virtual bool | setPosition (int64_t position)=0 |
Set the playback position in nanoseconds. More... | |
virtual bool | getPosition (int64_t &position)=0 |
Get the playback position in nanoseconds. More... | |
virtual bool | getStats (int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames)=0 |
Get stats for this source. More... | |
virtual bool | setImmediateOutput (int32_t sourceId, bool immediateOutput)=0 |
Sets the "Immediate Output" property for this source. More... | |
virtual bool | getImmediateOutput (int32_t sourceId, bool &immediateOutput)=0 |
Gets the "Immediate Output" property for this source. More... | |
virtual bool | setVideoWindow (uint32_t x, uint32_t y, uint32_t width, uint32_t height)=0 |
Sets the coordinates of where the video should be displayed. More... | |
virtual bool | haveData (MediaSourceStatus status, uint32_t needDataRequestId)=0 |
Returns data requested using notifyNeedMediaData(). More... | |
virtual AddSegmentStatus | addSegment (uint32_t needDataRequestId, const std::unique_ptr< MediaSegment > &mediaSegment)=0 |
Adds a single segment to Rialto in response to notifyNeedData() More... | |
virtual bool | renderFrame ()=0 |
Requests to render a prerolled frame. | |
virtual bool | setVolume (double targetVolume, uint32_t volumeDuration=0, EaseType easeType=EaseType::EASE_LINEAR)=0 |
Set the target volume level and transition duration with easing type. By default volume is set immediately if duration and type are not set. More... | |
virtual bool | getVolume (double ¤tVolume)=0 |
Get current audio level. Fetches the current volume level for the pipeline. More... | |
virtual bool | setMute (int32_t sourceId, bool mute)=0 |
Set mute status of pipeline. More... | |
virtual bool | getMute (int32_t sourceId, bool &mute)=0 |
Get current mute status of the media source. More... | |
virtual bool | setTextTrackIdentifier (const std::string &textTrackIdentifier)=0 |
Change Text Track Identifier. More... | |
virtual bool | getTextTrackIdentifier (std::string &textTrackIdentifier)=0 |
Get Text Track Identifier. More... | |
virtual bool | setLowLatency (bool lowLatency)=0 |
Set low latency property on the audio sink. Default false. More... | |
virtual bool | setSync (bool sync)=0 |
Set sync property on the audio sink. Default false. More... | |
virtual bool | getSync (bool &sync)=0 |
Get sync property on the audio sink. More... | |
virtual bool | setSyncOff (bool syncOff)=0 |
Set sync off property on the audio decoder. Default false. More... | |
virtual bool | setStreamSyncMode (int32_t sourceId, int32_t streamSyncMode)=0 |
Set stream sync mode property on the audio decoder or video filter. Default 0. More... | |
virtual bool | getStreamSyncMode (int32_t &streamSyncMode)=0 |
Get stream sync mode property on the audio decoder. More... | |
virtual bool | flush (int32_t sourceId, bool resetTime)=0 |
Flushes a source. More... | |
virtual bool | setSourcePosition (int32_t sourceId, int64_t position, bool resetTime=false, double appliedRate=1.0, uint64_t stopPosition=kUndefinedPosition)=0 |
Set the source position in nanoseconds. More... | |
virtual bool | processAudioGap (int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac)=0 |
Process audio gap. More... | |
virtual bool | setBufferingLimit (uint32_t limitBufferingMs)=0 |
Set buffering limit. More... | |
virtual bool | getBufferingLimit (uint32_t &limitBufferingMs)=0 |
Get buffering limit. More... | |
virtual bool | setUseBuffering (bool useBuffering)=0 |
Enables/disables the buffering option. More... | |
virtual bool | getUseBuffering (bool &useBuffering)=0 |
Checks, if buffering is enabled. More... | |
virtual bool | switchSource (const std::unique_ptr< MediaSource > &source)=0 |
Switches a source stream. More... | |
The definition of the IMediaPipeline interface.
This interface defines the public API of Rialto for playback of AV content which should be implemented by both Rialto Client & Rialto Server.
|
pure virtual |
Adds a single segment to Rialto in response to notifyNeedData()
This method is should be called by the client as a result of a notifyNeedData() notification. The client should call this API for each segment to be sent in response to the notification and then call haveData() when all segments have been 'added'.
If the return code is NO_SPACE the segment has not been accepted but this is not an error. The client should retain the segment until the next notifyNeedData() is received for the source and immediately call haveData() to trigger Rialto to start processing the segments already added.
[in] | needDataRequestId | : The status |
[in] | mediaSegment | : The data returned. |
status | of adding segment |
|
pure virtual |
Notifies Rialto Server that all sources were attached.
This method is called by Rialto Client to notify the RialtoServer that all sources were attached.
Must be called, otherwise streaming cannot commence. Can be called only once.
true | on success. |
|
pure virtual |
Attaches a source stream to the backend.
This method is called by Rialto Client to attach a media source stream to the backend. It is only called when Media Source Extensions are being used. I.e. if the MediaType value in load() is MediaType::MSE.
[in] | source | : The source. |
true | on success. |
|
pure virtual |
Flushes a source.
This method is called by Rialto Client to flush out all queued data for a media source stream.
[in] | sourceId | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
[in] | resetTime | : True if time should be reset |
true | on success. |
|
pure virtual |
Get buffering limit.
This method returns current value of buffering limit in milliseconds Method will return kInvalidLimitBuffering limit buffering is disabled
[out] | limitBufferingMs | : buffering limit in ms |
true | on success. |
|
pure virtual |
Returns the media player client.
The | media player client. |
|
pure virtual |
Gets the "Immediate Output" property for this source.
This method is sychronous, it gets the "Immediate Output" property
[in] | sourceId | : The source id. Value should be get to the MediaSource.id returned after attachSource() |
[out] | immediateOutput | : Get immediate output mode on the sink |
true | on success. |
|
pure virtual |
Get current mute status of the media source.
[in] | sourceId | Source, which mute status should be fetched |
[out] | mute | Current mute state |
true | on success false otherwise |
|
pure virtual |
Get the playback position in nanoseconds.
This method is sychronous, it returns current playback position
[out] | position | : The playback position in nanoseconds |
true | on success. |
|
pure virtual |
Get stats for this source.
This method is sychronous, it returns dropped frames and rendered frames
[in] | sourceId | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
[out] | renderedFrames | : The number of rendered frames |
[out] | droppedFrames | : The number of dropped frames |
true | on success. |
|
pure virtual |
Get stream sync mode property on the audio decoder.
[out] | streamSyncMode | : Current stream sync mode value. |
true | on success false otherwise |
|
pure virtual |
Get sync property on the audio sink.
[out] | sync | : Current sync value. |
true | on success false otherwise |
|
pure virtual |
Get Text Track Identifier.
[in] | textTrackIdentifier | Text track identifier of subtitle stream |
true | on success false otherwise |
|
pure virtual |
Checks, if buffering is enabled.
This method returns true, if buffering is enabled
[out] | useBuffering | : true if buffering option is enabled. |
true | on success. |
|
pure virtual |
Get current audio level. Fetches the current volume level for the pipeline.
[out] | currentVolume | : Current volume level (range 0.0 - 1.0) |
true | on success, false otherwise. |
|
pure virtual |
Returns data requested using notifyNeedMediaData().
This method is called as a result of calling notifyNeedMediaData() on the media client. The status value indicates the success or otherwise of the request. The client must first call addSegment() for for each media segment to be sent. A status of MediaSourceStatus::OK indicates success and there will be data within the data vector. A status of MediaSourceStatus::EOS indicates success but the end of the stream was reached. Again there will be data in the vector. A status of MediaSourceStatus::ERROR indicates an error occurred and no data was returned.
[in] | status | : The status |
[in] | needDataRequestId | : Need data request id |
|
pure virtual |
Loads the media and backend delegate.
This method loads the media and backend appropriate for the media. The media type determines the backend delegate to use to play back the media. The MIME type confirms the type and CODECs for the media. The URL will comprise the media URL for types MediaType::URL and MediaType::HLS. For MediaType::MSE the URL will comprise a blob URL as the data is loaded by the browser.
[in] | type | : The media type. |
[in] | mimeType | : The MIME type. |
[in] | url | : The URL. |
|
pure virtual |
Pauses playback of the media.
This method is considered to be asynchronous and MUST NOT block but should request the playback pause and then return.
Once the backend is successfully playing it should notify the media player client of playback state IMediaPipelineClient::PlaybackState::PAUSED.
true | on success. |
|
pure virtual |
Starts playback of the media.
This method is considered to be asynchronous and MUST NOT block but should request playback and then return.
Once the backend is successfully playing it should notify the media player client of playback state IMediaPipelineClient::PlaybackState::PLAYING.
true | on success. |
|
pure virtual |
Process audio gap.
This method handles audio gap in order to avoid audio pops during transitions.
[in] | position | : Audio pts fade position |
[in] | duration | : Audio pts fade duration |
[in] | discontinuityGap | : Audio discontinuity gap |
[in] | audioAac | : True if audio codec is AAC |
true | on success. |
|
pure virtual |
Unattaches a source.
This method is called by Rialto Client to detach a media source stream from the backend. It is only called when Media Source Extensions are being used. I.e. if the MediaType value in load() is MediaType::MSE.
[in] | id | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
true | on success. |
|
pure virtual |
Set buffering limit.
This method enables/disables limit buffering and sets millisecond threshold used. Use kInvalidLimitBuffering to disable limit buffering
[in] | limitBufferingMs | : buffering limit in ms |
true | on success. |
|
pure virtual |
Sets the "Immediate Output" property for this source.
This method is asynchronous, it will set the "Immediate Output" property
[in] | sourceId | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
[in] | immediateOutput | : Set immediate output mode on the sink |
true | on success. |
|
pure virtual |
Set low latency property on the audio sink. Default false.
For use with gaming (no audio decoding, no a/v sync).
[in] | lowLatency | : The low latency value to set. |
true | on success false otherwise |
|
pure virtual |
Set mute status of pipeline.
Change mute status of media source
[in] | sourceId | Source, which mute status should be changed |
[in] | mute | Desired mute state, true=muted, false=not muted |
true | on success false otherwise |
|
pure virtual |
Set the playback rate.
This method sets the playback rate. The supported playback rates are dependent upon the backend playback method.
[in] | rate | : The playback rate. |
true | on success. |
|
pure virtual |
Set the playback position in nanoseconds.
If playback has not started this method sets the start position for playback. If playback has started this method performs a seek.
This method is considered to be asynchronous and MUST NOT block but should request the new playback position and then return.
Once the backend is seeking it should notify the media player client of playback state IMediaPipelineClient::PlaybackState::SEEKING. When seeking has completed the state IMediaPipelineClient::PlaybackState::SEEK_DONE should be notified followed by IMediaPipelineClient::PlaybackState::PLAYING.
[in] | position | : The playback position in nanoseconds. |
true | on success. |
|
pure virtual |
Set the source position in nanoseconds.
This method sets the start position for a source.
[in] | sourceId | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
[in] | position | : The position in nanoseconds. |
[in] | resetTime | : True if time should be reset |
[in] | appliedRate | : The applied rate after seek. Default value is 1.0. |
[in] | stopPosition | : The position of last pushed buffer |
true | on success. |
|
pure virtual |
Set stream sync mode property on the audio decoder or video filter. Default 0.
1 - Frame to decode frame will immediately proceed next frame sync. 0 - Frame decoded with no frame sync.
[in] | sourceId | : The source id. Value should be set to the MediaSource.id returned after attachSource() |
[in] | streamSyncMode | : The stream sync mode value to set. |
true | on success false otherwise |
|
pure virtual |
Set sync property on the audio sink. Default false.
Syncs the stream on the clock.
[in] | sync | : The sync value to set. |
true | on success false otherwise |
|
pure virtual |
Set sync off property on the audio decoder. Default false.
Turn on free running audio. Must be set before pipeline is PLAYING state.
[in] | syncOff | : The sync off value to set. |
true | on success false otherwise |
|
pure virtual |
Change Text Track Identifier.
[in] | textTrackIdentifier | Text track identifier of subtitle stream |
true | on success false otherwise |
|
pure virtual |
Enables/disables the buffering option.
This method enables the buffering option so that BUFFERING messages are emitted based on low-/high-percent thresholds.
[in] | useBuffering | : true if buffering option enabled. |
true | on success. |
|
pure virtual |
Sets the coordinates of where the video should be displayed.
[in] | x | : The x position in pixels. |
[in] | y | : The y position in pixels. |
[in] | width | : The width in pixels. |
[in] | height | : The height in pixels. |
true | on success. |
|
pure virtual |
Set the target volume level and transition duration with easing type. By default volume is set immediately if duration and type are not set.
[in] | targetVolume | : Target volume level (0.0 - 1.0) |
[in] | volumeDuration | : (Optional) Duration of the volume transition in milliseconds |
[in] | easeType | : (Optional) Easing type for the volume transition |
true | on success, false otherwise. |
|
pure virtual |
Stops playback of the media.
This method is considered to be asynchronous and MUST NOT block but should request the playback stop and then return.
Once the backend is successfully stopped it should notify the media player client of playback state IMediaPipelineClient::PlaybackState::STOPPED.
true | on success. |
|
pure virtual |
Switches a source stream.
This method is called to switch a media source stream.
[in] | source | : The source. |
true | on success. |