xbmc
IVideoPlayer.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "DVDClock.h"
12 
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 #define VideoPlayer_AUDIO 1
18 #define VideoPlayer_VIDEO 2
19 #define VideoPlayer_SUBTITLE 3
20 #define VideoPlayer_TELETEXT 4
21 #define VideoPlayer_RDS 5
22 #define VideoPlayer_ID3 6
23 
24 class CDVDMsg;
25 class CDVDStreamInfo;
26 class CProcessInfo;
27 
29 {
30 public:
31  virtual int OnDiscNavResult(void* pData, int iMessage) = 0;
32  virtual void GetVideoResolution(unsigned int &width, unsigned int &height) = 0;
33  virtual ~IVideoPlayer() = default;
34 };
35 
37 {
38 public:
39  explicit IDVDStreamPlayer(CProcessInfo& processInfo) : m_processInfo(processInfo) {}
40  virtual ~IDVDStreamPlayer() = default;
41  virtual bool OpenStream(CDVDStreamInfo hint) = 0;
42  virtual void CloseStream(bool bWaitForBuffers) = 0;
43  virtual void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) = 0;
44  virtual void FlushMessages() = 0;
45  virtual bool IsInited() const = 0;
46  virtual bool AcceptsData() const = 0;
47  virtual bool IsStalled() const = 0;
48 
49  enum ESyncState
50  {
51  SYNC_STARTING,
52  SYNC_WAITSYNC,
53  SYNC_INSYNC
54  };
55 protected:
56  CProcessInfo &m_processInfo;
57 };
58 
59 struct SStartMsg
60 {
61  double timestamp;
62  int player;
63  double cachetime;
64  double cachetotal;
65 };
66 
67 struct SStateMsg
68 {
69  IDVDStreamPlayer::ESyncState syncState;
70  int player;
71 };
72 
73 class CDVDVideoCodec;
74 
76 {
77 public:
78  explicit IDVDStreamPlayerVideo(CProcessInfo& processInfo) : IDVDStreamPlayer(processInfo) {}
79  ~IDVDStreamPlayerVideo() override = default;
80  bool OpenStream(CDVDStreamInfo hint) override = 0;
81  void CloseStream(bool bWaitForBuffers) override = 0;
82  virtual void Flush(bool sync) = 0;
83  bool AcceptsData() const override = 0;
84  virtual bool HasData() const = 0;
85  bool IsInited() const override = 0;
86  void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) override = 0;
87  virtual void EnableSubtitle(bool bEnable) = 0;
88  virtual bool IsSubtitleEnabled() = 0;
89  virtual double GetSubtitleDelay() = 0;
90  virtual void SetSubtitleDelay(double delay) = 0;
91  bool IsStalled() const override = 0;
92  virtual bool IsRewindStalled() const { return false; }
93  virtual double GetCurrentPts() = 0;
94  virtual double GetOutputDelay() = 0;
95  virtual std::string GetPlayerInfo() = 0;
96  virtual int GetVideoBitrate() = 0;
97  virtual void SetSpeed(int iSpeed) = 0;
98  virtual bool IsEOS() { return false; }
99 };
100 
101 class CDVDAudioCodec;
103 {
104 public:
105  explicit IDVDStreamPlayerAudio(CProcessInfo& processInfo) : IDVDStreamPlayer(processInfo) {}
106  ~IDVDStreamPlayerAudio() override = default;
107  bool OpenStream(CDVDStreamInfo hints) override = 0;
108  void CloseStream(bool bWaitForBuffers) override = 0;
109  virtual void SetSpeed(int speed) = 0;
110  virtual void Flush(bool sync) = 0;
111  bool AcceptsData() const override = 0;
112  virtual bool HasData() const = 0;
113  virtual int GetLevel() const = 0;
114  bool IsInited() const override = 0;
115  void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) override = 0;
116  virtual void SetVolume(float fVolume) {}
117  virtual void SetMute(bool bOnOff) {}
118  virtual void SetDynamicRangeCompression(long drc) = 0;
119  virtual std::string GetPlayerInfo() = 0;
120  virtual int GetAudioChannels() = 0;
121  virtual double GetCurrentPts() = 0;
122  bool IsStalled() const override = 0;
123  virtual bool IsPassthrough() const = 0;
124  virtual float GetDynamicRangeAmplification() const = 0;
125  virtual bool IsEOS() { return false; }
126 };
Definition: IVideoPlayer.h:28
Definition: DVDStreamInfo.h:23
Definition: IVideoPlayer.h:36
Definition: DVDMessage.h:20
Definition: IVideoPlayer.h:75
Definition: IVideoPlayer.h:67
Definition: IVideoPlayer.h:59
Definition: ProcessInfo.h:26
Definition: DVDAudioCodec.h:48
Definition: IVideoPlayer.h:102
Definition: DVDVideoCodec.h:107