Rialto  0.1
Rialto media pipeline API
Classes | Public Types | Public Member Functions | List of all members
firebolt::rialto::IMediaPipeline Class Referenceabstract

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
 
IMediaPipelineoperator= (const IMediaPipeline &)=delete
 
 IMediaPipeline (IMediaPipeline &&)=delete
 
IMediaPipelineoperator= (IMediaPipeline &&)=delete
 
virtual std::weak_ptr< IMediaPipelineClientgetClient ()=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 &currentVolume)=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...
 

Detailed Description

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.

Member Function Documentation

◆ addSegment()

virtual AddSegmentStatus firebolt::rialto::IMediaPipeline::addSegment ( uint32_t  needDataRequestId,
const std::unique_ptr< MediaSegment > &  mediaSegment 
)
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.

Parameters
[in]needDataRequestId: The status
[in]mediaSegment: The data returned.
Return values
statusof adding segment

◆ allSourcesAttached()

virtual bool firebolt::rialto::IMediaPipeline::allSourcesAttached ( )
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.

Return values
trueon success.

◆ attachSource()

virtual bool firebolt::rialto::IMediaPipeline::attachSource ( const std::unique_ptr< MediaSource > &  source)
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.

Parameters
[in]source: The source.
Return values
trueon success.

◆ flush()

virtual bool firebolt::rialto::IMediaPipeline::flush ( int32_t  sourceId,
bool  resetTime 
)
pure virtual

Flushes a source.

This method is called by Rialto Client to flush out all queued data for a media source stream.

Parameters
[in]sourceId: The source id. Value should be set to the MediaSource.id returned after attachSource()
[in]resetTime: True if time should be reset
Return values
trueon success.

◆ getBufferingLimit()

virtual bool firebolt::rialto::IMediaPipeline::getBufferingLimit ( uint32_t &  limitBufferingMs)
pure virtual

Get buffering limit.

This method returns current value of buffering limit in milliseconds Method will return kInvalidLimitBuffering limit buffering is disabled

Parameters
[out]limitBufferingMs: buffering limit in ms
Return values
trueon success.

◆ getClient()

virtual std::weak_ptr<IMediaPipelineClient> firebolt::rialto::IMediaPipeline::getClient ( )
pure virtual

Returns the media player client.

Return values
Themedia player client.

◆ getImmediateOutput()

virtual bool firebolt::rialto::IMediaPipeline::getImmediateOutput ( int32_t  sourceId,
bool &  immediateOutput 
)
pure virtual

Gets the "Immediate Output" property for this source.

This method is sychronous, it gets the "Immediate Output" property

Parameters
[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
Return values
trueon success.

◆ getMute()

virtual bool firebolt::rialto::IMediaPipeline::getMute ( int32_t  sourceId,
bool &  mute 
)
pure virtual

Get current mute status of the media source.

Parameters
[in]sourceIdSource, which mute status should be fetched
[out]muteCurrent mute state
Return values
trueon success false otherwise

◆ getPosition()

virtual bool firebolt::rialto::IMediaPipeline::getPosition ( int64_t &  position)
pure virtual

Get the playback position in nanoseconds.

This method is sychronous, it returns current playback position

Parameters
[out]position: The playback position in nanoseconds
Return values
trueon success.

◆ getStats()

virtual bool firebolt::rialto::IMediaPipeline::getStats ( int32_t  sourceId,
uint64_t &  renderedFrames,
uint64_t &  droppedFrames 
)
pure virtual

Get stats for this source.

This method is sychronous, it returns dropped frames and rendered frames

Parameters
[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
Return values
trueon success.

◆ getStreamSyncMode()

virtual bool firebolt::rialto::IMediaPipeline::getStreamSyncMode ( int32_t &  streamSyncMode)
pure virtual

Get stream sync mode property on the audio decoder.

Parameters
[out]streamSyncMode: Current stream sync mode value.
Return values
trueon success false otherwise

◆ getSync()

virtual bool firebolt::rialto::IMediaPipeline::getSync ( bool &  sync)
pure virtual

Get sync property on the audio sink.

Parameters
[out]sync: Current sync value.
Return values
trueon success false otherwise

◆ getTextTrackIdentifier()

virtual bool firebolt::rialto::IMediaPipeline::getTextTrackIdentifier ( std::string &  textTrackIdentifier)
pure virtual

Get Text Track Identifier.

Parameters
[in]textTrackIdentifierText track identifier of subtitle stream
Return values
trueon success false otherwise

◆ getUseBuffering()

virtual bool firebolt::rialto::IMediaPipeline::getUseBuffering ( bool &  useBuffering)
pure virtual

Checks, if buffering is enabled.

This method returns true, if buffering is enabled

Parameters
[out]useBuffering: true if buffering option is enabled.
Return values
trueon success.

◆ getVolume()

virtual bool firebolt::rialto::IMediaPipeline::getVolume ( double &  currentVolume)
pure virtual

Get current audio level. Fetches the current volume level for the pipeline.

Parameters
[out]currentVolume: Current volume level (range 0.0 - 1.0)
Return values
trueon success, false otherwise.

◆ haveData()

virtual bool firebolt::rialto::IMediaPipeline::haveData ( MediaSourceStatus  status,
uint32_t  needDataRequestId 
)
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.

Parameters
[in]status: The status
[in]needDataRequestId: Need data request id

◆ load()

virtual bool firebolt::rialto::IMediaPipeline::load ( MediaType  type,
const std::string &  mimeType,
const std::string &  url 
)
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.

Parameters
[in]type: The media type.
[in]mimeType: The MIME type.
[in]url: The URL.

◆ pause()

virtual bool firebolt::rialto::IMediaPipeline::pause ( )
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.

Return values
trueon success.

◆ play()

virtual bool firebolt::rialto::IMediaPipeline::play ( )
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.

Return values
trueon success.

◆ processAudioGap()

virtual bool firebolt::rialto::IMediaPipeline::processAudioGap ( int64_t  position,
uint32_t  duration,
int64_t  discontinuityGap,
bool  audioAac 
)
pure virtual

Process audio gap.

This method handles audio gap in order to avoid audio pops during transitions.

Parameters
[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
Return values
trueon success.

◆ removeSource()

virtual bool firebolt::rialto::IMediaPipeline::removeSource ( int32_t  id)
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.

Parameters
[in]id: The source id. Value should be set to the MediaSource.id returned after attachSource()
Return values
trueon success.

◆ setBufferingLimit()

virtual bool firebolt::rialto::IMediaPipeline::setBufferingLimit ( uint32_t  limitBufferingMs)
pure virtual

Set buffering limit.

This method enables/disables limit buffering and sets millisecond threshold used. Use kInvalidLimitBuffering to disable limit buffering

Parameters
[in]limitBufferingMs: buffering limit in ms
Return values
trueon success.

◆ setImmediateOutput()

virtual bool firebolt::rialto::IMediaPipeline::setImmediateOutput ( int32_t  sourceId,
bool  immediateOutput 
)
pure virtual

Sets the "Immediate Output" property for this source.

This method is asynchronous, it will set the "Immediate Output" property

Parameters
[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
Return values
trueon success.

◆ setLowLatency()

virtual bool firebolt::rialto::IMediaPipeline::setLowLatency ( bool  lowLatency)
pure virtual

Set low latency property on the audio sink. Default false.

For use with gaming (no audio decoding, no a/v sync).

Parameters
[in]lowLatency: The low latency value to set.
Return values
trueon success false otherwise

◆ setMute()

virtual bool firebolt::rialto::IMediaPipeline::setMute ( int32_t  sourceId,
bool  mute 
)
pure virtual

Set mute status of pipeline.

Change mute status of media source

Parameters
[in]sourceIdSource, which mute status should be changed
[in]muteDesired mute state, true=muted, false=not muted
Return values
trueon success false otherwise

◆ setPlaybackRate()

virtual bool firebolt::rialto::IMediaPipeline::setPlaybackRate ( double  rate)
pure virtual

Set the playback rate.

This method sets the playback rate. The supported playback rates are dependent upon the backend playback method.

Parameters
[in]rate: The playback rate.
Return values
trueon success.

◆ setPosition()

virtual bool firebolt::rialto::IMediaPipeline::setPosition ( int64_t  position)
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.

Parameters
[in]position: The playback position in nanoseconds.
Return values
trueon success.

◆ setSourcePosition()

virtual bool firebolt::rialto::IMediaPipeline::setSourcePosition ( int32_t  sourceId,
int64_t  position,
bool  resetTime = false,
double  appliedRate = 1.0,
uint64_t  stopPosition = kUndefinedPosition 
)
pure virtual

Set the source position in nanoseconds.

This method sets the start position for a source.

Parameters
[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
Return values
trueon success.

◆ setStreamSyncMode()

virtual bool firebolt::rialto::IMediaPipeline::setStreamSyncMode ( int32_t  sourceId,
int32_t  streamSyncMode 
)
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.

Parameters
[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.
Return values
trueon success false otherwise

◆ setSync()

virtual bool firebolt::rialto::IMediaPipeline::setSync ( bool  sync)
pure virtual

Set sync property on the audio sink. Default false.

Syncs the stream on the clock.

Parameters
[in]sync: The sync value to set.
Return values
trueon success false otherwise

◆ setSyncOff()

virtual bool firebolt::rialto::IMediaPipeline::setSyncOff ( bool  syncOff)
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.

Parameters
[in]syncOff: The sync off value to set.
Return values
trueon success false otherwise

◆ setTextTrackIdentifier()

virtual bool firebolt::rialto::IMediaPipeline::setTextTrackIdentifier ( const std::string &  textTrackIdentifier)
pure virtual

Change Text Track Identifier.

Parameters
[in]textTrackIdentifierText track identifier of subtitle stream
Return values
trueon success false otherwise

◆ setUseBuffering()

virtual bool firebolt::rialto::IMediaPipeline::setUseBuffering ( bool  useBuffering)
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.

Parameters
[in]useBuffering: true if buffering option enabled.
Return values
trueon success.

◆ setVideoWindow()

virtual bool firebolt::rialto::IMediaPipeline::setVideoWindow ( uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)
pure virtual

Sets the coordinates of where the video should be displayed.

Parameters
[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.
Return values
trueon success.

◆ setVolume()

virtual bool firebolt::rialto::IMediaPipeline::setVolume ( double  targetVolume,
uint32_t  volumeDuration = 0,
EaseType  easeType = EaseType::EASE_LINEAR 
)
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.

Parameters
[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
Return values
trueon success, false otherwise.

◆ stop()

virtual bool firebolt::rialto::IMediaPipeline::stop ( )
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.

Return values
trueon success.

◆ switchSource()

virtual bool firebolt::rialto::IMediaPipeline::switchSource ( const std::unique_ptr< MediaSource > &  source)
pure virtual

Switches a source stream.

This method is called to switch a media source stream.

Parameters
[in]source: The source.
Return values
trueon success.

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