1 #ifndef MYTH_DVD_BUFFER_H_
2 #define MYTH_DVD_BUFFER_H_
12 #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
13 #include <QRecursiveMutex>
15 #include <QCoreApplication>
27 #include "libavcodec/avcodec.h"
47 bool IsOpen (
void)
const override;
52 bool OpenFile (
const QString &Filename,
53 std::chrono::milliseconds Retry = kDefaultOpenTimeout)
override;
60 int GetTitle (
void)
const;
61 bool DVDWaitingForPlayer (
void)
const;
62 int GetPart (
void)
const;
63 int GetCurrentAngle (
void)
const;
64 int GetNumAngles (
void)
const;
65 long long GetTotalReadPosition (
void)
const;
66 std::chrono::seconds GetChapterLength (
void)
const;
67 void GetChapterTimes (QList<std::chrono::seconds> &Times);
68 std::chrono::seconds GetChapterTimes (
int Title);
69 void GetDescForPos (QString &Description)
const;
70 void GetPartAndTitle (
int &Part,
int &Title)
const;
71 std::chrono::seconds GetTotalTimeOfTitle (
void)
const;
72 float GetAspectOverride (
void)
const;
73 std::chrono::seconds GetCellStart (
void)
const;
74 bool PGCLengthChanged (
void);
75 bool CellChanged (
void);
76 bool IsStillFramePending (
void)
const;
77 bool AudioStreamsChanged (
void)
const;
78 bool IsWaiting (
void)
const;
79 int NumPartsInTitle (
void)
const;
80 void GetMenuSPUPkt (uint8_t *
Buffer,
int Size,
int StreamID, uint32_t StartTime);
81 uint32_t AdjustTimestamp (uint32_t Timestamp)
const;
82 int64_t AdjustTimestamp (int64_t Timestamp)
const;
84 int32_t GetLastEvent (
void)
const;
85 AVSubtitle* GetMenuSubtitle (
uint &Version);
86 int NumMenuButtons (
void)
const;
87 QRect GetButtonCoords (
void);
88 void ReleaseMenuButton (
void);
89 uint GetSubtitleLanguage (
int Id);
90 int8_t GetSubtitleTrackNum (
uint StreamId);
91 bool DecodeSubtitles (AVSubtitle* Subtitle,
int* GotSubtitles,
92 const uint8_t* SpuPkt,
int BufSize, uint32_t StartTime);
93 uint GetAudioLanguage (
int Index);
94 int GetAudioTrackNum (
uint StreamId);
95 int GetAudioTrackType (
uint Index);
96 bool GetDVDStateSnapshot (QString&
State);
97 bool RestoreDVDStateSnapshot(
const QString&
State);
98 double GetFrameRate (
void);
99 bool StartOfTitle (
void)
const;
100 bool EndOfTitle (
void)
const;
101 void PlayTitleAndPart (
int Title,
int Part);
102 void CloseDVD (
void);
103 bool PlayTrack (
int Track);
104 bool NextTrack (
void);
105 void PrevTrack (
void);
106 long long NormalSeek (
long long Time);
107 bool SectorSeek (uint64_t Sector);
108 void SkipStillFrame (
void);
109 void WaitSkip (
void);
110 void SkipDVDWaitingForPlayer(
void);
111 void UnblockReading (
void);
112 bool IsReadingBlocked (
void);
113 bool GoToMenu (
const QString &str);
114 void GoToNextProgram (
void);
115 void GoToPreviousProgram (
void);
117 void AudioStreamsChanged (
bool Change);
118 std::chrono::seconds GetCurrentTime (
void)
const;
119 std::chrono::seconds TitleTimeLeft (
void)
const;
120 void SetTrack (
uint Type,
int TrackNo);
121 int GetTrack (
uint Type)
const;
122 uint16_t GetNumAudioChannels (
int Index);
123 void SetDVDSpeed (
void);
124 void SetDVDSpeed (
int Speed);
125 bool SwitchAngle (
int Angle);
130 long long SeekInternal (
long long Position,
int Whence)
override;
132 void ActivateButton (
void);
133 void MoveButtonLeft (
void);
134 void MoveButtonRight (
void);
135 void MoveButtonUp (
void);
136 void MoveButtonDown (
void);
137 bool DVDButtonUpdate (
bool ButtonMode);
138 void ClearMenuSPUParameters (
void);
139 void ClearMenuButton (
void);
140 long long Seek (
long long Time);
141 void ClearChapterCache (
void);
142 void SelectDefaultButton(
void);
143 void WaitForPlayer (
void);
146 static uint GetNibble (
const uint8_t *
Buffer,
int NibbleOffset);
147 static int DecodeRLE (uint8_t *
Bitmap,
int Linesize,
int Width,
int Height,
148 const uint8_t *
Buffer,
int NibbleOffset,
int BufferSize);
149 void GuessPalette (uint32_t *RGBAPalette,
PaletteArray Palette,
151 static int IsTransparent (
const uint8_t *
Buffer,
int Pitch,
int Num,
153 static int FindSmallestBoundingRectangle(AVSubtitle *Subtitle);
155 dvdnav_t *m_dvdnav {
nullptr };
157 unsigned char *m_dvdBlockReadBuf {
nullptr };
158 int m_dvdBlockRPos { 0 };
159 int m_dvdBlockWPos { 0 };
163 bool m_cellChanged {
false };
164 bool m_pgcLengthChanged {
false };
165 long long m_pgStart { 0 };
166 long long m_currentpos { 0 };
167 int32_t m_part { 0 };
168 int32_t m_lastPart { 0 };
169 int32_t m_title { 0 };
170 int32_t m_lastTitle { 0 };
171 bool m_playerWait {
false };
172 int32_t m_titleParts { 0 };
173 bool m_gotStop {
false };
174 int m_currentTitleAngleCount { 0 };
175 int64_t m_endPts { 0 };
176 int64_t m_timeDiff { 0 };
177 std::chrono::seconds m_still { 0s };
178 std::chrono::seconds m_lastStill { 0s };
179 bool m_audioStreamsChanged {
false };
180 bool m_dvdWaiting {
false };
181 long long m_titleLength { 0 };
182 bool m_skipstillorwait {
true };
183 long long m_cellstartPos { 0 };
184 bool m_buttonSelected {
false };
185 bool m_buttonExists {
false };
186 bool m_buttonSeenInCell {
false };
187 bool m_lastButtonSeenInCell {
false };
189 int m_lastcellid { 0 };
191 int m_lastvobid { 0 };
192 bool m_cellRepeated {
false };
193 int m_curAudioTrack { 0 };
194 int8_t m_curSubtitleTrack { 0 };
195 bool m_autoselectsubtitle {
true };
196 bool m_seeking {
false };
202 float m_forcedAspect { -1.0F };
203 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
204 QMutex m_contextLock { QMutex::Recursive };
209 dvdnav_status_t m_dvdStat { DVDNAV_STATUS_OK };
210 int32_t m_dvdEvent { 0 };
211 int32_t m_dvdEventSize { 0 };
213 int m_buttonStreamID { 0 };
217 QRect m_hlButton { 0, 0, 0, 0 };
218 uint8_t *m_menuSpuPkt {
nullptr };
219 int m_menuBuflength { 0 };
220 AVSubtitle m_dvdMenuButton { };