You.i Engine
CYIVLCVideoPlayer Class Reference

#include <player/YiVLCVideoPlayer.h>

Inheritance diagram for CYIVLCVideoPlayer:

Public Member Functions

 CYIVLCVideoPlayer ()
 
virtual ~CYIVLCVideoPlayer ()
 
virtual CYIString GetName_ () const override
 
virtual Statistics GetStatistics_ () const override
 
virtual std::unique_ptr< CYIVideoSurfaceCreateSurface_ () override
 
virtual void Prepare_ (const CYIUrl &videoURI, StreamingFormat format) override
 
virtual void Play_ () override
 
virtual void Pause_ () override
 
virtual uint64_t GetDurationMs_ () const override
 
virtual uint64_t GetCurrentTimeMs_ () const override
 
virtual void Stop_ () override
 
virtual std::vector< SeekableRangeGetLiveSeekableRanges_ () const override
 
virtual void Seek_ (uint64_t seekPositionMs) override
 
virtual bool SupportsFormat_ (StreamingFormat format, DRMScheme drmScheme) const override
 
virtual bool IsMuted_ () const override
 
virtual void Mute_ (bool mute) override
 
virtual bool SelectAudioTrack_ (uint32_t id) override
 
virtual CYIAbstractVideoPlayer::AudioTrackInfo GetActiveAudioTrack_ () const override
 
virtual std::vector< CYIAbstractVideoPlayer::AudioTrackInfoGetAudioTracks_ () const override
 
virtual void DisableClosedCaptions_ () override
 
virtual bool SelectClosedCaptionsTrack_ (uint32_t id) override
 
virtual std::vector< ClosedCaptionsTrackInfoGetClosedCaptionsTracks_ () const override
 
virtual CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack_ () const override
 
virtual void SetUserAgent_ (const CYIString &userAgent) override
 
- Public Member Functions inherited from CYIAbstractVideoPlayer
virtual ~CYIAbstractVideoPlayer ()
 
CYIString GetName () const
 
CYIString GetVersion () const
 
Statistics GetStatistics () const
 
void Init ()
 
void Prepare (const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState=CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr< DRMConfiguration > pDRMConfiguration=nullptr, uint64_t startTimeMs=0)
 
void Prepare (const std::shared_ptr< CYIAssetVideo > &videoAsset, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState=CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr< DRMConfiguration > pDRMConfiguration=nullptr, uint64_t startTimeMs=0)
 
void Play ()
 
void Pause ()
 
void Stop ()
 
std::vector< SeekableRangeGetLiveSeekableRanges () const
 
void Seek (uint64_t seekPositionMs)
 
bool SupportsFormat (StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None)
 
uint64_t GetDurationMs () const
 
uint64_t GetCurrentTimeMs () const
 
CYIAbstractVideoPlayer::PlayerState GetPlayerState () const
 
void SetClosedCaptionsEnabled (bool enabled)
 
bool AreClosedCaptionsTracksAvailable () const
 
bool SelectClosedCaptionsTrack (uint32_t id)
 
std::vector< ClosedCaptionsTrackInfoGetClosedCaptionsTracks () const
 
ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack () const
 
CYIClosedCaptionsDispatcherGetClosedCaptionsDispatcher () const
 
CYIVideoSurfaceGetSurface () const
 
bool AreAudioTracksAvailable () const
 
bool SelectAudioTrack (uint32_t id)
 
std::vector< AudioTrackInfoGetAudioTracks () const
 
AudioTrackInfo GetActiveAudioTrack () const
 
bool IsMuted () const
 
void Mute (bool mute)
 
void SetMaxBitrate (uint64_t maxBitrate)
 
void SetUserAgent (const CYIString &userAgent)
 
void SetVideoMetadata (const CYIAbstractVideoPlayer::VideoMetadata &metadata)
 
const DRMConfigurationGetDRMConfiguration () const
 
DRMConfigurationGetDRMConfiguration ()
 
BackgroundPlaybackInterfaceGetBackgroundPlaybackInterface () const
 
HeadphoneJackInterfaceGetHeadphoneJackInterface () const
 
BufferingInterfaceGetBufferingInterface () const
 
TimedMetadataInterfaceGetTimedMetadataInterface () const
 
VideoRequestHTTPHeadersInterfaceGetVideoRequestHTTPHeadersInterface ()
 
MediaPlaybackControlsInterfaceGetMediaPlaybackControlsInterface () const
 
void SetRefreshDRMConfigurationCallback (RefreshDRMConfigurationCallback callback)
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Friends

class CYIVLCVideoPlayerPriv
 

Additional Inherited Members

- Public Types inherited from CYIAbstractVideoPlayer
enum  MediaState {
  MediaState::Unloaded,
  MediaState::Preparing,
  MediaState::Ready
}
 
enum  PlaybackState {
  PlaybackState::Playing,
  PlaybackState::Paused,
  PlaybackState::Buffering
}
 
enum  StreamingFormat {
  StreamingFormat::HLS = 0,
  StreamingFormat::Smooth,
  StreamingFormat::DASH,
  StreamingFormat::MP4
}
 
enum  DRMScheme {
  DRMScheme::None = 0,
  DRMScheme::FairPlay,
  DRMScheme::PlayReady,
  DRMScheme::WidevineModular,
  DRMScheme::WidevineModularCustomRequest
}
 
enum  ErrorCode {
  ErrorCode::PlaybackError,
  ErrorCode::UnsupportedFormat,
  ErrorCode::StateTransitionError,
  ErrorCode::DRMError,
  ErrorCode::InitializationError,
  ErrorCode::Unknown
}
 
using RTTIInstantiatability = CYIRuntimeTypeInfo::NonInstantiableTag
 
using VideoMetadata = std::map< CYIString, CYIString >
 
using RefreshDRMConfigurationCallback = std::function< std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >(std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >)>
 
- Public Attributes inherited from CYIAbstractVideoPlayer
CYISignal BufferingStarted
 
CYISignal BufferingEnded
 
CYISignal< ErrorErrorOccurred
 
CYISignal Preparing
 
CYISignal Ready
 
CYISignal Playing
 
CYISignal Paused
 
CYISignal PlaybackComplete
 
CYISignal Finalized
 
CYISignal< uint64_t > CurrentTimeUpdated
 
CYISignal< uint64_t > DurationChanged
 
CYISignal< bool, uint64_t > SeekCompleted
 
CYISignal< const CYIAbstractVideoPlayer::PlayerState & > PlayerStateChanged
 
CYISignal< std::vector< AudioTrackInfo > > AvailableAudioTracksChanged
 
CYISignal< std::vector< ClosedCaptionsTrackInfo > > AvailableClosedCaptionsTracksChanged
 
CYISignal< float > TotalBitrateChanged
 
CYISignal< float > VideoBitrateChanged
 
CYISignal< float > AudioBitrateChanged
 
- Protected Member Functions inherited from CYIAbstractVideoPlayer
 CYIAbstractVideoPlayer ()
 
const std::shared_ptr< CYIMaterial > & GetVideoMaterial () const
 
void SetVideoSurfaceSize (const glm::ivec2 &size)
 
void ChangeInitialPlaybackState (CYIAbstractVideoPlayer::PlaybackState initialState)
 
CYIAbstractVideoPlayer::PlaybackState GetRequestedInitialPlaybackState () const
 
void CheckAndNotifyMediaTracksChanged ()
 
void UpdateCurrentTime ()
 
void OnRefreshDRMConfiguration ()
 
virtual CYIString GetVersion_ () const
 
virtual void Init_ ()
 
virtual bool SupportsFormat_ (StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None) const =0
 
virtual bool HasNativeBitrateEventHandling_ () const
 
virtual bool HasNativeSeekEventHandling_ () const
 
virtual void Prepare_ (const CYIUrl &videoURI, StreamingFormat format)=0
 
virtual void GetClosedCaptionsDispatcher_ () const
 
virtual void SetMaxBitrate_ (uint64_t maxBitrate)
 
virtual void SetVideoMetadata_ (const CYIAbstractVideoPlayer::VideoMetadata &metadata)
 
virtual BackgroundPlaybackInterfaceGetBackgroundPlaybackInterface_ () const
 
virtual HeadphoneJackInterfaceGetHeadphoneJackInterface_ () const
 
virtual BufferingInterfaceGetBufferingInterface_ () const
 
virtual TimedMetadataInterfaceGetTimedMetadataInterface_ () const
 
virtual VideoRequestHTTPHeadersInterfaceGetVideoRequestHTTPHeadersInterface_ ()
 
virtual MediaPlaybackControlsInterfaceGetMediaPlaybackControlsInterface_ () const
 
- Protected Attributes inherited from CYIAbstractVideoPlayer
CYISignal< ErrorNotifyErrorOccurred
 
CYISignal NotifyPlaybackComplete
 
CYISignal< uint64_t > NotifyDurationChanged
 
CYISignal< bool, uint64_t > NotifySeekCompleted
 
std::unique_ptr< CYIVideoPlayerStateManagerm_pStateManager
 
std::unique_ptr< CYIClosedCaptionsDispatcherm_pClosedCaptionsDispatcher
 
std::unique_ptr< DRMConfigurationm_pDRMConfiguration
 
uint64_t m_maxBitrate
 
uint64_t m_initialStartTimeMs
 
RefreshDRMConfigurationCallback m_refreshDRMConfigurationCallback
 

Constructor & Destructor Documentation

◆ CYIVLCVideoPlayer()

CYIVLCVideoPlayer::CYIVLCVideoPlayer ( )

◆ ~CYIVLCVideoPlayer()

virtual CYIVLCVideoPlayer::~CYIVLCVideoPlayer ( )
virtual

Member Function Documentation

◆ CreateSurface_()

virtual std::unique_ptr<CYIVideoSurface> CYIVLCVideoPlayer::CreateSurface_ ( )
overridevirtual

◆ DisableClosedCaptions_()

virtual void CYIVLCVideoPlayer::DisableClosedCaptions_ ( )
overridevirtual

Subclasses must implement this function to disable closed captions. This is called when captions are disabled by selecting a track with id ClosedCaptionsTrackInfo::OFF_TRACK_ID.

Implements CYIAbstractVideoPlayer.

◆ GetActiveAudioTrack_()

virtual CYIAbstractVideoPlayer::AudioTrackInfo CYIVLCVideoPlayer::GetActiveAudioTrack_ ( ) const
overridevirtual

Subclasses must implement this function to return information about the active audio track.

This function is only called if tracks are available, so a valid AudioTrackInfo instance must be returned.

See also
GetAudioTracks_
GetActiveAudioTrack

Implements CYIAbstractVideoPlayer.

◆ GetActiveClosedCaptionsTrack_()

virtual CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo CYIVLCVideoPlayer::GetActiveClosedCaptionsTrack_ ( ) const
overridevirtual

Subclasses must implement this function to return information about the active closed captions track.

This function is only called if tracks are available, so a valid ClosedCaptionsTrackInfo instance must be returned. If captions are disabled then a default constructed ClosedCaptionsTrackInfo must be returned.

See also
GetClosedCaptionsTracks_
SelectClosedCaptionsTrack

Implements CYIAbstractVideoPlayer.

◆ GetAudioTracks_()

virtual std::vector<CYIAbstractVideoPlayer::AudioTrackInfo> CYIVLCVideoPlayer::GetAudioTracks_ ( ) const
overridevirtual

Subclasses must implement this function to return a vector of available audio tracks for the currently loaded media.

The iDs of the returned tracks must be compatible with CYIAbstractVideoPlayer::SelectAudioTrack_.

This function is called each 1000 ms to check for updates to the available audio tracks.

Implements CYIAbstractVideoPlayer.

◆ GetClosedCaptionsTracks_()

virtual std::vector<ClosedCaptionsTrackInfo> CYIVLCVideoPlayer::GetClosedCaptionsTracks_ ( ) const
overridevirtual

Subclasses must implement this function to return a vector of available closed captions tracks for the currently loaded media. The "off" track is added by CYIAbstractVideoPlayer and must not be returned in this list.

The iDs of the returned tracks must be compatible with CYIAbstractVideoPlayer::SelectClosedCaptionsTrack_.

This function is called each 1000 ms to check for updates to the available audio tracks.

Implements CYIAbstractVideoPlayer.

◆ GetCurrentTimeMs_()

virtual uint64_t CYIVLCVideoPlayer::GetCurrentTimeMs_ ( ) const
overridevirtual

Subclasses must implement this function to report the current time of the video.

See also
GetCurrentTimeMs

Implements CYIAbstractVideoPlayer.

◆ GetDurationMs_()

virtual uint64_t CYIVLCVideoPlayer::GetDurationMs_ ( ) const
overridevirtual

Subclasses must implement this function to report the duration of the video.

See also
GetDurationMs

Implements CYIAbstractVideoPlayer.

◆ GetLiveSeekableRanges_()

virtual std::vector<SeekableRange> CYIVLCVideoPlayer::GetLiveSeekableRanges_ ( ) const
overridevirtual

Subclasses must implement this function to report the live seekable ranges.

See also
GetLiveSeekableRanges

Implements CYIAbstractVideoPlayer.

◆ GetName_()

virtual CYIString CYIVLCVideoPlayer::GetName_ ( ) const
overridevirtual

Returns the name of the player.

Reimplemented from CYIAbstractVideoPlayer.

◆ GetStatistics_()

virtual Statistics CYIVLCVideoPlayer::GetStatistics_ ( ) const
overridevirtual

Returns the latest statistics from the player.

Reimplemented from CYIAbstractVideoPlayer.

◆ IsMuted_()

virtual bool CYIVLCVideoPlayer::IsMuted_ ( ) const
overridevirtual

Subclasses must implement this function, and return true if and only if the player is muted.

See also
Mute

Implements CYIAbstractVideoPlayer.

◆ Mute_()

virtual void CYIVLCVideoPlayer::Mute_ ( bool  mute)
overridevirtual

Subclasses must implement this function to mute the player when mute is true, and unmute when mute is false.

Implements CYIAbstractVideoPlayer.

◆ Pause_()

virtual void CYIVLCVideoPlayer::Pause_ ( )
overridevirtual

Subclasses must implement this function to pause the video. When the underlying player notifies that playback has paused the player must be transitioned into the CYIAbstractVideoPlayer::PlaybackState::Paused state as follows:

m_pStateManager->TransitionToPlaybackPaused();
See also
Pause

Implements CYIAbstractVideoPlayer.

◆ Play_()

virtual void CYIVLCVideoPlayer::Play_ ( )
overridevirtual

Subclasses must implement this function to play the video. When the underyling player notifies that playback has began the player must be transitioned into the CYIAbstractVideoPlayer::PlaybackState::Playing state as follows:

m_pStateManager->TransitionToPlaybackPlaying();
See also
Play

Implements CYIAbstractVideoPlayer.

◆ Prepare_()

virtual void CYIVLCVideoPlayer::Prepare_ ( const CYIUrl videoURI,
StreamingFormat  format 
)
overridevirtual

◆ Seek_()

virtual void CYIVLCVideoPlayer::Seek_ ( uint64_t  seekPositionMS)
overridevirtual

Subclasses must implement this function to seek the video to a specific seekPositionMS in the video media. When seeking backwards from playback complete, the player must remain paused.

See also
Seek

Implements CYIAbstractVideoPlayer.

◆ SelectAudioTrack_()

virtual bool CYIVLCVideoPlayer::SelectAudioTrack_ ( uint32_t  id)
overridevirtual

Subclasses must implement this function to switch the video player's current audio track to the one referenced by id.

CYIAbstractVideoPlayer::SelectAudioTrack will validate the id prior to this function being called.

See also
GetAudioTracks_
SelectAudioTrack

Implements CYIAbstractVideoPlayer.

◆ SelectClosedCaptionsTrack_()

virtual bool CYIVLCVideoPlayer::SelectClosedCaptionsTrack_ ( uint32_t  id)
overridevirtual

Subclasses must implement this function to switch the video player's current closed captions track to the one referenced by id. Selecting a track must initiate the rendering of the subtitles to screen.

CYIAbstractVideoPlayer::SelectClosedCaptionsTrack will validate the id prior to this function being called. This function will not be called when disabling closed captions, id is guaranteed not to be ClosedCaptionsTrackInfo::OFF_TRACK_ID.

See also
GetClosedCaptionsTracks_
SelectClosedCaptionsTrack

Implements CYIAbstractVideoPlayer.

◆ SetUserAgent_()

virtual void CYIVLCVideoPlayer::SetUserAgent_ ( const CYIString userAgent)
overridevirtual

Subclasses may implement this function to set the user agent.

Reimplemented from CYIAbstractVideoPlayer.

◆ Stop_()

virtual void CYIVLCVideoPlayer::Stop_ ( )
overridevirtual

Subclasses must implement this function to stop the video and clean-up any resources related to the video media as the player will be transitioned into the CYIAbstractVideoPlayer::MediaState::Unloaded after this function executes.

See also
Stop

Implements CYIAbstractVideoPlayer.

◆ SupportsFormat_()

virtual bool CYIVLCVideoPlayer::SupportsFormat_ ( StreamingFormat  format,
DRMScheme  drmScheme 
) const
overridevirtual

Friends And Related Function Documentation

◆ CYIVLCVideoPlayerPriv

friend class CYIVLCVideoPlayerPriv
friend

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