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