MythTV  master
mythbdbuffer.h
Go to the documentation of this file.
1 #ifndef BD_RING_BUFFER_H_
2 #define BD_RING_BUFFER_H_
3 
4 // Qt
5 #include <QString>
6 #include <QRect>
7 #include <QHash>
8 #include <QCoreApplication>
9 
10 // MythTV
13 
14 static constexpr int32_t BD_BLOCK_SIZE { 6144 };
15 
20 {
21  Q_DECLARE_TR_FUNCTIONS(MythBDBuffer)
22 
23  public:
24  explicit MythBDBuffer(const QString &Filename);
25  ~MythBDBuffer() override;
26 
27  bool GetNameAndSerialNum(QString& Name, QString& SerialNum) override;
28  void IgnoreWaitStates (bool Ignore) override;
29  bool StartFromBeginning (void) override;
30  long long GetReadPosition (void) const override;
31  bool IsOpen (void) const override;
32  bool IsInStillFrame (void) const override;
33  bool HandleAction (const QStringList &Actions, mpeg::chrono::pts Pts) override;
34  bool OpenFile (const QString &Filename,
35  std::chrono::milliseconds Retry = kDefaultOpenTimeout) override;
36 
37  void ProgressUpdate (void);
38  bool BDWaitingForPlayer (void) const;
39  void SkipBDWaitingForPlayer(void);
40 
41  bool GetBDStateSnapshot (QString& State);
42  bool RestoreBDStateSnapshot(const QString &State);
43  void ClearOverlays (void);
44  MythBDOverlay* GetOverlay (void);
45  void SubmitOverlay (const bd_overlay_s* Overlay);
46  void SubmitARGBOverlay (const bd_argb_overlay_s* Overlay);
47  uint32_t GetNumTitles (void) const;
48  int GetCurrentTitle (void);
49  uint64_t GetCurrentAngle (void) const;
50  std::chrono::seconds GetTitleDuration (int Title);
51  uint64_t GetTitleSize (void) const;
52  std::chrono::seconds GetTotalTimeOfTitle(void) const;
53  std::chrono::seconds GetCurrentTime (void) const;
54  uint64_t GetTotalReadPosition(void);
55  uint32_t GetNumChapters (void);
56  uint32_t GetCurrentChapter (void);
57  uint64_t GetNumAngles (void) const;
58  std::chrono::milliseconds GetChapterStartTimeMs(uint32_t Chapter);
59  std::chrono::seconds GetChapterStartTime (uint32_t Chapter);
60  uint64_t GetChapterStartFrame (uint32_t Chapter);
61  bool IsHDMVNavigation (void) const;
62  bool TitleChanged (void);
63  bool IsValidStream (uint StreamId);
64  void UnblockReading (void);
65  bool IsReadingBlocked (void);
66  int64_t AdjustTimestamp (int64_t Timestamp) const;
67  void GetDescForPos (QString &Desc);
68  double GetFrameRate (void);
69  int GetAudioLanguage (uint StreamID);
70  int GetSubtitleLanguage(uint StreamID);
71  void Close (void);
72  bool GoToMenu (const QString &Menu, mpeg::chrono::pts Pts);
73  bool SwitchTitle (uint32_t Index);
74  bool SwitchPlaylist (uint32_t Index);
75  bool SwitchAngle (uint Angle);
76 
77  protected:
78  int SafeRead (void *Buffer, uint Size) override;
79  long long SeekInternal (long long Position, int Whence) override;
80  uint64_t SeekInternal (uint64_t Position);
81 
82  private:
83  void WaitForPlayer (void);
84  bool UpdateTitleInfo (void);
85  BLURAY_TITLE_INFO* GetTitleInfo (uint32_t Index);
86  BLURAY_TITLE_INFO* GetPlaylistInfo(uint32_t Index);
87  void PressButton (int32_t Key, mpeg::chrono::pts Pts);
88  void ClickButton (int64_t Pts, uint16_t X, uint16_t Y);
89  bool HandleBDEvents (void);
90  void HandleBDEvent (BD_EVENT &Event);
91 
92  static const BLURAY_STREAM_INFO* FindStream(uint StreamID,
93  BLURAY_STREAM_INFO* Streams,
94  int StreamCount);
95 
96  BLURAY *m_bdnav { nullptr };
97  bool m_isHDMVNavigation { false };
98  bool m_tryHDMVNavigation { false };
99  bool m_topMenuSupported { false };
100  bool m_firstPlaySupported { false };
101  uint32_t m_numTitles { 0 };
102  uint32_t m_mainTitle { 0 };
103  mpeg::chrono::pts m_currentTitleLength { 0_pts };
104  BLURAY_TITLE_INFO *m_currentTitleInfo { nullptr };
105  uint64_t m_titlesize { 0 };
106  uint64_t m_currentTitleAngleCount { 0 };
107  mpeg::chrono::pts m_currentTime { 0_pts };
108  int m_imgHandle { -1 };
109  int m_currentTitle { -1 };
110  int m_currentPlaylist { 0 };
111  int m_currentPlayitem { 0 };
112  int m_currentChapter { 0 };
113  int m_currentAudioStream { 0 };
114  int m_currentIGStream { 0 };
115  int m_currentPGTextSTStream { 0 };
116  int m_currentSecondaryAudioStream { 0 };
117  int m_currentSecondaryVideoStream { 0 };
118  bool m_pgTextSTEnabled { false };
119  bool m_secondaryAudioEnabled { false };
120  bool m_secondaryVideoEnabled { false };
121  bool m_secondaryVideoIsFullscreen { false };
122  bool m_titleChanged { false };
123  bool m_playerWait { false };
124  bool m_ignorePlayerWait { true };
126  QList<MythBDOverlay*> m_overlayImages;
127  QVector<MythBDOverlay*> m_overlayPlanes;
128  std::chrono::seconds m_stillTime { 0 };
129  int m_stillMode { BLURAY_STILL_NONE};
130  BD_EVENT m_lastEvent { BD_EVENT_NONE, 0};
131  QByteArray m_pendingData;
132  int64_t m_timeDiff { 0 };
133  QHash<uint32_t,BLURAY_TITLE_INFO*> m_cachedTitleInfo;
134  QHash<uint32_t,BLURAY_TITLE_INFO*> m_cachedPlaylistInfo;
135  QRecursiveMutex m_infoLock;
136  QThread *m_mainThread { nullptr };
137 };
138 #endif
BD_BLOCK_SIZE
static constexpr int32_t BD_BLOCK_SIZE
Definition: mythbdbuffer.h:14
MythMediaBuffer::SafeRead
virtual int SafeRead(void *Buffer, uint Size)=0
MythBDBuffer::m_cachedTitleInfo
QHash< uint32_t, BLURAY_TITLE_INFO * > m_cachedTitleInfo
Definition: mythbdbuffer.h:133
mythopticalbuffer.h
MythBDOverlay
Definition: mythbdoverlay.h:16
MythMediaBuffer::IgnoreWaitStates
virtual void IgnoreWaitStates(bool)
Definition: mythmediabuffer.h:130
MythMediaBuffer::HandleAction
virtual bool HandleAction(const QStringList &, mpeg::chrono::pts)
Definition: mythmediabuffer.h:134
MythOpticalBuffer::GetNameAndSerialNum
virtual bool GetNameAndSerialNum(QString &Name, QString &SerialNumber)=0
MythMediaBuffer::StartFromBeginning
virtual bool StartFromBeginning(void)
Definition: mythmediabuffer.h:129
StreamID
Contains listing of PMT Stream ID's for various A/V Stream types.
Definition: mpegtables.h:109
MythMediaBuffer::SeekInternal
virtual long long SeekInternal(long long Position, int Whence)=0
Event
Event details.
Definition: zmdefines.h:26
State
State
Definition: zmserver.h:68
MythBDBuffer
Definition: mythbdbuffer.h:19
MythBDBuffer::m_overlayLock
QMutex m_overlayLock
Definition: mythbdbuffer.h:125
uint
unsigned int uint
Definition: compat.h:81
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
Buffer
Definition: MythExternControl.h:36
MythBDBuffer::m_infoLock
QRecursiveMutex m_infoLock
Definition: mythbdbuffer.h:135
MythBDBuffer::m_cachedPlaylistInfo
QHash< uint32_t, BLURAY_TITLE_INFO * > m_cachedPlaylistInfo
Definition: mythbdbuffer.h:134
MythMediaBuffer::IsInStillFrame
virtual bool IsInStillFrame(void) const
Definition: mythmediabuffer.h:132
Name
Definition: channelsettings.cpp:71
mythbdoverlay.h
MythMediaBuffer::OpenFile
virtual bool OpenFile(const QString &Filename, std::chrono::milliseconds Retry=kDefaultOpenTimeout)=0
MythMediaBuffer::GetReadPosition
virtual long long GetReadPosition(void) const =0
MythOpticalBuffer
Definition: mythopticalbuffer.h:7
mpeg::chrono::pts
std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > pts
Definition: mythchrono.h:55
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
MythBDBuffer::m_overlayImages
QList< MythBDOverlay * > m_overlayImages
Definition: mythbdbuffer.h:126
MythBDBuffer::m_pendingData
QByteArray m_pendingData
Definition: mythbdbuffer.h:131
MythBDBuffer::m_overlayPlanes
QVector< MythBDOverlay * > m_overlayPlanes
Definition: mythbdbuffer.h:127
MythMediaBuffer::IsOpen
virtual bool IsOpen(void) const =0