MythTV  master
avformatdecoder.h
Go to the documentation of this file.
1 
2 #ifndef AVFORMATDECODER_H_
3 #define AVFORMATDECODER_H_
4 
5 #include <array>
6 #include <cstdint>
7 
8 extern "C" {
9 #include "libavcodec/avcodec.h"
10 #include "libavformat/avformat.h"
11 }
12 
13 #include <QList>
14 #include <QMap>
15 #include <QString>
16 
20 #include "libmyth/programinfo.h"
21 
22 #include "captions/vbilut.h"
23 #include "decoderbase.h"
24 #include "format.h"
25 #include "io/mythavformatbuffer.h"
26 #include "mpeg/AVCParser.h"
27 #include "mythcodeccontext.h"
28 #include "mythplayer.h"
29 
30 class TeletextDecoder;
31 class CC608Decoder;
32 class CC708Decoder;
33 class SubtitleReader;
34 class InteractiveTV;
35 class MythSqlDatabase;
36 
37 struct SwsContext;
38 
39 extern "C" void HandleStreamChange(void *data);
40 
41 class AudioInfo
42 {
43  public:
44  AudioInfo() = default;
45 
46  AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru,
47  int original_ch, int profile = 0) :
48  m_codecId(id), format(fmt),
49  m_sampleSize(ch * AudioOutputSettings::SampleSize(fmt)),
51  m_doPassthru(passthru), m_originalChannels(original_ch)
52  {
53  }
54 
55  AVCodecID m_codecId {AV_CODEC_ID_NONE};
57  int m_sampleSize {-2};
58  int m_sampleRate {-1};
59  int m_channels {-1};
60  int m_codecProfile {0};
61  bool m_doPassthru {false};
63 
64  bool operator==(const AudioInfo &o) const
65  {
66  return (m_codecId==o.m_codecId && m_channels==o.m_channels &&
71  }
72  QString toString() const
73  {
74  return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)")
75  .arg(avcodec_get_name(m_codecId),4).arg(m_sampleRate,6)
77  .arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile);
78  }
79 };
80 
83 {
84  friend void HandleStreamChange(void *data);
85 
86  public:
87  AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo,
88  PlayerFlags flags);
89  ~AvFormatDecoder() override;
90 
91  // Deleted functions should be public.
92  AvFormatDecoder(const AvFormatDecoder &) = delete; // not copyable
93  AvFormatDecoder &operator=(const AvFormatDecoder &) = delete; // not copyable
94 
95  void SetEof(bool eof) override; // DecoderBase
96 
97  MythCodecMap* CodecMap(void);
98  void CloseCodecs();
99  void CloseContext();
100  void Reset(bool reset_video_data, bool seek_reset,
101  bool reset_file) override; // DecoderBase
102 
105  static bool CanHandle(TestBufferVec & testbuf,
106  const QString &filename);
107 
109  int OpenFile(MythMediaBuffer *Buffer, bool novideo,
110  TestBufferVec & testbuf) override; // DecoderBase
111 
112  bool GetFrame(DecodeType Type, bool &Retry) override; // DecoderBase
113 
114  bool IsLastFrameKey(void) const override { return false; } // DecoderBase
115 
117  void WriteStoredData(MythMediaBuffer *Buffer, bool storevid,
118  std::chrono::milliseconds timecodeOffset) override // DecoderBase
119  { (void)Buffer; (void)storevid; (void)timecodeOffset;}
120 
122  void SetRawAudioState(bool state) override { (void)state; } // DecoderBase
123 
125  bool GetRawAudioState(void) const override { return false; } // DecoderBase
126 
128  void SetRawVideoState(bool state) override { (void)state; } // DecoderBase
129 
131  bool GetRawVideoState(void) const override { return false; } // DecoderBase
132 
134  long UpdateStoredFrameNum(long frame) override { (void)frame; return 0;} // DecoderBase
135 
136  QString GetCodecDecoderName(void) const override; // DecoderBase
137  QString GetRawEncodingType(void) override; // DecoderBase
138  MythCodecID GetVideoCodecID(void) const override { return m_videoCodecId; } // DecoderBase
139 
140  void SetDisablePassThrough(bool disable) override; // DecoderBase
141  void ForceSetupAudioStream(void) override; // DecoderBase
142  void AddTextData(unsigned char *buf, int len, int64_t timecode, char type);
143 
144  QString GetTrackDesc(uint Type, uint TrackNo) override;
145  int SetTrack(uint Type, int TrackNo) override;
146 
147  int ScanStreams(bool novideo);
148  int FindStreamInfo(void);
149 
150  int GetNumChapters() override; // DecoderBase
151  void GetChapterTimes(QList<std::chrono::seconds> &times) override; // DecoderBase
152  int GetCurrentChapter(long long framesPlayed) override; // DecoderBase
153  long long GetChapter(int chapter) override; // DecoderBase
154  bool DoRewind(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
155  bool DoFastForward(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
156  void SetIdrOnlyKeyframes(bool value) override // DecoderBase
157  { m_avcParser->use_I_forKeyframes(!value); }
158 
159  std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override; // DecoderBase
160  virtual std::chrono::milliseconds NormalizeVideoTimecode(AVStream *st, std::chrono::milliseconds timecode);
161 
162  int GetTeletextDecoderType(void) const override; // DecoderBase
163 
164  QString GetXDS(const QString &Key) const override; // DecoderBase
165  QByteArray GetSubHeader(uint TrackNo) override;
166  void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override; // DecoderBase
167 
168  // MHEG stuff
169  bool SetAudioByComponentTag(int Tag) override; // DecoderBase
170  bool SetVideoByComponentTag(int Tag) override; // DecoderBase
171 
172  // Stream language info
173  virtual int GetTeletextLanguage(uint Index);
174  virtual int GetSubtitleLanguage(uint /*unused*/, uint StreamIndex);
175  virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum);
176  virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex);
177  virtual AudioTrackType GetAudioTrackType(uint StreamIndex);
178 
179  static int GetMaxReferenceFrames(AVCodecContext *Context);
180 
181  protected:
182  int AutoSelectTrack(uint type) override; // DecoderBase
183  void ScanATSCCaptionStreams(int av_index);
184  void UpdateATSCCaptionTracks(void);
185  void UpdateCaptionTracksFromStreams(bool check_608, bool check_708);
186  void ScanTeletextCaptions(int av_index);
187  void ScanRawTextCaptions(int av_stream_index);
188  void ScanDSMCCStreams(void);
189  int AutoSelectAudioTrack(void);
190  int filter_max_ch(const AVFormatContext *ic,
191  const sinfo_vec_t &tracks,
192  const std::vector<int>&fs,
193  enum AVCodecID codecId = AV_CODEC_ID_NONE,
194  int profile = -1);
195 
196  friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic,
197  int flags);
198  friend int open_avf(URLContext *h, const char *filename, int flags);
199  friend int read_avf(URLContext *h, uint8_t *buf, int buf_size);
200  friend int write_avf(URLContext *h, uint8_t *buf, int buf_size);
201  friend int64_t seek_avf(URLContext *h, int64_t offset, int whence);
202  friend int close_avf(URLContext *h);
203 
204  void DecodeDTVCC(const uint8_t *buf, uint buf_size, bool scte);
205  void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte);
206  void InitByteContext(bool forceseek = false);
207  void InitVideoCodec(AVStream *stream, AVCodecContext *enc,
208  bool selectedStream = false);
209 
211  void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt);
212  int H264PreProcessPkt(AVStream *stream, AVPacket *pkt);
213  bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt);
214  virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry);
215  virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame);
216  bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt,
217  DecodeType decodetype);
218  bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt);
219  bool ProcessRawTextPacket(AVPacket* Packet);
220  virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt,
221  DecodeType decodetype);
222 
223  void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt);
224  void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt);
225  void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt);
226 
227  void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override; // DecoderBase
228 
229  inline bool DecoderWillDownmix(const AVCodecContext *ctx);
230  bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true);
231  bool SetupAudioStream(void);
232  void SetupAudioStreamSubIndexes(int streamIndex);
233  void RemoveAudioStreams();
234 
237  void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes);
238 
239  bool GenerateDummyVideoFrames(void);
240  bool HasVideo(const AVFormatContext *ic);
241  float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise = false);
242  static void av_update_stream_timings_video(AVFormatContext *ic);
243  bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec);
244 
245  void UpdateFramesPlayed(void) override; // DecoderBase
246  bool DoRewindSeek(long long desiredFrame) override; // DecoderBase
247  void DoFastForwardSeek(long long desiredFrame, bool &needflush) override; // DecoderBase
248  virtual void StreamChangeCheck(void);
249  virtual void PostProcessTracks(void) { }
250  virtual bool IsValidStream(int /*streamid*/) {return true;}
251 
252  int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size,
253  AVPacket *pkt);
254 
255  virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket);
256 
257  bool FlagIsSet(PlayerFlags arg) { return m_playerFlags & arg; }
258 
260 
261  AVCParser *m_avcParser {nullptr};
262 
263  AVFormatContext *m_ic {nullptr};
265 
266  // AVFormatParameters params;
267 
268  URLContext m_readContext {};
269 
270  int m_frameDecoded {0};
273 
274  struct SwsContext *m_swsCtx {nullptr};
275  bool m_directRendering {false};
276 
277  bool m_noDtsHack {false};
278  bool m_doRewind {false};
279 
280  bool m_gopSet {false};
282  bool m_seenGop {false};
284  int m_seqCount {0};
285 
286  QList<AVPacket*> m_storedPackets;
287 
288  int m_prevGopPos {0};
289 
290  // GetFrame
291  bool m_gotVideoFrame {false};
292  bool m_hasVideo {false};
294  bool m_skipAudio {false};
295  bool m_allowedQuit {false};
296 
297  uint32_t m_startCodeState {0xffffffff};
298 
299  std::chrono::milliseconds m_lastVPts {0ms};
300  std::chrono::milliseconds m_lastAPts {0ms};
301  std::chrono::microseconds m_lastCcPtsu {0ms};
302  std::chrono::milliseconds m_firstVPts {0ms};
303  bool m_firstVPtsInuse {false};
304 
305  int64_t m_faultyPts {0};
306  int64_t m_faultyDts {0};
309  bool m_ptsDetected {false};
311  bool m_ptsSelected {true};
312  // set use_frame_timing true to utilize the pts values in returned
313  // frames. Set fale to use deprecated method.
314  bool m_useFrameTiming {false};
315 
316  bool m_forceDtsTimestamps {false};
317 
320 
322  int m_averrorCount {0};
323 
324  // Caption/Subtitle/Teletext decoders
328  CC608Decoder *m_ccd608 {nullptr};
329  CC708Decoder *m_ccd708 {nullptr};
330  TeletextDecoder *m_ttd {nullptr};
334  std::array<bool,68> m_ccX08InPmt {};
338  std::array<bool,68> m_ccX08InTracks {};
340  QList<StreamInfo> m_pmtTracks;
342  QList<TrackType> m_pmtTrackTypes;
345  QList<StreamInfo> m_streamTracks;
348  QList<TrackType> m_streamTrackTypes;
349 
351  InteractiveTV *m_itv {nullptr};
352 
353  // Audio
354  uint8_t *m_audioSamples {nullptr};
355  bool m_disablePassthru {false};
356 
359 
360  bool m_processFrames {true};
361 
362  bool m_streamsChanged { false };
363  bool m_resetHardwareDecoders { false };
364 
365  // Value in milliseconds, from setting AudioReadAhead
366  std::chrono::milliseconds m_audioReadAhead {100ms};
367 
368 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
369  QMutex m_avCodecLock { QMutex::Recursive };
370 #else
371  QRecursiveMutex m_avCodecLock;
372 #endif
373 };
374 
375 #endif
376 
377 /* vim: set expandtab tabstop=4 shiftwidth=4: */
AvFormatDecoder::get_avf_buffer
friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic, int flags)
Definition: avformatdecoder.cpp:2745
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4099
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:25
AudioInfo::m_channels
int m_channels
Definition: avformatdecoder.h:59
AvFormatDecoder::open_avf
friend int open_avf(URLContext *h, const char *filename, int flags)
AVCParser
Definition: AVCParser.h:30
AvFormatDecoder::read_avf
friend int read_avf(URLContext *h, uint8_t *buf, int buf_size)
AvFormatDecoder::m_lastPtsForFaultDetection
int64_t m_lastPtsForFaultDetection
Definition: avformatdecoder.h:307
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:114
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5184
AvFormatDecoder::m_noDtsHack
bool m_noDtsHack
Definition: avformatdecoder.h:277
AudioInfo::m_codecProfile
int m_codecProfile
Definition: avformatdecoder.h:60
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
AudioInfo::m_codecId
AVCodecID m_codecId
Definition: avformatdecoder.h:55
AvFormatDecoder::av_update_stream_timings_video
static void av_update_stream_timings_video(AVFormatContext *ic)
Definition: avformatdecoder.cpp:5416
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< std::chrono::seconds > &times) override
Definition: avformatdecoder.cpp:530
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4087
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:278
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:547
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:57
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:943
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:294
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4361
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:291
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2564
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:327
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:286
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:863
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4200
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:351
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:72
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:321
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2723
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::NormalizeVideoTimecode
std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override
Definition: avformatdecoder.cpp:467
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5217
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4214
CC608Decoder
Definition: cc608decoder.h:53
TeletextDecoder
Definition: teletextdecoder.h:8
format.h
AudioOutputSettings::FormatToBits
static int FormatToBits(AudioFormat format)
Definition: audiooutputsettings.cpp:150
AVCParser::use_I_forKeyframes
void use_I_forKeyframes(bool val)
Definition: AVCParser.h:118
AvFormatDecoder::SetIdrOnlyKeyframes
void SetIdrOnlyKeyframes(bool value) override
Definition: avformatdecoder.h:156
AvFormatDecoder::m_faultyPts
int64_t m_faultyPts
Definition: avformatdecoder.h:305
AvFormatDecoder::m_ccX08InTracks
std::array< bool, 68 > m_ccX08InTracks
Lookup table for whether a stream is represented in the UI entries 0-3 correspond to CEA-608 CC1 thro...
Definition: avformatdecoder.h:338
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:354
SubtitleReader
Definition: subtitlereader.h:33
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4178
MythMediaBuffer
Definition: mythmediabuffer.h:50
AvFormatDecoder::SetRawAudioState
void SetRawAudioState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:122
AvFormatDecoder::IsValidStream
virtual bool IsValidStream(int)
Definition: avformatdecoder.h:250
AvFormatDecoder::WriteStoredData
void WriteStoredData(MythMediaBuffer *Buffer, bool storevid, std::chrono::milliseconds timecodeOffset) override
This is a No-op for this class.
Definition: avformatdecoder.h:117
TrackType
TrackType
Track types.
Definition: decoderbase.h:26
AvFormatDecoder::m_seenGop
bool m_seenGop
A flag to indicate that we've seen a GOP frame. Used in junction with seq_count.
Definition: avformatdecoder.h:282
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:29
PlayerFlags
PlayerFlags
Definition: mythplayer.h:65
MythPlayer
Definition: mythplayer.h:84
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:720
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:571
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:268
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:956
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1676
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:325
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4188
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:318
AvFormatDecoder::m_streamTracks
QList< StreamInfo > m_streamTracks
StreamInfo for 608 and 708 Captions seen in the caption stream itself but not seen in the PMT.
Definition: avformatdecoder.h:345
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:429
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:64
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:295
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:424
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2627
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:362
AvFormatDecoder::m_firstVPts
std::chrono::milliseconds m_firstVPts
Definition: avformatdecoder.h:302
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:875
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5192
AvFormatDecoder::OpenFile
int OpenFile(MythMediaBuffer *Buffer, bool novideo, TestBufferVec &testbuf) override
Open our file and set up or audio and video parameters.
Definition: avformatdecoder.cpp:985
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:272
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:275
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
programinfo.h
AvFormatDecoder::m_processFrames
bool m_processFrames
Definition: avformatdecoder.h:360
AvFormatDecoder::m_decodedVideoFrame
MythVideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:271
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:309
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1454
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:921
AudioInfo::m_sampleRate
int m_sampleRate
Definition: avformatdecoder.h:58
DecodeType
DecodeType
Definition: decoderbase.h:47
AvFormatDecoder::PreProcessVideoPacket
bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3325
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *Packet)
Definition: avformatdecoder.cpp:4029
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:329
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5110
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4227
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:340
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3384
AvFormatDecoder::m_lastVPts
std::chrono::milliseconds m_lastVPts
Definition: avformatdecoder.h:299
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3919
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:263
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2597
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5154
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:82
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3556
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:587
MythCodecMap
Definition: mythavutil.h:29
uint
unsigned int uint
Definition: compat.h:79
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1488
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5120
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:310
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2580
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4054
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:311
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4600
AvFormatDecoder::m_lastAPts
std::chrono::milliseconds m_lastAPts
Definition: avformatdecoder.h:300
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:308
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:284
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:319
AudioInfo
Definition: avformatdecoder.h:41
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:288
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3790
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:259
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:943
AvFormatDecoder::write_avf
friend int write_avf(URLContext *h, uint8_t *buf, int buf_size)
AvFormatDecoder::m_audioReadAhead
std::chrono::milliseconds m_audioReadAhead
Definition: avformatdecoder.h:366
AvFormatDecoder::FlagIsSet
bool FlagIsSet(PlayerFlags arg)
Definition: avformatdecoder.h:257
Buffer
Definition: MythExternControl.h:36
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
AvFormatDecoder::m_audioIn
AudioInfo m_audioIn
Definition: avformatdecoder.h:357
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2632
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:61
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3957
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:322
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1879
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:292
AvFormatDecoder::ScanDSMCCStreams
void ScanDSMCCStreams(void)
Check to see whether there is a Network Boot Ifo sub-descriptor in the PMT which requires the MHEG ap...
Definition: avformatdecoder.cpp:1902
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:293
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5211
AvFormatDecoder::m_lastCcPtsu
std::chrono::microseconds m_lastCcPtsu
Definition: avformatdecoder.h:301
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:601
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:306
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2997
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:316
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4183
AvFormatDecoder::m_avCodecLock
QRecursiveMutex m_avCodecLock
Definition: avformatdecoder.h:371
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:56
AudioOutputSettings
Definition: audiooutputsettings.h:48
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:62
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2569
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:358
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2590
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:261
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:363
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2928
AvFormatDecoder::m_streamTrackTypes
QList< TrackType > m_streamTrackTypes
TrackType (608 or 708) for Captions seen in the caption stream itself but not seen in the PMT.
Definition: avformatdecoder.h:348
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:249
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:5179
AvFormatDecoder::CanHandle
static bool CanHandle(TestBufferVec &testbuf, const QString &filename)
Perform an av_probe_input_format on the passed data to see if we can decode it with this class.
Definition: avformatdecoder.cpp:894
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4247
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:303
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:264
AvFormatDecoder::seek_avf
friend int64_t seek_avf(URLContext *h, int64_t offset, int whence)
AvFormatDecoder::AddTextData
void AddTextData(unsigned char *buf, int len, int64_t timecode, char type)
AvFormatDecoder::DecodeDTVCC
void DecodeDTVCC(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2834
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:280
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5128
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:326
AvFormatDecoder::GetVideoCodecID
MythCodecID GetVideoCodecID(void) const override
Definition: avformatdecoder.h:138
AvFormatDecoder::m_pmtTrackTypes
QList< TrackType > m_pmtTrackTypes
TrackType (608 or 708) for Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:342
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3876
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5264
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:523
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:274
AvFormatDecoder::filter_max_ch
int filter_max_ch(const AVFormatContext *ic, const sinfo_vec_t &tracks, const std::vector< int > &fs, enum AVCodecID codecId=AV_CODEC_ID_NONE, int profile=-1)
Definition: avformatdecoder.cpp:4285
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1822
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:355
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:363
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1309
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2535
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:393
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:443
MythVideoFrame
Definition: mythframe.h:88
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:330
AvFormatDecoder::GetRawAudioState
bool GetRawAudioState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:125
AvFormatDecoder::H264PreProcessPkt
int H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3217
AvFormatDecoder::UpdateStoredFrameNum
long UpdateStoredFrameNum(long frame) override
This is a No-op for this class.
Definition: avformatdecoder.h:134
InteractiveTV
This is the interface between an MHEG engine and a MythTV TV object.
Definition: interactivetv.h:15
AvFormatDecoder::SetupAudioStreamSubIndexes
void SetupAudioStreamSubIndexes(int streamIndex)
Reacts to DUAL/STEREO changes on the fly and fix streams.
Definition: avformatdecoder.cpp:2664
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:24
MythAVFormatBuffer
Definition: mythavformatbuffer.h:13
AvFormatDecoder::GetRawVideoState
bool GetRawVideoState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:131
AvFormatDecoder::MpegPreProcessPkt
void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
Preprocess a packet, setting the video parms if necessary.
Definition: avformatdecoder.cpp:3117
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:314
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4817
AvFormatDecoder::m_ccX08InPmt
std::array< bool, 68 > m_ccX08InPmt
Lookup table for whether a stream was seen in the PMT entries 0-3 correspond to CEA-608 CC1 through C...
Definition: avformatdecoder.h:334
build_compdb.filename
filename
Definition: build_compdb.py:21
AvFormatDecoder::DoFastForwardSeek
void DoFastForwardSeek(long long desiredFrame, bool &needflush) override
Seeks to the keyframe just before the desiredFrame if exact seeks is enabled, or the frame just after...
Definition: avformatdecoder.cpp:2574
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:270
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1965
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1755
AvFormatDecoder::DecodeAudio
int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size, AVPacket *pkt)
AudioInfo::AudioInfo
AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru, int original_ch, int profile=0)
Definition: avformatdecoder.h:46
DecoderBase
Definition: decoderbase.h:120
AvFormatDecoder::m_ccd608
CC608Decoder * m_ccd608
Definition: avformatdecoder.h:328
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5237
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2859
AvFormatDecoder::SetRawVideoState
void SetRawVideoState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:128
AvFormatDecoder::m_startCodeState
uint32_t m_startCodeState
Definition: avformatdecoder.h:297