MythTV  master
avformatdecoder.h
Go to the documentation of this file.
1 
2 #ifndef AVFORMATDECODER_H_
3 #define AVFORMATDECODER_H_
4 
5 #include <cstdint>
6 
7 extern "C" {
8 #include "libavcodec/avcodec.h"
9 #include "libavformat/avformat.h"
10 }
11 
12 #include <QString>
13 #include <QMap>
14 #include <QList>
15 
16 #include "programinfo.h"
17 #include "format.h"
18 #include "decoderbase.h"
19 #include "audiooutputsettings.h"
20 #include "audiooutpututil.h"
21 #include "spdifencoder.h"
22 #include "vbilut.h"
23 #include "AVCParser.h"
24 #include "mythcodeccontext.h"
25 #include "mythplayer.h"
26 #include "io/mythavformatbuffer.h"
27 
28 class TeletextDecoder;
29 class CC608Decoder;
30 class CC708Decoder;
31 class SubtitleReader;
32 class InteractiveTV;
33 class MythSqlDatabase;
34 
35 struct SwsContext;
36 
37 extern "C" void HandleStreamChange(void *data);
38 
39 using CC608Parity = std::array<int,256>;
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(ff_codec_id_string(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 
258 
259  AVCParser *m_avcParser {nullptr};
260 
261  AVFormatContext *m_ic {nullptr};
263 
264  // AVFormatParameters params;
265 
266  URLContext m_readContext {};
267 
268  int m_frameDecoded {0};
271 
272  struct SwsContext *m_swsCtx {nullptr};
273  bool m_directRendering {false};
274 
275  bool m_noDtsHack {false};
276  bool m_doRewind {false};
277 
278  bool m_gopSet {false};
280  bool m_seenGop {false};
282  int m_seqCount {0};
283 
284  QList<AVPacket*> m_storedPackets;
285 
286  int m_prevGopPos {0};
287 
288  // GetFrame
289  bool m_gotVideoFrame {false};
290  bool m_hasVideo {false};
292  bool m_skipAudio {false};
293  bool m_allowedQuit {false};
294 
295  uint32_t m_startCodeState {0xffffffff};
296 
297  std::chrono::milliseconds m_lastVPts {0ms};
298  std::chrono::milliseconds m_lastAPts {0ms};
299  std::chrono::microseconds m_lastCcPtsu {0ms};
300  std::chrono::milliseconds m_firstVPts {0ms};
301  bool m_firstVPtsInuse {false};
302 
303  int64_t m_faultyPts {0};
304  int64_t m_faultyDts {0};
307  bool m_ptsDetected {false};
309  bool m_ptsSelected {true};
310  // set use_frame_timing true to utilize the pts values in returned
311  // frames. Set fale to use deprecated method.
312  bool m_useFrameTiming {false};
313 
314  bool m_forceDtsTimestamps {false};
315 
318 
320  int m_averrorCount {0};
321 
322  // Caption/Subtitle/Teletext decoders
326  CC608Decoder *m_ccd608 {nullptr};
327  CC708Decoder *m_ccd708 {nullptr};
328  TeletextDecoder *m_ttd {nullptr};
333  std::array<bool,68> m_ccX08InPmt {};
337  std::array<bool,68> m_ccX08InTracks {};
339  QList<StreamInfo> m_pmtTracks;
341  QList<TrackType> m_pmtTrackTypes;
344  QList<StreamInfo> m_streamTracks;
347  QList<TrackType> m_streamTrackTypes;
348 
350  InteractiveTV *m_itv {nullptr};
351 
352  // Audio
353  uint8_t *m_audioSamples {nullptr};
354  bool m_disablePassthru {false};
355 
358 
359  bool m_processFrames {true};
360 
361  bool m_streamsChanged { false };
362  bool m_resetHardwareDecoders { false };
363 
364  // Value in milliseconds, from setting AudioReadAhead
365  std::chrono::milliseconds m_audioReadAhead {100ms};
366 
367 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
368  QMutex m_avCodecLock { QMutex::Recursive };
369 #else
370  QRecursiveMutex m_avCodecLock;
371 #endif
372 };
373 
374 #endif
375 
376 /* 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:2770
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4124
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:26
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:29
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:305
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:114
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5207
AvFormatDecoder::m_noDtsHack
bool m_noDtsHack
Definition: avformatdecoder.h:275
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:5439
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< std::chrono::seconds > &times) override
Definition: avformatdecoder.cpp:508
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4112
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:276
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:525
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:57
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:922
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:292
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4384
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:289
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2576
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:325
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:284
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:842
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4223
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:350
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:72
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:319
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2748
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::NormalizeVideoTimecode
std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override
Definition: avformatdecoder.cpp:445
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5240
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4237
CC608Decoder
Definition: cc608decoder.h:53
TeletextDecoder
Definition: teletextdecoder.h:8
format.h
AudioOutputSettings::FormatToBits
static int FormatToBits(AudioFormat format)
Definition: audiooutputsettings.cpp:149
AVCParser::use_I_forKeyframes
void use_I_forKeyframes(bool val)
Definition: AVCParser.h:117
AvFormatDecoder::SetIdrOnlyKeyframes
void SetIdrOnlyKeyframes(bool value) override
Definition: avformatdecoder.h:156
AvFormatDecoder::m_faultyPts
int64_t m_faultyPts
Definition: avformatdecoder.h:303
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:337
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:353
SubtitleReader
Definition: subtitlereader.h:33
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4201
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:280
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:29
PlayerFlags
PlayerFlags
Definition: mythplayer.h:65
MythPlayer
Definition: mythplayer.h:86
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:698
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:549
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:266
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:935
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1686
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:323
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4211
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:316
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:344
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:407
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:64
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:293
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:402
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2639
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:361
AvFormatDecoder::m_firstVPts
std::chrono::milliseconds m_firstVPts
Definition: avformatdecoder.h:300
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:854
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5215
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:964
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:270
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:273
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:359
AvFormatDecoder::m_decodedVideoFrame
MythVideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:269
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:307
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1449
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:900
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:3350
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *Packet)
Definition: avformatdecoder.cpp:4054
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:327
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5133
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4250
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:339
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3409
AvFormatDecoder::m_lastVPts
std::chrono::milliseconds m_lastVPts
Definition: avformatdecoder.h:297
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3944
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:261
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2609
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5177
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
AvFormatDecoder::m_cc608ParityTable
CC608Parity m_cc608ParityTable
Definition: avformatdecoder.h:329
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:82
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3581
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:565
MythCodecMap
Definition: mythavutil.h:26
uint
unsigned int uint
Definition: compat.h:144
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1484
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5143
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:308
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2592
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
CC608Parity
std::array< int, 256 > CC608Parity
Definition: avformatdecoder.h:39
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4079
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:309
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4623
AvFormatDecoder::m_lastAPts
std::chrono::milliseconds m_lastAPts
Definition: avformatdecoder.h:298
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:306
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:282
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:317
AudioInfo
Definition: avformatdecoder.h:41
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:286
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3815
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:257
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:922
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:365
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:356
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2644
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:61
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3982
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:320
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1889
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:290
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:1912
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:291
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5234
AvFormatDecoder::m_lastCcPtsu
std::chrono::microseconds m_lastCcPtsu
Definition: avformatdecoder.h:299
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:579
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:304
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:3022
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:314
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4206
AvFormatDecoder::m_avCodecLock
QRecursiveMutex m_avCodecLock
Definition: avformatdecoder.h:370
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:56
AudioOutputSettings
Definition: audiooutputsettings.h:49
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:62
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2581
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:357
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2602
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:259
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:362
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2953
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:347
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:249
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:5202
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:873
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4270
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:301
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:262
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:2859
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:278
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5151
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:324
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:341
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3901
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5287
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:501
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:272
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:4308
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1832
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:354
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:338
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1296
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2547
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:370
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:421
MythVideoFrame
Definition: mythframe.h:88
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:328
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:3242
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:2689
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:25
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:3142
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:312
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4840
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:333
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:2586
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:268
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1975
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1765
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:326
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5260
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2884
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:295