You.i Engine
YiAbstractVideoPlayer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ABSTRACT_VIDEO_PLAYER_H_
3 #define _YI_ABSTRACT_VIDEO_PLAYER_H_
4 
5 #include "network/YiHTTPHeader.h"
6 #include "network/YiUrl.h"
7 #include "signal/YiSignal.h"
8 #include "utility/YiRtti.h"
9 #include "utility/YiTime.h"
10 #include "utility/YiTimer.h"
11 
12 #include <glm/fwd.hpp>
13 
14 #include <limits>
15 
16 class CYIAssetTexture;
17 class CYIAssetVideo;
19 class CYIColor;
20 class CYIMaterial;
22 class CYIVideoSurface;
23 
57 {
59 
60 public:
61  using RTTIInstantiatability = CYIRuntimeTypeInfo::NonInstantiableTag;
62 
68  using VideoMetadata = std::map<CYIString, CYIString>;
69 
76  enum class MediaState
77  {
78  Unloaded,
79  Preparing,
80  Ready
81  };
82 
89  enum class PlaybackState
90  {
91  Playing,
92  Paused,
93  Buffering
94  };
95 
99  struct PlayerState
100  {
103  };
104 
110  enum class StreamingFormat
111  {
112  HLS = 0,
113  Smooth,
114  DASH,
115  MP4
116  };
117 
123  enum class DRMScheme
124  {
125  None = 0,
126  FairPlay,
127  PlayReady,
128  WidevineModular,
129  WidevineModularCustomRequest
130  };
131 
140  {
141  public:
142  virtual ~DRMConfiguration() = default;
143 
147  virtual DRMScheme GetScheme() const = 0;
148  };
149 
155  enum class ErrorCode
156  {
157  PlaybackError,
158  UnsupportedFormat,
159  StateTransitionError,
160  DRMError,
161  InitializationError,
163  Unknown
164  };
165 
169  struct Error
170  {
172  : errorCode(ErrorCode::Unknown)
173  {
174  }
175 
179  };
180 
184  struct TrackInfo
185  {
186  uint32_t id;
190  TrackInfo(uint32_t id)
191  : id(id)
192  {
193  }
194  TrackInfo(uint32_t id, const CYIString &name)
195  : id(id)
196  , name(name)
197  {
198  }
199  TrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
200  : id(id)
201  , name(name)
202  , language(language)
203  {
204  }
205  };
206 
210  struct AudioTrackInfo : public TrackInfo
211  {
212  static uint32_t DEFAULT_TRACK_ID;
214  : TrackInfo(DEFAULT_TRACK_ID)
215  , isValid(false)
216  {
217  }
218  AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
219  : TrackInfo(id, name, language)
220  , isValid(true)
221  {
222  }
223  AudioTrackInfo(const TrackInfo &trackInfo)
224  : TrackInfo(trackInfo)
225  , isValid(true)
226  {
227  }
228  bool isValid;
229  };
230 
235  {
236  static uint32_t OFF_TRACK_ID;
238  : TrackInfo(OFF_TRACK_ID)
239  {
240  }
241  ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
242  : TrackInfo(id, name, language)
243  {
244  }
246  : TrackInfo(trackInfo)
247  {
248  }
249  };
250 
257  {
258  public:
259  virtual ~BackgroundPlaybackInterface() = default;
260 
264  virtual bool IsBackgroundPlaybackEnabled() const = 0;
265 
269  virtual void EnableBackgroundPlayback(bool enabled) = 0;
270 
275  virtual void SetMetadata(const CYIString &title, const CYIString &text, const CYIUrl &imageUri) = 0;
276 
280  virtual void SetRewindIncrementMs(std::chrono::milliseconds increment) = 0;
284  virtual void SetFastForwardIncrementMs(std::chrono::milliseconds increment) = 0;
285 
289  virtual void SetNotificationColor(const CYIColor &color) = 0;
290  };
291 
298  {
299  public:
300  virtual ~HeadphoneJackInterface() = default;
301 
305  virtual void EnablePauseOnHeadphonesUnplugged(bool enabled) = 0;
306 
310  virtual bool IsPausingOnHeadphonesUnplugged() const = 0;
311  };
312 
321  {
322  public:
323  virtual ~VideoRequestHTTPHeadersInterface() = default;
324 
328  virtual std::vector<CYIHTTPHeader> SetHeaders(const std::vector<CYIHTTPHeader> &customHeaders) = 0;
329 
333  virtual bool AddHeader(const CYIHTTPHeader &header) = 0;
334 
338  virtual bool RemoveHeader(const CYIString &name) = 0;
339 
343  virtual void ClearHeaders() = 0;
344 
348  virtual std::vector<CYIHTTPHeader> GetHeaders() const = 0;
349  };
350 
355  {
359  std::chrono::milliseconds min;
360 
364  std::chrono::milliseconds max;
365 
366  BufferLength(std::chrono::milliseconds minIn, std::chrono::milliseconds maxIn)
367  : min(minIn)
368  , max(maxIn)
369  {
370  }
371 
376  : min(0)
377  , max(0)
378  {
379  }
380  };
381 
392  {
393  public:
394  virtual ~BufferingInterface() = default;
395 
399  virtual void SetBufferLength(const BufferLength &bufferLength) = 0;
400 
404  virtual BufferLength GetBufferLength() const = 0;
405  };
406 
413  {
414  // ID3 Related Keys
419 
420  // DASH Event Message Related Keys
450  static const CYIString EventMessageId;
455  };
456 
461  {
465  TimedMetadata();
466 
469  std::chrono::microseconds timestamp;
470  std::chrono::microseconds duration;
471  std::map<CYIString, CYIString> additionalData;
472  };
473 
480  {
481  public:
482  virtual ~TimedMetadataInterface() = default;
483 
490  };
491 
498  {
499  public:
507  {
508  public:
509  virtual ~ControlsHandler() = default;
510 
514  virtual void OnPlay(CYIAbstractVideoPlayer *pPlayer);
515 
519  virtual void OnPause(CYIAbstractVideoPlayer *pPlayer);
520 
524  virtual void OnSeek(CYIAbstractVideoPlayer *pPlayer, uint64_t positionMs);
525 
529  virtual void OnStop(CYIAbstractVideoPlayer *pPlayer);
530 
534  virtual void OnClosedCaptionsEnabled(CYIAbstractVideoPlayer *pPlayer, bool enabled);
535  };
536 
537  virtual ~MediaPlaybackControlsInterface() = default;
538 
546  virtual void EnableMediaPlaybackControl(bool enabled) = 0;
547 
551  virtual bool IsMediaPlaybackControlEnabled() const = 0;
552 
558  virtual void SetControlsHandler(ControlsHandler *pControlsHandler) = 0;
559  };
560 
561  virtual ~CYIAbstractVideoPlayer();
562 
566  CYIString GetName() const;
567 
574  CYIString GetVersion() const;
575 
581  struct Statistics
582  {
588  Statistics();
589 
590  bool operator==(const Statistics &other) const;
591  bool operator!=(const Statistics &other) const;
592 
596  bool isLive;
597 
604 
611 
618 
625 
632 
639 
646 
653 
660 
667  };
668 
672  Statistics GetStatistics() const;
673 
679  void Init();
680 
694  void Prepare(const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState = CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr<DRMConfiguration> pDRMConfiguration = nullptr, uint64_t startTimeMs = 0);
695 
701  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);
702 
708  void Play();
709 
715  void Pause();
716 
720  void Stop();
721 
729  {
733  SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
734  : startTimeMs(startTimeMs)
735  , endTimeMs(endTimeMs)
736  {
737  }
738 
742  uint64_t startTimeMs;
743 
747  uint64_t endTimeMs;
748  };
749 
757  std::vector<SeekableRange> GetLiveSeekableRanges() const;
758 
764  void Seek(uint64_t seekPositionMs);
765 
769  bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None);
770 
774  uint64_t GetDurationMs() const;
775 
779  uint64_t GetCurrentTimeMs() const;
780 
787 
793  void SetClosedCaptionsEnabled(bool enabled);
794 
803 
816  bool SelectClosedCaptionsTrack(uint32_t id);
817 
828  std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks() const;
829 
838 
839  /*
840  \details Returns the closed captions dispatcher for the player.
841 
842  This will return null if the player implementation does not provide control over closed captions rendering.
843  */
845 
849  CYIVideoSurface *GetSurface() const;
850 
856  bool AreAudioTracksAvailable() const;
857 
867  bool SelectAudioTrack(uint32_t id);
868 
879  std::vector<AudioTrackInfo> GetAudioTracks() const;
880 
889 
893  bool IsMuted() const;
894 
898  void Mute(bool mute);
899 
909  void SetMaxBitrate(uint64_t maxBitrate);
910 
922  void SetUserAgent(const CYIString &userAgent);
923 
924  /*
925  \details Sets the video player metadata.
926  */
928 
936  const DRMConfiguration *GetDRMConfiguration() const;
937 
946 
951 
956 
961 
966 
971 
976 
980  using RefreshDRMConfigurationCallback = std::function<std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>(std::unique_ptr<CYIAbstractVideoPlayer::DRMConfiguration>)>;
982 
989 
996 
1003 
1008 
1013 
1018 
1023 
1029 
1035 
1041 
1047 
1052 
1057 
1062 
1067 
1072 
1077 
1082 
1083 protected:
1085 
1089  const std::shared_ptr<CYIMaterial> &GetVideoMaterial() const;
1090 
1094  void SetVideoSurfaceSize(const glm::ivec2 &size);
1095 
1100 
1105 
1110 
1114  void UpdateCurrentTime();
1115 
1120 
1126 
1132 
1138 
1145 
1151  std::unique_ptr<CYIVideoPlayerStateManager> m_pStateManager;
1152 
1159  std::unique_ptr<CYIClosedCaptionsDispatcher> m_pClosedCaptionsDispatcher;
1160 
1167  std::unique_ptr<DRMConfiguration> m_pDRMConfiguration;
1168 
1172  uint64_t m_maxBitrate;
1173 
1180 
1185 
1186 private:
1187  struct SeekState
1188  {
1189  enum class Direction
1190  {
1191  Forward,
1192  Reverse
1193  };
1194 
1195  bool active;
1196  Direction direction;
1197  uint64_t requestedPositionMs;
1198  uint64_t positionBeforeSeekMs;
1199  };
1200 
1201  class TimeUpdater : public CYITime::UpdateListener
1202  {
1203  public:
1204  TimeUpdater();
1205  void SetPlayer(CYIAbstractVideoPlayer *pPlayer);
1206  virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override;
1207 
1208  private:
1209  CYIAbstractVideoPlayer *m_pPlayer;
1210  uint64_t m_lastUpdateUs;
1211  };
1212  friend class TimeUpdater;
1213 
1214 #if defined(DOXY)
1215  // We want to document this private section because users override these methods called by the abstract player.
1216 protected:
1217 #endif
1218 
1222  virtual CYIString GetName_() const;
1223 
1229  virtual CYIString GetVersion_() const;
1230 
1234  virtual Statistics GetStatistics_() const;
1235 
1236  /*
1237  \details Subclasses can extend this function to do additional work outside of the constructor for initializing the player.
1238 
1239  \sa #Init
1240  */
1241  virtual void Init_();
1242 
1243  /*
1244  \details Subclasses must implement this function to create the correct CYIVideoSurface instance for the CYIAbstractVideoPlayer implementation.
1245 
1246  \note The surface will be stored in m_pVideoSurface and will be cleaned up automatically.
1247  */
1248  virtual std::unique_ptr<CYIVideoSurface> CreateSurface_() = 0;
1249 
1255  virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme = DRMScheme::None) const = 0;
1256 
1262  virtual bool HasNativeStartTimeHandling_() const;
1263 
1269  virtual bool HasNativeBitrateEventHandling_() const;
1270 
1279  virtual bool HasNativeSeekEventHandling_() const;
1280 
1302  virtual void Prepare_(const CYIUrl &videoURI, StreamingFormat format) = 0;
1303 
1313  virtual void Play_() = 0;
1314 
1324  virtual void Pause_() = 0;
1325 
1331  virtual void Stop_() = 0;
1332 
1338  virtual uint64_t GetDurationMs_() const = 0;
1339 
1345  virtual uint64_t GetCurrentTimeMs_() const = 0;
1346 
1352  virtual std::vector<SeekableRange> GetLiveSeekableRanges_() const = 0;
1353 
1359  virtual void Seek_(uint64_t seekPositionMS) = 0;
1360 
1369  virtual bool SelectAudioTrack_(uint32_t id) = 0;
1370 
1378  virtual std::vector<AudioTrackInfo> GetAudioTracks_() const = 0;
1379 
1389 
1395  virtual bool IsMuted_() const = 0;
1396 
1400  virtual void Mute_(bool mute) = 0;
1401 
1405  virtual void DisableClosedCaptions_() = 0;
1406 
1415  virtual bool SelectClosedCaptionsTrack_(uint32_t id) = 0;
1416 
1424  virtual std::vector<ClosedCaptionsTrackInfo> GetClosedCaptionsTracks_() const = 0;
1425 
1435 
1443  virtual void GetClosedCaptionsDispatcher_() const;
1444 
1448  virtual void SetMaxBitrate_(uint64_t maxBitrate);
1449 
1453  virtual void SetUserAgent_(const CYIString &userAgent);
1454 
1458  virtual void SetVideoMetadata_(const CYIAbstractVideoPlayer::VideoMetadata &metadata);
1459 
1464 
1469 
1473  virtual BufferingInterface *GetBufferingInterface_() const;
1474 
1479 
1484 
1489 
1490 #if defined(DOXY)
1491 private:
1492 #endif
1493 
1494  void CheckAndNotifyAudioTracksChanged();
1495  void CheckAndNotifyClosedCaptionsTracksChanged();
1496  void CheckAndNotifyBitrateChanged();
1497  void OnNotifyErrorOccurred(Error error);
1498  void OnNotifyPlaybackComplete();
1499  void OnNotifyDurationChanged(uint64_t duration);
1500  void UpdateSeekState(uint64_t positionBeforeSeekMs, uint64_t requestedPositionMs);
1501  void OnNotifySeekCompleted(bool success, uint64_t positionAfterSeekMs);
1502  void ClearCachedTrackData();
1503  void OnStateReady();
1504  void OnStateUnloaded();
1505  void ClearClosedCaptions();
1506  void SetTimeUpdatesEnabled(bool enabled);
1507 
1508  bool m_audioTracksAvailable;
1509  std::vector<AudioTrackInfo> m_audioTracksCache;
1510 
1511  float m_cachedTotalBitrate;
1512  float m_cachedVideoBitrate;
1513  float m_cachedAudioBitrate;
1514 
1515  std::unique_ptr<CYIVideoSurface> m_pVideoSurface;
1516  uint64_t m_lastNotifiedTime;
1517  TimeUpdater m_timeUpdater;
1518  PlaybackState m_initialPlaybackState;
1519  PlaybackState m_requestedInitialPlaybackState;
1520  CYITimer m_mediaTracksRefreshTimer;
1521  CYITimer m_bitrateRefreshTimer;
1522  bool m_isMuted;
1523  SeekState m_seekState;
1524 
1525  bool m_closedCaptionsTracksAvailable;
1526  std::vector<ClosedCaptionsTrackInfo> m_closedCaptionsTracksCache;
1527  uint32_t m_previousClosedCaptionsTrackId;
1528  static const ClosedCaptionsTrackInfo CLOSED_CAPTIONS_OFF_TRACK;
1529 
1532 };
1533 
1538 // Audio tracks
1541 
1542 // Closed captions tracks
1543 bool operator==(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1544 bool operator!=(const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackL, const CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo &closedCaptionsTrackR);
1545 
1546 // Timed Metadata
1547 bool operator==(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1548 bool operator!=(const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataL, const CYIAbstractVideoPlayer::TimedMetadata &timedMetadataR);
1549 
1550 //States
1551 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1552 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1553 bool operator==(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1554 bool operator==(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1555 bool operator==(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1556 
1557 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerStateL, const CYIAbstractVideoPlayer::PlayerState &playerStateR);
1558 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::MediaState &mediaState);
1559 bool operator!=(const CYIAbstractVideoPlayer::MediaState &mediaState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1560 bool operator!=(const CYIAbstractVideoPlayer::PlayerState &playerState, const CYIAbstractVideoPlayer::PlaybackState &playbackState);
1561 bool operator!=(const CYIAbstractVideoPlayer::PlaybackState &playbackState, const CYIAbstractVideoPlayer::PlayerState &playerState);
1562 
1563 #endif //ifndef _YI_ABSTRACT_VIDEO_PLAYER_H_
virtual uint64_t GetDurationMs_() const =0
TrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:199
virtual void SetMaxBitrate_(uint64_t maxBitrate)
std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks() const
static const CYIString ID3PrivateFrameOwner
Definition: YiAbstractVideoPlayer.h:418
virtual void SetUserAgent_(const CYIString &userAgent)
CYISignal PlaybackComplete
Definition: YiAbstractVideoPlayer.h:1028
bool AreClosedCaptionsTracksAvailable() const
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
BackgroundPlaybackInterface * GetBackgroundPlaybackInterface() const
CYIRuntimeTypeInfo::NonInstantiableTag RTTIInstantiatability
Definition: YiAbstractVideoPlayer.h:61
void SetVideoMetadata(const CYIAbstractVideoPlayer::VideoMetadata &metadata)
CYIVideoSurface * GetSurface() const
Definition: YiAbstractVideoPlayer.h:210
CYISignal< float > AudioBitrateChanged
Definition: YiAbstractVideoPlayer.h:1081
float renderedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:659
Definition: YiAbstractVideoPlayer.h:391
Definition: YiAbstractVideoPlayer.h:354
std::map< CYIString, CYIString > additionalData
Definition: YiAbstractVideoPlayer.h:471
std::unique_ptr< DRMConfiguration > m_pDRMConfiguration
Definition: YiAbstractVideoPlayer.h:1167
void SetClosedCaptionsEnabled(bool enabled)
virtual bool IsMuted_() const =0
HeadphoneJackInterface * GetHeadphoneJackInterface() const
Definition: YiAbstractVideoPlayer.h:184
Statistics GetStatistics() const
void ChangeInitialPlaybackState(CYIAbstractVideoPlayer::PlaybackState initialState)
virtual VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface_()
virtual std::vector< SeekableRange > GetLiveSeekableRanges_() const =0
ClosedCaptionsTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:241
CYISignal< std::vector< ClosedCaptionsTrackInfo > > AvailableClosedCaptionsTracksChanged
Definition: YiAbstractVideoPlayer.h:1066
BufferingInterface * GetBufferingInterface() const
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
CYISignal BufferingEnded
Definition: YiAbstractVideoPlayer.h:995
float bufferLengthMs
Definition: YiAbstractVideoPlayer.h:645
CYISignal< Error > ErrorOccurred
Definition: YiAbstractVideoPlayer.h:1002
bool SupportsFormat(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None)
AudioTrackInfo(uint32_t id, const CYIString &name, const CYIString &language)
Definition: YiAbstractVideoPlayer.h:218
virtual std::unique_ptr< CYIVideoSurface > CreateSurface_()=0
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:22
std::function< std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >(std::unique_ptr< CYIAbstractVideoPlayer::DRMConfiguration >)> RefreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:980
static const CYIString EventMessagePTSDelta
Definition: YiAbstractVideoPlayer.h:440
CYISignal Preparing
Definition: YiAbstractVideoPlayer.h:1007
CYISignal< const CYIAbstractVideoPlayer::PlayerState & > PlayerStateChanged
Definition: YiAbstractVideoPlayer.h:1056
bool operator!=(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
uint64_t startTimeMs
Definition: YiAbstractVideoPlayer.h:742
Definition: YiAbstractVideoPlayer.h:320
ClosedCaptionsTrackInfo()
Definition: YiAbstractVideoPlayer.h:237
CYIString value
Definition: YiAbstractVideoPlayer.h:468
const std::shared_ptr< CYIMaterial > & GetVideoMaterial() const
static const CYIString EventMessageValue
Definition: YiAbstractVideoPlayer.h:430
TrackInfo(uint32_t id)
Definition: YiAbstractVideoPlayer.h:190
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:26
ClosedCaptionsTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:245
CYISignal Finalized
Definition: YiAbstractVideoPlayer.h:1034
bool SelectClosedCaptionsTrack(uint32_t id)
CYISignal Ready
Definition: YiAbstractVideoPlayer.h:1012
static const CYIString EventMessageMessageData
Definition: YiAbstractVideoPlayer.h:454
virtual CYIAbstractVideoPlayer::ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack_() const =0
std::chrono::milliseconds min
Definition: YiAbstractVideoPlayer.h:359
virtual bool SelectClosedCaptionsTrack_(uint32_t id)=0
AudioTrackInfo(const TrackInfo &trackInfo)
Definition: YiAbstractVideoPlayer.h:223
float defaultAudioBitrateKbps
Definition: YiAbstractVideoPlayer.h:638
TrackInfo(uint32_t id, const CYIString &name)
Definition: YiAbstractVideoPlayer.h:194
Definition: YiAbstractVideoPlayer.h:297
CYISignal< float > TotalBitrateChanged
Definition: YiAbstractVideoPlayer.h:1071
virtual BufferingInterface * GetBufferingInterface_() const
CYISignal< bool, uint64_t > NotifySeekCompleted
Definition: YiAbstractVideoPlayer.h:1144
static const CYIString EventMessageDuration
Definition: YiAbstractVideoPlayer.h:446
static uint32_t DEFAULT_TRACK_ID
Definition: YiAbstractVideoPlayer.h:212
MediaState mediaState
Definition: YiAbstractVideoPlayer.h:101
void SetRefreshDRMConfigurationCallback(RefreshDRMConfigurationCallback callback)
A class which manages the various media and playback states of the CYIAbstractVideoPlayer.
Definition: YiVideoPlayerStateManager.h:44
AudioTrackInfo GetActiveAudioTrack() const
constexpr std::enable_if< YiEnableBitmaskOperators< E >::enable, bool >::type None(E a)
Definition: YiEnumBitmaskOperators.h:136
CYISignal< float > VideoBitrateChanged
Definition: YiAbstractVideoPlayer.h:1076
std::map< CYIString, CYIString > VideoMetadata
Definition: YiAbstractVideoPlayer.h:68
virtual ~CYIAbstractVideoPlayer()
CYISignal BufferingStarted
Definition: YiAbstractVideoPlayer.h:988
Definition: YiAbstractVideoPlayer.h:412
virtual void Stop_()=0
virtual CYIString GetVersion_() const
uint64_t GetCurrentTimeMs() const
A class respresenting an HTTP Header Field with a field-name and field-value as specified in https://...
Definition: YiHTTPHeader.h:17
An abstract video player that provides a basic interface that all subclasses must implement...
Definition: YiAbstractVideoPlayer.h:56
CYISignal< uint64_t > CurrentTimeUpdated
Definition: YiAbstractVideoPlayer.h:1040
ErrorCode errorCode
Definition: YiAbstractVideoPlayer.h:176
Definition: YiAbstractVideoPlayer.h:99
CYISignal Paused
Definition: YiAbstractVideoPlayer.h:1022
bool isValid
Definition: YiAbstractVideoPlayer.h:228
virtual Statistics GetStatistics_() const
uint64_t endTimeMs
Definition: YiAbstractVideoPlayer.h:747
static const CYIString EventMessageSchemeId
Definition: YiAbstractVideoPlayer.h:424
RefreshDRMConfigurationCallback m_refreshDRMConfigurationCallback
Definition: YiAbstractVideoPlayer.h:1184
Definition: YiAbstractVideoPlayer.h:460
CYIAbstractVideoPlayer::PlaybackState GetRequestedInitialPlaybackState() const
Definition: YiAbstractVideoPlayer.h:169
Definition: YiTime.h:28
virtual bool HasNativeBitrateEventHandling_() const
uint32_t id
Definition: YiAbstractVideoPlayer.h:186
A low-precision timer driven by the update loop.
Definition: YiTimer.h:27
virtual BackgroundPlaybackInterface * GetBackgroundPlaybackInterface_() const
bool AreAudioTracksAvailable() const
virtual bool SelectAudioTrack_(uint32_t id)=0
virtual TimedMetadataInterface * GetTimedMetadataInterface_() const
float minimumBufferLengthMs
Definition: YiAbstractVideoPlayer.h:652
CYISignal NotifyPlaybackComplete
Definition: YiAbstractVideoPlayer.h:1131
virtual void Pause_()=0
PlaybackState
Definition: YiAbstractVideoPlayer.h:89
virtual std::vector< AudioTrackInfo > GetAudioTracks_() const =0
CYIString nativePlayerErrorCode
Definition: YiAbstractVideoPlayer.h:178
uint64_t m_initialStartTimeMs
Definition: YiAbstractVideoPlayer.h:1179
void Mute(bool mute)
CYISignal< uint64_t > DurationChanged
Definition: YiAbstractVideoPlayer.h:1046
virtual void Seek_(uint64_t seekPositionMS)=0
float totalBitrateKbps
Definition: YiAbstractVideoPlayer.h:603
bool SelectAudioTrack(uint32_t id)
SeekableRange(uint64_t startTimeMs, uint64_t endTimeMs)
Definition: YiAbstractVideoPlayer.h:733
PlaybackState playbackState
Definition: YiAbstractVideoPlayer.h:102
CYIAbstractVideoPlayer::PlayerState GetPlayerState() const
bool isLive
Definition: YiAbstractVideoPlayer.h:596
The base class for all DRM configurations.
Definition: YiAbstractVideoPlayer.h:139
float defaultTotalBitrateKbps
Definition: YiAbstractVideoPlayer.h:624
std::chrono::milliseconds max
Definition: YiAbstractVideoPlayer.h:364
Definition: YiAbstractVideoPlayer.h:256
uint64_t m_maxBitrate
Definition: YiAbstractVideoPlayer.h:1172
CYIClosedCaptionsDispatcher * GetClosedCaptionsDispatcher() const
A class used to encapsulate an URL.
Definition: YiUrl.h:24
virtual void DisableClosedCaptions_()=0
virtual void GetClosedCaptionsDispatcher_() const
virtual void SetVideoMetadata_(const CYIAbstractVideoPlayer::VideoMetadata &metadata)
std::chrono::microseconds timestamp
Definition: YiAbstractVideoPlayer.h:469
CYISignal Playing
Definition: YiAbstractVideoPlayer.h:1017
std::unique_ptr< CYIVideoPlayerStateManager > m_pStateManager
Definition: YiAbstractVideoPlayer.h:1151
float audioBitrateKbps
Definition: YiAbstractVideoPlayer.h:617
Definition: YiSignalHandler.h:175
static uint32_t OFF_TRACK_ID
Definition: YiAbstractVideoPlayer.h:236
CYIString message
Definition: YiAbstractVideoPlayer.h:177
std::vector< AudioTrackInfo > GetAudioTracks() const
CYISignal< bool, uint64_t > SeekCompleted
Definition: YiAbstractVideoPlayer.h:1051
bool operator==(const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackL, const CYIAbstractVideoPlayer::AudioTrackInfo &audioTrackR)
void SetUserAgent(const CYIString &userAgent)
CYIString GetName() const
CYIString name
Definition: YiAbstractVideoPlayer.h:187
ErrorCode
Definition: YiAbstractVideoPlayer.h:155
Definition: YiAbstractVideoPlayer.h:479
static const CYIString EventMessageTimescale
Definition: YiAbstractVideoPlayer.h:434
StreamingFormat
Definition: YiAbstractVideoPlayer.h:110
Dispatches closed captioning cues to registered captions renderers.
Definition: YiClosedCaptionsDispatcher.h:27
virtual CYIAbstractVideoPlayer::AudioTrackInfo GetActiveAudioTrack_() const =0
BufferLength(std::chrono::milliseconds minIn, std::chrono::milliseconds maxIn)
Definition: YiAbstractVideoPlayer.h:366
Definition: YiAbstractVideoPlayer.h:581
friend class TimeUpdater
Definition: YiAbstractVideoPlayer.h:1212
void CheckAndNotifyMediaTracksChanged()
MediaState
Definition: YiAbstractVideoPlayer.h:76
void Prepare(const CYIUrl &videoURI, StreamingFormat formatHint, CYIAbstractVideoPlayer::PlaybackState initialState=CYIAbstractVideoPlayer::PlaybackState::Paused, std::unique_ptr< DRMConfiguration > pDRMConfiguration=nullptr, uint64_t startTimeMs=0)
BufferLength()
Definition: YiAbstractVideoPlayer.h:375
void SetMaxBitrate(uint64_t maxBitrate)
const DRMConfiguration * GetDRMConfiguration() const
std::unique_ptr< CYIClosedCaptionsDispatcher > m_pClosedCaptionsDispatcher
Definition: YiAbstractVideoPlayer.h:1159
uint64_t GetDurationMs() const
static const CYIString EventMessageId
Definition: YiAbstractVideoPlayer.h:450
CYISignal< uint64_t > NotifyDurationChanged
Definition: YiAbstractVideoPlayer.h:1137
TimedMetadataInterface * GetTimedMetadataInterface() const
void SetVideoSurfaceSize(const glm::ivec2 &size)
void Seek(uint64_t seekPositionMs)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
float videoBitrateKbps
Definition: YiAbstractVideoPlayer.h:610
Definition: YiAbstractVideoPlayer.h:497
float encodedFramesPerSecond
Definition: YiAbstractVideoPlayer.h:666
float defaultVideoBitrateKbps
Definition: YiAbstractVideoPlayer.h:631
CYISignal< std::vector< AudioTrackInfo > > AvailableAudioTracksChanged
Definition: YiAbstractVideoPlayer.h:1061
virtual CYIString GetName_() const
AudioTrackInfo()
Definition: YiAbstractVideoPlayer.h:213
virtual void Init_()
CYIString identifier
Definition: YiAbstractVideoPlayer.h:467
std::chrono::microseconds duration
Definition: YiAbstractVideoPlayer.h:470
virtual void Prepare_(const CYIUrl &videoURI, StreamingFormat format)=0
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
A class used to represent a color value.
Definition: YiColor.h:31
CYISignal< TimedMetadata > MetadataAvailable
Definition: YiAbstractVideoPlayer.h:489
ClosedCaptionsTrackInfo GetActiveClosedCaptionsTrack() const
CYIString language
Definition: YiAbstractVideoPlayer.h:188
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:168
std::vector< SeekableRange > GetLiveSeekableRanges() const
virtual void Mute_(bool mute)=0
Asset representing a video.
Definition: YiAssetVideo.h:20
virtual MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface_() const
DRMScheme
Definition: YiAbstractVideoPlayer.h:123
virtual bool HasNativeStartTimeHandling_() const
virtual bool HasNativeSeekEventHandling_() const
virtual std::vector< ClosedCaptionsTrackInfo > GetClosedCaptionsTracks_() const =0
CYISignal< Error > NotifyErrorOccurred
Definition: YiAbstractVideoPlayer.h:1125
Representation of a CYIAbstractVideoPlayer&#39;s video surface.
Definition: YiVideoSurface.h:34
virtual void Play_()=0
MediaPlaybackControlsInterface * GetMediaPlaybackControlsInterface() const
CYIString GetVersion() const
Definition: YiAbstractVideoPlayer.h:234
virtual HeadphoneJackInterface * GetHeadphoneJackInterface_() const
Error()
Definition: YiAbstractVideoPlayer.h:171
virtual uint64_t GetCurrentTimeMs_() const =0
Definition: YiAbstractVideoPlayer.h:728
virtual bool SupportsFormat_(StreamingFormat streamingFormat, DRMScheme drmScheme=DRMScheme::None) const =0
VideoRequestHTTPHeadersInterface * GetVideoRequestHTTPHeadersInterface()