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 "libmyth/mythcontext.h"
12 #include "libmythtv/mythavutil.h"
13 #include "libmythtv/mythcodecid.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 
26 enum TrackType : std::uint8_t
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 
47 enum DecodeType : std::uint8_t
48 {
49  kDecodeNothing = 0x00, // Demux and preprocess only.
50  kDecodeVideo = 0x01,
51  kDecodeAudio = 0x02,
52  kDecodeAV = 0x03,
53 };
54 
55 enum AudioTrackType : std::uint8_t
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
67 enum EofState : std::uint8_t
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 {}; }
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 {}; }
250  virtual QByteArray GetSubHeader(uint /*trackNo*/) { return {}; }
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  int BestTrack(uint Type, bool forcedPreferred, int preferredLanguage = 0);
268  virtual int AutoSelectTrack(uint Type);
269  void AutoSelectTracks(void);
270  void ResetTracks(void);
271  void FileChanged(void);
272  virtual bool DoRewindSeek(long long desiredFrame);
273  virtual void DoFastForwardSeek(long long desiredFrame, bool &needflush);
274 
275  long long ConditionallyUpdatePosMap(long long desiredFrame);
276  long long GetLastFrameInPosMap(void) const;
277  unsigned long GetPositionMapSize(void) const;
278 
279  struct PosMapEntry
280  {
281  long long index; // frame or keyframe number
282  long long adjFrame; // keyFrameAdjustTable adjusted frame number
283  long long pos; // position in stream
284  };
285  long long GetKey(const PosMapEntry &entry) const;
286 
287  MythPlayer *m_parent {nullptr};
289  AudioPlayer *m_audio {nullptr};
291 
292  double m_fps {29.97};
294  int m_fpsSkip {0};
295  uint m_bitrate {4000};
296  int m_currentWidth {640};
297  int m_currentHeight {480};
298  float m_currentAspect {1.33333F};
299 
300  long long m_framesPlayed {0};
301  long long m_framesRead {0};
302  uint64_t m_frameCounter {0};
303  AVRational m_totalDuration;
304  int m_keyframeDist {-1};
305  long long m_lastKey {0};
306  long long m_indexOffset {0};
309 
311 
312  // The totalDuration field is only valid when the video is played
313  // from start to finish without any jumping. trackTotalDuration
314  // indicates whether this is the case.
315  bool m_trackTotalDuration {false};
316 
317  bool m_exitAfterDecoded {false};
318  bool m_transcoding {false};
319 
320  bool m_hasFullPositionMap {false};
322  bool m_posmapStarted {false};
324 
325  mutable QRecursiveMutex m_positionMapLock;
326  std::vector<PosMapEntry> m_positionMap;
327  frm_pos_map_t m_frameToDurMap; // guarded by m_positionMapLock
328  frm_pos_map_t m_durToFrameMap; // guarded by m_positionMapLock
329  mutable QDateTime m_lastPositionMapUpdate; // guarded by m_positionMapLock
330 
331  uint64_t m_seekSnap {UINT64_MAX};
332  bool m_dontSyncPositionMap {false};
333  bool m_livetv {false};
334  bool m_watchingRecording {false};
335 
337 
338  bool m_getRawFrames {false};
339  bool m_getRawVideo {false};
340 
341  bool m_errored {false};
342 
343  bool m_waitingForChange {false};
344  bool m_justAfterChange {false};
345  long long m_readAdjust {0};
348 
349  // Audio/Subtitle/EIA-608/EIA-708 stream selection
350  QRecursiveMutex m_trackLock;
351  bool m_decodeAllSubtitles { false };
352  std::array<int, kTrackTypeCount> m_currentTrack {};
353  std::array<sinfo_vec_t,kTrackTypeCount> m_tracks;
354  std::array<StreamInfo, kTrackTypeCount> m_wantedTrack;
355  std::array<StreamInfo, kTrackTypeCount> m_selectedTrack;
356  std::array<StreamInfo, kTrackTypeCount> m_selectedForcedTrack;
357 
359  std::vector<int> m_languagePreference;
363 
364  private:
365  Q_DISABLE_COPY(DecoderBase)
366 };
367 #endif
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
DecoderBase::DoFastForward
virtual bool DoFastForward(long long desiredFrame, bool discardFrames=true)
Skips ahead or rewinds to desiredFrame.
Definition: decoderbase.cpp:710
kTrackTypeAttachment
@ kTrackTypeAttachment
Definition: decoderbase.h:37
DecoderBase::NormalizeVideoTimecode
virtual std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode)
Definition: decoderbase.h:184
kTrackTypeCC708
@ kTrackTypeCC708
Definition: decoderbase.h:33
kTrackTypeUnknown
@ kTrackTypeUnknown
Definition: decoderbase.h:28
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:345
DecoderBase::GetTrack
int GetTrack(uint Type)
Definition: decoderbase.cpp:957
DecoderBase::NextTrack
int NextTrack(uint Type)
Definition: decoderbase.cpp:1017
kDecoderProbeBufferSize
const int kDecoderProbeBufferSize
Definition: decoderbase.h:22
DecoderBase::TrackTotalDuration
void TrackTotalDuration(bool track)
Definition: decoderbase.h:261
kAudioTypeNormal
@ kAudioTypeNormal
Definition: decoderbase.h:57
DecoderBase::PosMapEntry::adjFrame
long long adjFrame
Definition: decoderbase.h:282
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:331
DecoderBase::m_selectedTrack
std::array< StreamInfo, kTrackTypeCount > m_selectedTrack
Definition: decoderbase.h:355
DecoderBase::m_ringBuffer
MythMediaBuffer * m_ringBuffer
Definition: decoderbase.h:290
kEofStateImmediate
@ kEofStateImmediate
Definition: decoderbase.h:71
DecoderBase::m_renderFormats
const VideoFrameTypes * m_renderFormats
Definition: decoderbase.h:362
to_track_type
int to_track_type(const QString &str)
Definition: decoderbase.cpp:1235
StreamInfo::m_language_index
uint m_language_index
Definition: decoderbase.h:98
DecoderBase::PosMapEntry
Definition: decoderbase.h:279
kDecodeAudio
@ kDecodeAudio
Definition: decoderbase.h:51
DecoderBase::GetEof
EofState GetEof(void)
Definition: decoderbase.h:135
kTrackTypeSubtitle
@ kTrackTypeSubtitle
Definition: decoderbase.h:31
DecoderBase::m_currentWidth
int m_currentWidth
Definition: decoderbase.h:296
DecodeType
DecodeType
Definition: decoderbase.h:47
AudioPlayer
Definition: audioplayer.h:22
DecoderBase::m_fps
double m_fps
Definition: decoderbase.h:292
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
DecoderBase::m_indexOffset
long long m_indexOffset
Definition: decoderbase.h:306
DecoderBase::m_lastPositionMapUpdate
QDateTime m_lastPositionMapUpdate
Definition: decoderbase.h:329
StreamInfo::m_easy_reader
bool m_easy_reader
Definition: decoderbase.h:100
DecoderBase::m_videoRotation
int m_videoRotation
Definition: decoderbase.h:346
DecoderBase::m_stereo3D
uint m_stereo3D
Definition: decoderbase.h:347
DecoderBase::m_hasKeyFrameAdjustTable
bool m_hasKeyFrameAdjustTable
Definition: decoderbase.h:336
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:1119
DecoderBase::m_atEof
EofState m_atEof
Definition: decoderbase.h:310
DecoderBase::m_bitrate
uint m_bitrate
Definition: decoderbase.h:295
DecoderBase::m_parent
MythPlayer * m_parent
Definition: decoderbase.h:287
DecoderBase::SavePositionMapDelta
uint64_t SavePositionMapDelta(long long first_frame, long long last_frame)
Definition: decoderbase.cpp:500
MarkTypes
MarkTypes
Definition: programtypes.h:47
StreamInfo::m_stream_id
int m_stream_id
Definition: decoderbase.h:99
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
kDecodeNothing
@ kDecodeNothing
Definition: decoderbase.h:49
DecoderBase::m_livetv
bool m_livetv
Definition: decoderbase.h:333
EofState
EofState
Definition: decoderbase.h:67
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:118
DecoderBase::ResetTracks
void ResetTracks(void)
Definition: decoderbase.cpp:1204
DecoderBase::IsErrored
bool IsErrored() const
Definition: decoderbase.h:225
DecoderBase::m_hasFullPositionMap
bool m_hasFullPositionMap
Definition: decoderbase.h:320
MythMediaBuffer
Definition: mythmediabuffer.h:59
DecoderBase::GetMythCodecContext
MythCodecContext * GetMythCodecContext(void)
Definition: decoderbase.h:263
DecoderBase::m_videoDisplayProfile
MythVideoProfile m_videoDisplayProfile
Definition: decoderbase.h:361
DecoderBase::ChangeTrack
int ChangeTrack(uint Type, int Dir)
Definition: decoderbase.cpp:1001
DecoderBase::m_trackLock
QRecursiveMutex m_trackLock
Definition: decoderbase.h:350
DecoderBase::SetAudioByComponentTag
virtual bool SetAudioByComponentTag(int)
Definition: decoderbase.h:255
DecoderBase::m_positionMapType
MarkTypes m_positionMapType
Definition: decoderbase.h:323
MythPlayer
Definition: mythplayer.h:83
DecoderBase::m_posmapStarted
bool m_posmapStarted
Definition: decoderbase.h:322
kAudioTypeCommentary
@ kAudioTypeCommentary
Definition: decoderbase.h:62
DecoderBase::GetVideoCodecID
virtual MythCodecID GetVideoCodecID(void) const =0
DecoderBase::m_exitAfterDecoded
bool m_exitAfterDecoded
Definition: decoderbase.h:317
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:327
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:352
DecoderBase::m_dontSyncPositionMap
bool m_dontSyncPositionMap
Definition: decoderbase.h:332
DecoderBase::TranslatePositionMsToFrame
uint64_t TranslatePositionMsToFrame(std::chrono::milliseconds dur_ms, float fallback_framerate, const frm_dir_map_t &cutlist)
Definition: decoderbase.cpp:1392
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:353
MythVideoProfile
Definition: mythvideoprofile.h:83
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
DecoderBase::m_errored
bool m_errored
Definition: decoderbase.h:341
DecoderBase::GetChapterTimes
virtual void GetChapterTimes(QList< std::chrono::seconds > &)
Definition: decoderbase.h:156
DecoderBase::GetTrackDesc
virtual QString GetTrackDesc(uint Type, uint TrackNo)
Definition: decoderbase.cpp:939
DecoderBase::SaveTotalDuration
void SaveTotalDuration(void)
Definition: decoderbase.cpp:1294
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
kEofStateNone
@ kEofStateNone
Definition: decoderbase.h:69
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:1416
DecoderBase::ForceSetupAudioStream
virtual void ForceSetupAudioStream(void)
Definition: decoderbase.h:147
programinfo.h
DecoderBase::m_keyframeDist
int m_keyframeDist
Definition: decoderbase.h:304
DecoderBase::m_getRawFrames
bool m_getRawFrames
Definition: decoderbase.h:338
DecoderBase::GetRawVideoState
virtual bool GetRawVideoState(void) const
Definition: decoderbase.h:194
DecoderBase::GetTrackInfo
StreamInfo GetTrackInfo(uint Type, uint TrackNo)
Definition: decoderbase.cpp:990
StreamInfo
Definition: decoderbase.h:74
DecoderBase::m_languagePreference
std::vector< int > m_languagePreference
language preferences for auto-selection of streams
Definition: decoderbase.h:359
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
kTrackTypeTextSubtitle
@ kTrackTypeTextSubtitle
Definition: decoderbase.h:42
DecoderBase::IsLastFrameKey
virtual bool IsLastFrameKey(void) const =0
DecoderBase::m_audio
AudioPlayer * m_audio
Definition: decoderbase.h:289
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:1465
DecoderBase::m_positionMap
std::vector< PosMapEntry > m_positionMap
Definition: decoderbase.h:326
kDecodeAV
@ kDecodeAV
Definition: decoderbase.h:52
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
kTrackTypeTeletextMenu
@ kTrackTypeTeletextMenu
Definition: decoderbase.h:35
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:1364
DecoderBase::SetEof
virtual void SetEof(bool eof)
Definition: decoderbase.h:132
mythcodecid.h
kDecodeVideo
@ kDecodeVideo
Definition: decoderbase.h:50
kTrackTypeCC608
@ kTrackTypeCC608
Definition: decoderbase.h:32
DecoderBase::m_getRawVideo
bool m_getRawVideo
Definition: decoderbase.h:339
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:328
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:288
DecoderBase::m_totalDuration
AVRational m_totalDuration
Definition: decoderbase.h:303
mythvideoprofile.h
DecoderBase::PosMapEntry::index
long long index
Definition: decoderbase.h:281
DecoderBase::SetFramesPlayed
void SetFramesPlayed(long long newValue)
Definition: decoderbase.h:205
DecoderBase::GetPositionMapSize
unsigned long GetPositionMapSize(void) const
Definition: decoderbase.cpp:294
uint
unsigned int uint
Definition: compat.h:81
DecoderBase::AutoSelectTracks
void AutoSelectTracks(void)
Definition: decoderbase.cpp:1198
kAudioTypeCleanEffects
@ kAudioTypeCleanEffects
Definition: decoderbase.h:59
DecoderBase::FileChanged
void FileChanged(void)
Definition: decoderbase.cpp:881
DecoderBase::m_wantedTrack
std::array< StreamInfo, kTrackTypeCount > m_wantedTrack
Definition: decoderbase.h:354
DecoderBase::m_transcoding
bool m_transcoding
Definition: decoderbase.h:318
DecoderBase::m_waitingForChange
bool m_waitingForChange
Definition: decoderbase.h:343
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
kAudioTypeHearingImpaired
@ kAudioTypeHearingImpaired
Definition: decoderbase.h:60
MARK_UNSET
@ MARK_UNSET
Definition: programtypes.h:50
DecoderBase::m_justAfterChange
bool m_justAfterChange
Definition: decoderbase.h:344
DecoderBase::GetSubHeader
virtual QByteArray GetSubHeader(uint)
Definition: decoderbase.h:250
DecoderBase::m_currentAspect
float m_currentAspect
Definition: decoderbase.h:298
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:45
DecoderBase::m_fpsMultiplier
int m_fpsMultiplier
Definition: decoderbase.h:293
DecoderBase::SetSeekSnap
void SetSeekSnap(uint64_t snap)
Definition: decoderbase.h:137
DecoderBase::SetProgramInfo
void SetProgramInfo(const ProgramInfo &pginfo)
Definition: decoderbase.cpp:42
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::m_selectedForcedTrack
std::array< StreamInfo, kTrackTypeCount > m_selectedForcedTrack
Definition: decoderbase.h:356
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
kTrackTypeCount
@ kTrackTypeCount
Definition: decoderbase.h:38
DecoderBase::UpdateFramesPlayed
virtual void UpdateFramesPlayed(void)
Definition: decoderbase.cpp:876
DecoderBase::m_currentHeight
int m_currentHeight
Definition: decoderbase.h:297
Buffer
Definition: MythExternControl.h:36
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
DecoderBase::SetDecodeAllSubtitles
void SetDecodeAllSubtitles(bool DecodeAll)
Definition: decoderbase.cpp:915
kEofStateDelayed
@ kEofStateDelayed
Definition: decoderbase.h:70
DecoderBase::m_framesPlayed
long long m_framesPlayed
Definition: decoderbase.h:300
MythVideoFrame::kDefaultRenderFormats
static const VideoFrameTypes kDefaultRenderFormats
Definition: mythframe.h:91
DecoderBase::m_mythCodecCtx
MythCodecContext * m_mythCodecCtx
Definition: decoderbase.h:360
DecoderBase::m_positionMapLock
QRecursiveMutex m_positionMapLock
Definition: decoderbase.h:325
DecoderBase::PosMapEntry::pos
long long pos
Definition: decoderbase.h:283
DecoderBase::SetRenderFormats
void SetRenderFormats(const VideoFrameTypes *RenderFormats)
Definition: decoderbase.cpp:36
kTrackTypeVideo
@ kTrackTypeVideo
Definition: decoderbase.h:30
DecoderBase::m_decodeAllSubtitles
bool m_decodeAllSubtitles
Definition: decoderbase.h:351
StreamInfo::m_language
int m_language
ISO639 canonical language key.
Definition: decoderbase.h:97
DecoderBase::m_watchingRecording
bool m_watchingRecording
Definition: decoderbase.h:334
mythavutil.h
DecoderBase::BestTrack
int BestTrack(uint Type, bool forcedPreferred, int preferredLanguage=0)
Determine the best track according to weights.
Definition: decoderbase.cpp:1064
kTrackTypeTeletextCaptions
@ kTrackTypeTeletextCaptions
Definition: decoderbase.h:34
mythcontext.h
DecoderBase::TranslatePosition
static uint64_t TranslatePosition(const frm_pos_map_t &map, long long key, float fallback_ratio)
Definition: decoderbase.cpp:1313
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:308
StreamInfo::operator<
bool operator<(const StreamInfo &b) const
Definition: decoderbase.h:106
MythAVCopy
Definition: mythavutil.h:42
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
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:1501
kTrackTypeAudio
@ kTrackTypeAudio
Definition: decoderbase.h:29
DecoderBase::m_lastKey
long long m_lastKey
Definition: decoderbase.h:305
kTrackTypeRawText
@ kTrackTypeRawText
Definition: decoderbase.h:36
snap
static float snap(float value, float snapto, float diff)
Definition: mythvideobounds.cpp:929
MythCodecContext
Definition: mythcodeccontext.h:52
DecoderBase::OpenFile
virtual int OpenFile(MythMediaBuffer *Buffer, bool novideo, TestBufferVec &testbuf)=0
toString
QString toString(TrackType type)
Definition: decoderbase.cpp:1210
DecoderBase::m_trackTotalDuration
bool m_trackTotalDuration
Definition: decoderbase.h:315
kAudioTypeSpokenSubs
@ kAudioTypeSpokenSubs
Definition: decoderbase.h:61
DecoderBase::m_framesRead
long long m_framesRead
Definition: decoderbase.h:301
TrackType
TrackType
Track types.
Definition: decoderbase.h:26
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:307
StreamInfo::StreamInfo
StreamInfo()=default
kAudioTypeAudioDescription
@ kAudioTypeAudioDescription
Definition: decoderbase.h:58
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:294
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:1028
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
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:321
DecoderBase::GetTrackLanguageIndex
virtual int GetTrackLanguageIndex(uint Type, uint TrackNo)
Definition: decoderbase.cpp:931
DecoderBase::SaveTotalFrames
void SaveTotalFrames(void)
Definition: decoderbase.cpp:1302
DecoderBase::m_frameCounter
uint64_t m_frameCounter
Definition: decoderbase.h:302