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