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 
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([[maybe_unused]] MythMediaBuffer *Buffer,
118  [[maybe_unused]] bool storevid,
119  [[maybe_unused]] std::chrono::milliseconds timecodeOffset) override {} // DecoderBase
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_doRewind {false};
278 
279  bool m_gopSet {false};
281  bool m_seenGop {false};
283  int m_seqCount {0};
284 
285  QList<AVPacket*> m_storedPackets;
286 
287  int m_prevGopPos {0};
288 
289  // GetFrame
290  bool m_gotVideoFrame {false};
291  bool m_hasVideo {false};
293  bool m_skipAudio {false};
294  bool m_allowedQuit {false};
295 
296  uint32_t m_startCodeState {0xffffffff};
297 
298  std::chrono::milliseconds m_lastVPts {0ms};
299  std::chrono::milliseconds m_lastAPts {0ms};
300  std::chrono::microseconds m_lastCcPtsu {0ms};
301  std::chrono::milliseconds m_firstVPts {0ms};
302  bool m_firstVPtsInuse {false};
303 
304  int64_t m_faultyPts {0};
305  int64_t m_faultyDts {0};
308  bool m_ptsDetected {false};
310  bool m_ptsSelected {true};
311  // set use_frame_timing true to utilize the pts values in returned
312  // frames. Set fale to use deprecated method.
313  bool m_useFrameTiming {false};
314 
315  bool m_forceDtsTimestamps {false};
316 
319 
321  int m_averrorCount {0};
322 
323  // Caption/Subtitle/Teletext decoders
327  CC608Decoder *m_ccd608 {nullptr};
328  CC708Decoder *m_ccd708 {nullptr};
329  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  QRecursiveMutex m_avCodecLock;
368 };
369 
370 #endif
371 
372 /* 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:2678
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4060
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:306
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:114
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5152
AudioInfo::m_codecProfile
int m_codecProfile
Definition: avformatdecoder.h:60
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:5384
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< std::chrono::seconds > &times) override
Definition: avformatdecoder.cpp:535
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4048
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:277
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:552
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:57
DecodeType
DecodeType
Definition: decoderbase.h:47
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:886
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:293
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4322
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:290
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2495
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:326
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:285
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:806
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4161
AvFormatDecoder::WriteStoredData
void WriteStoredData([[maybe_unused]] MythMediaBuffer *Buffer, [[maybe_unused]] bool storevid, [[maybe_unused]] std::chrono::milliseconds timecodeOffset) override
This is a No-op for this class.
Definition: avformatdecoder.h:117
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:320
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2654
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::NormalizeVideoTimecode
std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override
Definition: avformatdecoder.cpp:472
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5185
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4175
CC608Decoder
Definition: cc608decoder.h:49
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:304
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:42
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4139
MythMediaBuffer
Definition: mythmediabuffer.h:59
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::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:281
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:29
PlayerFlags
PlayerFlags
Definition: mythplayer.h:64
MythPlayer
Definition: mythplayer.h:83
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:674
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:576
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:268
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:899
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1592
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:324
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4149
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:317
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:438
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:64
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:15
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:294
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:433
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2558
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:361
AvFormatDecoder::m_firstVPts
std::chrono::milliseconds m_firstVPts
Definition: avformatdecoder.h:301
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:818
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5160
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:928
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:272
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:275
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:271
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:97
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:308
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1370
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:25
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:864
AudioInfo::m_sampleRate
int m_sampleRate
Definition: avformatdecoder.h:58
AvFormatDecoder::PreProcessVideoPacket
bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3266
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *Packet)
Definition: avformatdecoder.cpp:3996
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:328
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5072
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4188
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:3325
AvFormatDecoder::m_lastVPts
std::chrono::milliseconds m_lastVPts
Definition: avformatdecoder.h:298
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3874
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:2528
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5122
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:3497
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:592
MythCodecMap
Definition: mythavutil.h:25
uint
unsigned int uint
Definition: compat.h:81
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1404
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5083
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:309
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2511
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4017
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:310
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4561
AvFormatDecoder::m_lastAPts
std::chrono::milliseconds m_lastAPts
Definition: avformatdecoder.h:299
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:307
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:283
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:318
AudioInfo
Definition: avformatdecoder.h:41
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:287
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3733
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:259
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:886
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
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:356
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2563
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:61
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3912
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:321
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1805
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:291
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:1828
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:292
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5179
AvFormatDecoder::m_lastCcPtsu
std::chrono::microseconds m_lastCcPtsu
Definition: avformatdecoder.h:300
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:606
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:305
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2938
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:315
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4144
AvFormatDecoder::m_avCodecLock
QRecursiveMutex m_avCodecLock
Definition: avformatdecoder.h:367
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:2500
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:2521
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:261
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:362
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2869
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:5147
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:24
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:837
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4208
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:302
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:2775
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:279
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5091
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:325
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:3817
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5235
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:528
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:4246
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1743
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:354
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:372
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1252
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2466
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:402
TrackType
TrackType
Track types.
Definition: decoderbase.h:26
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:452
MythVideoFrame
Definition: mythframe.h:88
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:329
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:3158
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:2595
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:3058
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:313
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4777
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:2505
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:1896
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1676
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:327
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5208
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2800
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:296