MythTV  master
decoderbase.h
Go to the documentation of this file.
1 #ifndef DECODERBASE_H_
2 #define DECODERBASE_H_
3 
4 #include <array>
5 #include <cstdint>
6 #include <vector>
7 
8 #include "io/mythmediabuffer.h"
9 #include "remoteencoder.h"
10 #include "mythcontext.h"
11 #include "mythdbcon.h"
12 #include "programinfo.h"
13 #include "mythcodecid.h"
14 #include "mythavutil.h"
15 #include "mythvideoprofile.h"
16 
17 class TeletextViewer;
18 class MythPlayer;
19 class AudioPlayer;
20 class MythCodecContext;
21 
22 const int kDecoderProbeBufferSize = 256 * 1024;
23 using TestBufferVec = std::vector<char>;
24 
27 {
39  // The following are intentionally excluded from kTrackTypeCount which
40  // is used when auto-selecting the correct tracks to decode according to
41  // language, bitrate etc
43 };
44 QString toString(TrackType type);
45 int to_track_type(const QString &str);
46 
48 {
49  kDecodeNothing = 0x00, // Demux and preprocess only.
50  kDecodeVideo = 0x01,
51  kDecodeAudio = 0x02,
52  kDecodeAV = 0x03,
53 };
54 
56 {
58  kAudioTypeAudioDescription, // Audio Description for the visually impaired
59  kAudioTypeCleanEffects, // No dialog, soundtrack or effects only e.g. Karaoke
60  kAudioTypeHearingImpaired, // Greater contrast between dialog and background audio
61  kAudioTypeSpokenSubs, // Spoken subtitles for the visually impaired
62  kAudioTypeCommentary // Director/actor/etc Commentary
63 };
65 
66 // Eof States
68 {
69  kEofStateNone, // no eof
70  kEofStateDelayed, // decoder eof, but let player drain buffered frames
71  kEofStateImmediate // true eof
72 };
73 
75 {
76  public:
77  StreamInfo() = default;
78  StreamInfo(int a, int b, uint c, int d, int e, bool f = false,
79  bool g = false, bool h = false,
84  m_audio_type(i) {}
85  StreamInfo(int a, int b, uint c, int d, int e, int f,
86  bool g = false, bool h = false, bool i = false,
91  m_audio_type(j) {}
92 
93  public:
97  int m_language {-2};
99  int m_stream_id {-1};
100  bool m_easy_reader {false};
101  bool m_wide_aspect_ratio {false};
103  bool m_forced {false};
105 
106  bool operator<(const StreamInfo& b) const
107  {
108  return (this->m_stream_id < b.m_stream_id);
109  }
110 };
111 using sinfo_vec_t = std::vector<StreamInfo>;
112 
113 inline AVRational AVRationalInit(int num, int den = 1) {
114  AVRational result;
115  result.num = num;
116  result.den = den;
117  return result;
118 }
119 
121 {
122  public:
123  DecoderBase(MythPlayer *parent, const ProgramInfo &pginfo);
124  virtual ~DecoderBase();
125 
126  void SetRenderFormats(const VideoFrameTypes* RenderFormats);
127  virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file);
128  virtual int OpenFile(MythMediaBuffer *Buffer, bool novideo,
129  TestBufferVec & testbuf) = 0;
130 
131  virtual void SetEofState(EofState eof) { m_atEof = eof; }
132  virtual void SetEof(bool eof) {
134  }
135  EofState GetEof(void) { return m_atEof; }
136 
137  void SetSeekSnap(uint64_t snap) { m_seekSnap = snap; }
138  uint64_t GetSeekSnap(void) const { return m_seekSnap; }
139  void SetLiveTVMode(bool live) { m_livetv = live; }
140 
141  // Must be done while player is paused.
142  void SetProgramInfo(const ProgramInfo &pginfo);
143 
145  virtual void SetDisablePassThrough(bool disable) { (void)disable; }
146  // Reconfigure audio as necessary, following configuration change
147  virtual void ForceSetupAudioStream(void) { }
148 
149  virtual void SetWatchingRecording(bool mode);
151  virtual bool GetFrame(DecodeType Type, bool &Retry) = 0;
153 
154  virtual int GetNumChapters(void) { return 0; }
155  virtual int GetCurrentChapter(long long /*framesPlayed*/) { return 0; }
156  virtual void GetChapterTimes(QList<std::chrono::seconds> &/*times*/) { }
157  virtual long long GetChapter(int /*chapter*/) { return m_framesPlayed; }
158  virtual bool DoRewind(long long desiredFrame, bool discardFrames = true);
159  virtual bool DoFastForward(long long desiredFrame, bool discardFrames = true);
160  virtual void SetIdrOnlyKeyframes(bool /*value*/) { }
161 
162  static uint64_t
163  TranslatePositionAbsToRel(const frm_dir_map_t &deleteMap,
164  uint64_t absPosition,
165  const frm_pos_map_t &map = frm_pos_map_t(),
166  float fallback_ratio = 1.0);
167  static uint64_t
168  TranslatePositionRelToAbs(const frm_dir_map_t &deleteMap,
169  uint64_t relPosition,
170  const frm_pos_map_t &map = frm_pos_map_t(),
171  float fallback_ratio = 1.0);
172  static uint64_t TranslatePosition(const frm_pos_map_t &map,
173  long long key,
174  float fallback_ratio);
175  std::chrono::milliseconds TranslatePositionFrameToMs(long long position,
176  float fallback_framerate,
177  const frm_dir_map_t &cutlist);
178  uint64_t TranslatePositionMsToFrame(std::chrono::milliseconds dur_ms,
179  float fallback_framerate,
180  const frm_dir_map_t &cutlist);
181 
182  float GetVideoAspect(void) const { return m_currentAspect; }
183 
184  virtual std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode)
185  { return timecode; }
186 
187  virtual bool IsLastFrameKey(void) const = 0;
188  virtual void WriteStoredData(MythMediaBuffer *Buffer, bool storevid,
189  std::chrono::milliseconds timecodeOffset) = 0;
190  virtual void ClearStoredData(void) { }
191  virtual void SetRawAudioState(bool state) { m_getRawFrames = state; }
192  virtual bool GetRawAudioState(void) const { return m_getRawFrames; }
193  virtual void SetRawVideoState(bool state) { m_getRawVideo = state; }
194  virtual bool GetRawVideoState(void) const { return m_getRawVideo; }
195 
196  virtual long UpdateStoredFrameNum(long frame) = 0;
197 
198  virtual double GetFPS(void) const { return m_fps; }
200  uint GetRawBitrate(void) const { return m_bitrate; }
201 
202  virtual void UpdateFramesPlayed(void);
203  long long GetFramesRead(void) const { return m_framesRead; }
204  long long GetFramesPlayed(void) const { return m_framesPlayed; }
205  void SetFramesPlayed(long long newValue) {m_framesPlayed = newValue;}
206 
207  virtual QString GetCodecDecoderName(void) const = 0;
208  virtual QString GetRawEncodingType(void) { return QString(); }
209  virtual MythCodecID GetVideoCodecID(void) const = 0;
210 
211  virtual void ResetPosMap(void);
212  virtual bool SyncPositionMap(void);
213  virtual bool PosMapFromDb(void);
214  virtual bool PosMapFromEnc(void);
215 
216  virtual bool FindPosition(long long desired_value, bool search_adjusted,
217  int &lower_bound, int &upper_bound);
218 
219  uint64_t SavePositionMapDelta(long long first_frame, long long last_frame);
220  virtual void SeekReset(long long newkey, uint skipFrames,
221  bool doFlush, bool discardFrames);
222 
223  void SetTranscoding(bool value) { m_transcoding = value; }
224 
225  bool IsErrored() const { return m_errored; }
226 
227  bool HasPositionMap(void) const { return GetPositionMapSize() != 0U; }
228 
229  void SetWaitForChange(void);
230  bool GetWaitForChange(void) const;
231  void SetReadAdjust(long long adjust);
232 
233  // Audio/Subtitle/EIA-608/EIA-708 stream selection
234  void SetDecodeAllSubtitles(bool DecodeAll);
235  virtual QStringList GetTracks(uint Type);
236  virtual uint GetTrackCount(uint Type);
237 
238  virtual int GetTrackLanguageIndex(uint Type, uint TrackNo);
239  virtual QString GetTrackDesc(uint Type, uint TrackNo);
240  virtual int SetTrack(uint Type, int TrackNo);
241  int GetTrack(uint Type);
242  StreamInfo GetTrackInfo(uint Type, uint TrackNo);
243  int ChangeTrack(uint Type, int Dir);
244  virtual bool InsertTrack(uint Type, const StreamInfo &Info);
245  int NextTrack(uint Type);
246 
247  virtual int GetTeletextDecoderType(void) const { return -1; }
248 
249  virtual QString GetXDS(const QString &/*key*/) const { return QString(); }
250  virtual QByteArray GetSubHeader(uint /*trackNo*/) { return QByteArray(); }
251  virtual void GetAttachmentData(uint /*trackNo*/, QByteArray &/*filename*/,
252  QByteArray &/*data*/) {}
253 
254  // MHEG/MHI stuff
255  virtual bool SetAudioByComponentTag(int /*tag*/) { return false; }
256  virtual bool SetVideoByComponentTag(int /*tag*/) { return false; }
257 
258  void SaveTotalDuration(void);
260  void SaveTotalFrames(void);
261  void TrackTotalDuration(bool track) { m_trackTotalDuration = track; }
262  int GetfpsMultiplier(void) const { return m_fpsMultiplier; }
264  static AVPixelFormat GetBestVideoFormat(AVPixelFormat* Formats, const VideoFrameTypes* RenderFormats);
265 
266  protected:
267  virtual int AutoSelectTrack(uint Type);
268  void AutoSelectTracks(void);
269  void ResetTracks(void);
270  void FileChanged(void);
271  virtual bool DoRewindSeek(long long desiredFrame);
272  virtual void DoFastForwardSeek(long long desiredFrame, bool &needflush);
273 
274  long long ConditionallyUpdatePosMap(long long desiredFrame);
275  long long GetLastFrameInPosMap(void) const;
276  unsigned long GetPositionMapSize(void) const;
277 
278  struct PosMapEntry
279  {
280  long long index; // frame or keyframe number
281  long long adjFrame; // keyFrameAdjustTable adjusted frame number
282  long long pos; // position in stream
283  };
284  long long GetKey(const PosMapEntry &entry) const;
285 
286  MythPlayer *m_parent {nullptr};
288  AudioPlayer *m_audio {nullptr};
290 
291  double m_fps {29.97};
293  int m_fpsSkip {0};
294  uint m_bitrate {4000};
295  int m_currentWidth {640};
296  int m_currentHeight {480};
297  float m_currentAspect {1.33333F};
298 
299  long long m_framesPlayed {0};
300  long long m_framesRead {0};
301  uint64_t m_frameCounter {0};
302  AVRational m_totalDuration;
303  int m_keyframeDist {-1};
304  long long m_lastKey {0};
305  long long m_indexOffset {0};
308 
310 
311  // The totalDuration field is only valid when the video is played
312  // from start to finish without any jumping. trackTotalDuration
313  // indicates whether this is the case.
314  bool m_trackTotalDuration {false};
315 
316  bool m_exitAfterDecoded {false};
317  bool m_transcoding {false};
318 
319  bool m_hasFullPositionMap {false};
321  bool m_posmapStarted {false};
323 
324 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
325  mutable QMutex m_positionMapLock {QMutex::Recursive};
326 #else
327  mutable QRecursiveMutex m_positionMapLock;
328 #endif
329  std::vector<PosMapEntry> m_positionMap;
330  frm_pos_map_t m_frameToDurMap; // guarded by m_positionMapLock
331  frm_pos_map_t m_durToFrameMap; // guarded by m_positionMapLock
332  mutable QDateTime m_lastPositionMapUpdate; // guarded by m_positionMapLock
333 
334  uint64_t m_seekSnap {UINT64_MAX};
335  bool m_dontSyncPositionMap {false};
336  bool m_livetv {false};
337  bool m_watchingRecording {false};
338 
340 
341  bool m_getRawFrames {false};
342  bool m_getRawVideo {false};
343 
344  bool m_errored {false};
345 
346  bool m_waitingForChange {false};
347  bool m_justAfterChange {false};
348  long long m_readAdjust {0};
351 
352  // Audio/Subtitle/EIA-608/EIA-708 stream selection
353 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
354  QMutex m_trackLock { QMutex::Recursive };
355 #else
356  QRecursiveMutex m_trackLock;
357 #endif
358  bool m_decodeAllSubtitles { false };
359  std::array<int, kTrackTypeCount> m_currentTrack {};
360  std::array<sinfo_vec_t,kTrackTypeCount> m_tracks;
361  std::array<StreamInfo, kTrackTypeCount> m_wantedTrack;
362  std::array<StreamInfo, kTrackTypeCount> m_selectedTrack;
363 
365  std::vector<int> m_languagePreference;
369 
370  private:
371  Q_DISABLE_COPY(DecoderBase)
372 };
373 #endif
kTrackTypeUnknown
@ kTrackTypeUnknown
Definition: decoderbase.h:28
AVRationalInit
AVRational AVRationalInit(int num, int den=1)
Definition: decoderbase.h:113
DecoderBase::GetCurrentChapter
virtual int GetCurrentChapter(long long)
Definition: decoderbase.h:155
DecoderBase::UpdateStoredFrameNum
virtual long UpdateStoredFrameNum(long frame)=0
kDecodeAV
@ kDecodeAV
Definition: decoderbase.h:52
DecoderBase::DoFastForward
virtual bool DoFastForward(long long desiredFrame, bool discardFrames=true)
Skips ahead or rewinds to desiredFrame.
Definition: decoderbase.cpp:710
kAudioTypeHearingImpaired
@ kAudioTypeHearingImpaired
Definition: decoderbase.h:60
DecoderBase::NormalizeVideoTimecode
virtual std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode)
Definition: decoderbase.h:184
DecoderBase::SetVideoByComponentTag
virtual bool SetVideoByComponentTag(int)
Definition: decoderbase.h:256
DecoderBase::SetTrack
virtual int SetTrack(uint Type, int TrackNo)
Definition: decoderbase.cpp:963
DecoderBase::m_readAdjust
long long m_readAdjust
Definition: decoderbase.h:348
DecoderBase::GetTrack
int GetTrack(uint Type)
Definition: decoderbase.cpp:957
DecoderBase::NextTrack
int NextTrack(uint Type)
Definition: decoderbase.cpp:1010
kDecoderProbeBufferSize
const int kDecoderProbeBufferSize
Definition: decoderbase.h:22
DecoderBase::TrackTotalDuration
void TrackTotalDuration(bool track)
Definition: decoderbase.h:261
DecoderBase::PosMapEntry::adjFrame
long long adjFrame
Definition: decoderbase.h:281
DecoderBase::ClearStoredData
virtual void ClearStoredData(void)
Definition: decoderbase.h:190
DecoderBase::GetFramesPlayed
long long GetFramesPlayed(void) const
Definition: decoderbase.h:204
DecoderBase::m_seekSnap
uint64_t m_seekSnap
Definition: decoderbase.h:334
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
kTrackTypeTextSubtitle
@ kTrackTypeTextSubtitle
Definition: decoderbase.h:42
DecoderBase::m_selectedTrack
std::array< StreamInfo, kTrackTypeCount > m_selectedTrack
Definition: decoderbase.h:362
DecoderBase::m_ringBuffer
MythMediaBuffer * m_ringBuffer
Definition: decoderbase.h:289
DecoderBase::m_renderFormats
const VideoFrameTypes * m_renderFormats
Definition: decoderbase.h:368
to_track_type
int to_track_type(const QString &str)
Definition: decoderbase.cpp:1182
StreamInfo::m_language_index
uint m_language_index
Definition: decoderbase.h:98
DecoderBase::PosMapEntry
Definition: decoderbase.h:278
DecoderBase::GetEof
EofState GetEof(void)
Definition: decoderbase.h:135
DecoderBase::m_currentWidth
int m_currentWidth
Definition: decoderbase.h:295
AudioPlayer
Definition: audioplayer.h:28
kEofStateNone
@ kEofStateNone
Definition: decoderbase.h:69
kTrackTypeCount
@ kTrackTypeCount
Definition: decoderbase.h:38
DecoderBase::m_fps
double m_fps
Definition: decoderbase.h:291
DecoderBase::m_indexOffset
long long m_indexOffset
Definition: decoderbase.h:305
DecoderBase::m_lastPositionMapUpdate
QDateTime m_lastPositionMapUpdate
Definition: decoderbase.h:332
StreamInfo::m_easy_reader
bool m_easy_reader
Definition: decoderbase.h:100
DecoderBase::m_videoRotation
int m_videoRotation
Definition: decoderbase.h:349
DecoderBase::m_stereo3D
uint m_stereo3D
Definition: decoderbase.h:350
DecoderBase::m_hasKeyFrameAdjustTable
bool m_hasKeyFrameAdjustTable
Definition: decoderbase.h:339
StreamInfo::m_av_stream_index
int m_av_stream_index
Definition: decoderbase.h:94
DecoderBase::ConditionallyUpdatePosMap
long long ConditionallyUpdatePosMap(long long desiredFrame)
Definition: decoderbase.cpp:667
DecoderBase::AutoSelectTrack
virtual int AutoSelectTrack(uint Type)
Select best track.
Definition: decoderbase.cpp:1054
DecoderBase::m_atEof
EofState m_atEof
Definition: decoderbase.h:309
DecoderBase::m_bitrate
uint m_bitrate
Definition: decoderbase.h:294
DecoderBase::m_parent
MythPlayer * m_parent
Definition: decoderbase.h:286
DecoderBase::SavePositionMapDelta
uint64_t SavePositionMapDelta(long long first_frame, long long last_frame)
Definition: decoderbase.cpp:500
StreamInfo::m_stream_id
int m_stream_id
Definition: decoderbase.h:99
kTrackTypeTeletextMenu
@ kTrackTypeTeletextMenu
Definition: decoderbase.h:35
kTrackTypeAttachment
@ kTrackTypeAttachment
Definition: decoderbase.h:37
DecoderBase::DecoderBase
DecoderBase(MythPlayer *parent, const ProgramInfo &pginfo)
Definition: decoderbase.cpp:17
StreamInfo::m_orig_num_channels
int m_orig_num_channels
Definition: decoderbase.h:102
DecoderBase::GetAttachmentData
virtual void GetAttachmentData(uint, QByteArray &, QByteArray &)
Definition: decoderbase.h:251
DecoderBase::m_livetv
bool m_livetv
Definition: decoderbase.h:336
DecoderBase::GetSeekSnap
uint64_t GetSeekSnap(void) const
Definition: decoderbase.h:138
mythdbcon.h
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:82
DecoderBase::ResetTracks
void ResetTracks(void)
Definition: decoderbase.cpp:1151
DecoderBase::IsErrored
bool IsErrored() const
Definition: decoderbase.h:225
DecoderBase::m_hasFullPositionMap
bool m_hasFullPositionMap
Definition: decoderbase.h:319
MythMediaBuffer
Definition: mythmediabuffer.h:50
DecoderBase::GetMythCodecContext
MythCodecContext * GetMythCodecContext(void)
Definition: decoderbase.h:263
DecoderBase::m_videoDisplayProfile
MythVideoProfile m_videoDisplayProfile
Definition: decoderbase.h:367
DecoderBase::ChangeTrack
int ChangeTrack(uint Type, int Dir)
Definition: decoderbase.cpp:994
TrackType
TrackType
Track types.
Definition: decoderbase.h:26
DecoderBase::m_trackLock
QRecursiveMutex m_trackLock
Definition: decoderbase.h:356
kAudioTypeCleanEffects
@ kAudioTypeCleanEffects
Definition: decoderbase.h:59
DecoderBase::SetAudioByComponentTag
virtual bool SetAudioByComponentTag(int)
Definition: decoderbase.h:255
DecoderBase::m_positionMapType
MarkTypes m_positionMapType
Definition: decoderbase.h:322
MythPlayer
Definition: mythplayer.h:86
DecoderBase::m_posmapStarted
bool m_posmapStarted
Definition: decoderbase.h:321
DecoderBase::GetVideoCodecID
virtual MythCodecID GetVideoCodecID(void) const =0
DecoderBase::m_exitAfterDecoded
bool m_exitAfterDecoded
Definition: decoderbase.h:316
DecoderBase::GetRawBitrate
uint GetRawBitrate(void) const
Returns the estimated bitrate if the video were played at normal speed.
Definition: decoderbase.h:200
StreamInfo::StreamInfo
StreamInfo(int a, int b, uint c, int d, int e, int f, bool g=false, bool h=false, bool i=false, AudioTrackType j=kAudioTypeNormal)
Definition: decoderbase.h:85
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
DecoderBase::m_frameToDurMap
frm_pos_map_t m_frameToDurMap
Definition: decoderbase.h:330
DecoderBase::GetWaitForChange
bool GetWaitForChange(void) const
Definition: decoderbase.cpp:904
DecoderBase::SetWaitForChange
void SetWaitForChange(void)
Definition: decoderbase.cpp:899
DecoderBase::m_currentTrack
std::array< int, kTrackTypeCount > m_currentTrack
Definition: decoderbase.h:359
DecoderBase::m_dontSyncPositionMap
bool m_dontSyncPositionMap
Definition: decoderbase.h:335
DecoderBase::TranslatePositionMsToFrame
uint64_t TranslatePositionMsToFrame(std::chrono::milliseconds dur_ms, float fallback_framerate, const frm_dir_map_t &cutlist)
Definition: decoderbase.cpp:1339
StreamInfo::m_wide_aspect_ratio
bool m_wide_aspect_ratio
Definition: decoderbase.h:101
DecoderBase::m_tracks
std::array< sinfo_vec_t, kTrackTypeCount > m_tracks
Definition: decoderbase.h:360
MythVideoProfile
Definition: mythvideoprofile.h:87
DecoderBase::WriteStoredData
virtual void WriteStoredData(MythMediaBuffer *Buffer, bool storevid, std::chrono::milliseconds timecodeOffset)=0
DecoderBase::GetChapter
virtual long long GetChapter(int)
Definition: decoderbase.h:157
kAudioTypeAudioDescription
@ kAudioTypeAudioDescription
Definition: decoderbase.h:58
EofState
EofState
Definition: decoderbase.h:67
DecoderBase::m_errored
bool m_errored
Definition: decoderbase.h:344
DecoderBase::GetChapterTimes
virtual void GetChapterTimes(QList< std::chrono::seconds > &)
Definition: decoderbase.h:156
kAudioTypeNormal
@ kAudioTypeNormal
Definition: decoderbase.h:57
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
DecoderBase::GetTrackDesc
virtual QString GetTrackDesc(uint Type, uint TrackNo)
Definition: decoderbase.cpp:939
DecoderBase::SaveTotalDuration
void SaveTotalDuration(void)
Definition: decoderbase.cpp:1241
DecoderBase::GetTrackCount
virtual uint GetTrackCount(uint Type)
Definition: decoderbase.cpp:909
DecoderBase::FindPosition
virtual bool FindPosition(long long desired_value, bool search_adjusted, int &lower_bound, int &upper_bound)
Definition: decoderbase.cpp:420
DecoderBase::GetCodecDecoderName
virtual QString GetCodecDecoderName(void) const =0
DecoderBase::TranslatePositionAbsToRel
static uint64_t TranslatePositionAbsToRel(const frm_dir_map_t &deleteMap, uint64_t absPosition, const frm_pos_map_t &map=frm_pos_map_t(), float fallback_ratio=1.0)
Definition: decoderbase.cpp:1363
DecoderBase::ForceSetupAudioStream
virtual void ForceSetupAudioStream(void)
Definition: decoderbase.h:147
programinfo.h
DecoderBase::m_keyframeDist
int m_keyframeDist
Definition: decoderbase.h:303
DecoderBase::m_getRawFrames
bool m_getRawFrames
Definition: decoderbase.h:341
DecoderBase::GetRawVideoState
virtual bool GetRawVideoState(void) const
Definition: decoderbase.h:194
DecoderBase::GetTrackInfo
StreamInfo GetTrackInfo(uint Type, uint TrackNo)
Definition: decoderbase.cpp:983
StreamInfo
Definition: decoderbase.h:74
DecoderBase::m_languagePreference
std::vector< int > m_languagePreference
language preferences for auto-selection of streams
Definition: decoderbase.h:365
DecoderBase::DoRewindSeek
virtual bool DoRewindSeek(long long desiredFrame)
Definition: decoderbase.cpp:589
StreamInfo::m_audio_type
AudioTrackType m_audio_type
Definition: decoderbase.h:104
DecoderBase::GetfpsMultiplier
int GetfpsMultiplier(void) const
Definition: decoderbase.h:262
DecoderBase::~DecoderBase
virtual ~DecoderBase()
Definition: decoderbase.cpp:31
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:83
DecoderBase::IsLastFrameKey
virtual bool IsLastFrameKey(void) const =0
DecoderBase::m_audio
AudioPlayer * m_audio
Definition: decoderbase.h:288
DecoderBase::TranslatePositionRelToAbs
static uint64_t TranslatePositionRelToAbs(const frm_dir_map_t &deleteMap, uint64_t relPosition, const frm_pos_map_t &map=frm_pos_map_t(), float fallback_ratio=1.0)
Definition: decoderbase.cpp:1412
DecoderBase::m_positionMap
std::vector< PosMapEntry > m_positionMap
Definition: decoderbase.h:329
DecodeType
DecodeType
Definition: decoderbase.h:47
kTrackTypeTeletextCaptions
@ kTrackTypeTeletextCaptions
Definition: decoderbase.h:34
DecoderBase::ResetTotalDuration
void ResetTotalDuration(void)
Definition: decoderbase.h:259
DecoderBase::TranslatePositionFrameToMs
std::chrono::milliseconds TranslatePositionFrameToMs(long long position, float fallback_framerate, const frm_dir_map_t &cutlist)
Definition: decoderbase.cpp:1311
DecoderBase::SetEof
virtual void SetEof(bool eof)
Definition: decoderbase.h:132
mythcodecid.h
DecoderBase::m_getRawVideo
bool m_getRawVideo
Definition: decoderbase.h:342
DecoderBase::GetRawEncodingType
virtual QString GetRawEncodingType(void)
Definition: decoderbase.h:208
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
DecoderBase::GetXDS
virtual QString GetXDS(const QString &) const
Definition: decoderbase.h:249
DecoderBase::m_durToFrameMap
frm_pos_map_t m_durToFrameMap
Definition: decoderbase.h:331
DecoderBase::ResetPosMap
virtual void ResetPosMap(void)
Definition: decoderbase.cpp:647
DecoderBase::GetFPS
virtual double GetFPS(void) const
Definition: decoderbase.h:198
DecoderBase::SetReadAdjust
void SetReadAdjust(long long adjust)
Definition: decoderbase.cpp:894
DecoderBase::m_playbackInfo
ProgramInfo * m_playbackInfo
Definition: decoderbase.h:287
DecoderBase::m_totalDuration
AVRational m_totalDuration
Definition: decoderbase.h:302
mythvideoprofile.h
DecoderBase::PosMapEntry::index
long long index
Definition: decoderbase.h:280
kTrackTypeAudio
@ kTrackTypeAudio
Definition: decoderbase.h:29
DecoderBase::SetFramesPlayed
void SetFramesPlayed(long long newValue)
Definition: decoderbase.h:205
kTrackTypeCC708
@ kTrackTypeCC708
Definition: decoderbase.h:33
DecoderBase::GetPositionMapSize
unsigned long GetPositionMapSize(void) const
Definition: decoderbase.cpp:294
uint
unsigned int uint
Definition: compat.h:140
DecoderBase::AutoSelectTracks
void AutoSelectTracks(void)
Definition: decoderbase.cpp:1145
DecoderBase::FileChanged
void FileChanged(void)
Definition: decoderbase.cpp:881
DecoderBase::m_wantedTrack
std::array< StreamInfo, kTrackTypeCount > m_wantedTrack
Definition: decoderbase.h:361
DecoderBase::m_transcoding
bool m_transcoding
Definition: decoderbase.h:317
DecoderBase::m_waitingForChange
bool m_waitingForChange
Definition: decoderbase.h:346
DecoderBase::GetRawAudioState
virtual bool GetRawAudioState(void) const
Definition: decoderbase.h:192
StreamInfo::StreamInfo
StreamInfo(int a, int b, uint c, int d, int e, bool f=false, bool g=false, bool h=false, AudioTrackType i=kAudioTypeNormal)
Definition: decoderbase.h:78
kTrackTypeSubtitle
@ kTrackTypeSubtitle
Definition: decoderbase.h:31
DecoderBase::m_justAfterChange
bool m_justAfterChange
Definition: decoderbase.h:347
DecoderBase::GetSubHeader
virtual QByteArray GetSubHeader(uint)
Definition: decoderbase.h:250
DecoderBase::m_currentAspect
float m_currentAspect
Definition: decoderbase.h:297
mythmediabuffer.h
DecoderBase::SyncPositionMap
virtual bool SyncPositionMap(void)
Updates the position map used for skipping frames.
Definition: decoderbase.cpp:322
frm_pos_map_t
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
Definition: programtypes.h:46
DecoderBase::m_fpsMultiplier
int m_fpsMultiplier
Definition: decoderbase.h:292
DecoderBase::SetSeekSnap
void SetSeekSnap(uint64_t snap)
Definition: decoderbase.h:137
DecoderBase::SetProgramInfo
void SetProgramInfo(const ProgramInfo &pginfo)
Definition: decoderbase.cpp:42
kDecodeNothing
@ kDecodeNothing
Definition: decoderbase.h:49
DecoderBase::GetVideoAspect
float GetVideoAspect(void) const
Definition: decoderbase.h:182
DecoderBase::GetKey
long long GetKey(const PosMapEntry &entry) const
Definition: decoderbase.cpp:582
DecoderBase::GetNumChapters
virtual int GetNumChapters(void)
Definition: decoderbase.h:154
StreamInfo::m_av_substream_index
int m_av_substream_index
-1 for no substream, 0 for first dual audio stream, 1 for second dual
Definition: decoderbase.h:96
DecoderBase::PosMapFromEnc
virtual bool PosMapFromEnc(void)
Queries encoder for position map data that has not been committed to the DB yet.
Definition: decoderbase.cpp:223
DecoderBase::SetWatchingRecording
virtual void SetWatchingRecording(bool mode)
Definition: decoderbase.cpp:82
DecoderBase::SetTranscoding
void SetTranscoding(bool value)
Definition: decoderbase.h:223
DecoderBase::GetFrame
virtual bool GetFrame(DecodeType Type, bool &Retry)=0
Demux, preprocess and possibly decode a frame of video/audio.
DecoderBase::DoFastForwardSeek
virtual void DoFastForwardSeek(long long desiredFrame, bool &needflush)
Seeks to the keyframe just before the desiredFrame if exact seeks is enabled, or the frame just after...
Definition: decoderbase.cpp:830
kDecodeVideo
@ kDecodeVideo
Definition: decoderbase.h:50
kTrackTypeCC608
@ kTrackTypeCC608
Definition: decoderbase.h:32
DecoderBase::UpdateFramesPlayed
virtual void UpdateFramesPlayed(void)
Definition: decoderbase.cpp:876
DecoderBase::m_currentHeight
int m_currentHeight
Definition: decoderbase.h:296
Buffer
Definition: MythExternControl.h:36
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
kEofStateImmediate
@ kEofStateImmediate
Definition: decoderbase.h:71
DecoderBase::SetDecodeAllSubtitles
void SetDecodeAllSubtitles(bool DecodeAll)
Definition: decoderbase.cpp:915
DecoderBase::m_framesPlayed
long long m_framesPlayed
Definition: decoderbase.h:299
kEofStateDelayed
@ kEofStateDelayed
Definition: decoderbase.h:70
MythVideoFrame::kDefaultRenderFormats
static const VideoFrameTypes kDefaultRenderFormats
Definition: mythframe.h:91
DecoderBase::m_mythCodecCtx
MythCodecContext * m_mythCodecCtx
Definition: decoderbase.h:366
DecoderBase::m_positionMapLock
QRecursiveMutex m_positionMapLock
Definition: decoderbase.h:327
DecoderBase::PosMapEntry::pos
long long pos
Definition: decoderbase.h:282
DecoderBase::SetRenderFormats
void SetRenderFormats(const VideoFrameTypes *RenderFormats)
Definition: decoderbase.cpp:36
DecoderBase::m_decodeAllSubtitles
bool m_decodeAllSubtitles
Definition: decoderbase.h:358
MarkTypes
MarkTypes
Definition: programtypes.h:48
StreamInfo::m_language
int m_language
ISO639 canonical language key.
Definition: decoderbase.h:97
DecoderBase::m_watchingRecording
bool m_watchingRecording
Definition: decoderbase.h:337
mythavutil.h
mythcontext.h
DecoderBase::TranslatePosition
static uint64_t TranslatePosition(const frm_pos_map_t &map, long long key, float fallback_ratio)
Definition: decoderbase.cpp:1260
StreamInfo::m_forced
bool m_forced
Definition: decoderbase.h:103
DecoderBase::PosMapFromDb
virtual bool PosMapFromDb(void)
Definition: decoderbase.cpp:95
DecoderBase::m_nextDecodedFrameIsKeyFrame
bool m_nextDecodedFrameIsKeyFrame
Definition: decoderbase.h:307
StreamInfo::operator<
bool operator<(const StreamInfo &b) const
Definition: decoderbase.h:106
MythAVCopy
Definition: mythavutil.h:47
remoteencoder.h
DecoderBase::GetTeletextDecoderType
virtual int GetTeletextDecoderType(void) const
Definition: decoderbase.h:247
DecoderBase::SetDisablePassThrough
virtual void SetDisablePassThrough(bool disable)
Disables AC3/DTS pass through.
Definition: decoderbase.h:145
DecoderBase::SetRawAudioState
virtual void SetRawAudioState(bool state)
Definition: decoderbase.h:191
kTrackTypeRawText
@ kTrackTypeRawText
Definition: decoderbase.h:36
DecoderBase::GetBestVideoFormat
static AVPixelFormat GetBestVideoFormat(AVPixelFormat *Formats, const VideoFrameTypes *RenderFormats)
Find a suitable frame format that is mutually acceptable to the decoder and render device.
Definition: decoderbase.cpp:1448
MARK_UNSET
@ MARK_UNSET
Definition: programtypes.h:50
DecoderBase::m_lastKey
long long m_lastKey
Definition: decoderbase.h:304
snap
static float snap(float value, float snapto, float diff)
Definition: mythvideobounds.cpp:920
MythCodecContext
Definition: mythcodeccontext.h:53
DecoderBase::OpenFile
virtual int OpenFile(MythMediaBuffer *Buffer, bool novideo, TestBufferVec &testbuf)=0
kTrackTypeVideo
@ kTrackTypeVideo
Definition: decoderbase.h:30
toString
QString toString(TrackType type)
Definition: decoderbase.cpp:1157
DecoderBase::m_trackTotalDuration
bool m_trackTotalDuration
Definition: decoderbase.h:314
DecoderBase::m_framesRead
long long m_framesRead
Definition: decoderbase.h:300
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
DecoderBase::Reset
virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file)
Definition: decoderbase.cpp:48
DecoderBase::m_copyFrame
MythAVCopy m_copyFrame
Definition: decoderbase.h:306
StreamInfo::StreamInfo
StreamInfo()=default
DecoderBase::GetTracks
virtual QStringList GetTracks(uint Type)
Definition: decoderbase.cpp:922
DecoderBase::SetRawVideoState
virtual void SetRawVideoState(bool state)
Definition: decoderbase.h:193
DecoderBase::m_fpsSkip
int m_fpsSkip
Definition: decoderbase.h:293
kAudioTypeSpokenSubs
@ kAudioTypeSpokenSubs
Definition: decoderbase.h:61
DecoderBase::GetLastFrameInPosMap
long long GetLastFrameInPosMap(void) const
Definition: decoderbase.cpp:656
DecoderBase::SetEofState
virtual void SetEofState(EofState eof)
Definition: decoderbase.h:131
DecoderBase::InsertTrack
virtual bool InsertTrack(uint Type, const StreamInfo &Info)
Definition: decoderbase.cpp:1021
DecoderBase::SetLiveTVMode
void SetLiveTVMode(bool live)
Definition: decoderbase.h:139
DecoderBase::SeekReset
virtual void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames)
Definition: decoderbase.cpp:75
DecoderBase::GetFramesRead
long long GetFramesRead(void) const
Definition: decoderbase.h:203
DecoderBase::DoRewind
virtual bool DoRewind(long long desiredFrame, bool discardFrames=true)
Definition: decoderbase.cpp:555
kDecodeAudio
@ kDecodeAudio
Definition: decoderbase.h:51
DecoderBase::HasPositionMap
bool HasPositionMap(void) const
Definition: decoderbase.h:227
DecoderBase
Definition: decoderbase.h:120
DecoderBase::SetIdrOnlyKeyframes
virtual void SetIdrOnlyKeyframes(bool)
Definition: decoderbase.h:160
DecoderBase::GetPlayer
MythPlayer * GetPlayer()
Definition: decoderbase.h:152
DecoderBase::m_recordingHasPositionMap
bool m_recordingHasPositionMap
Definition: decoderbase.h:320
DecoderBase::GetTrackLanguageIndex
virtual int GetTrackLanguageIndex(uint Type, uint TrackNo)
Definition: decoderbase.cpp:931
DecoderBase::SaveTotalFrames
void SaveTotalFrames(void)
Definition: decoderbase.cpp:1249
kAudioTypeCommentary
@ kAudioTypeCommentary
Definition: decoderbase.h:62
DecoderBase::m_frameCounter
uint64_t m_frameCounter
Definition: decoderbase.h:301