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