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 #include <QString>
8 #include <QMap>
9 #include <QList>
10 
11 #include "programinfo.h"
12 #include "format.h"
13 #include "decoderbase.h"
14 #include "audiooutputsettings.h"
15 #include "audiooutpututil.h"
16 #include "spdifencoder.h"
17 #include "vbilut.h"
18 #include "AVCParser.h"
19 #include "videodisplayprofile.h"
20 #include "mythcodeccontext.h"
21 #include "mythplayer.h"
22 
23 extern "C" {
24 #include "mythframe.h"
25 #include "libavcodec/avcodec.h"
26 #include "libavformat/avformat.h"
27 }
28 
29 #include "io/mythavformatbuffer.h"
30 
31 class TeletextDecoder;
32 class CC608Decoder;
33 class CC708Decoder;
34 class SubtitleReader;
35 class InteractiveTV;
36 class ProgramInfo;
37 class MythSqlDatabase;
38 
39 struct SwsContext;
40 
41 extern "C" void HandleStreamChange(void *data);
42 
43 using CC608Parity = std::array<int,256>;
44 
45 class AudioInfo
46 {
47  public:
48  AudioInfo() = default;
49 
50  AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru,
51  int original_ch, int profile = 0) :
52  m_codecId(id), format(fmt),
53  m_sampleSize(ch * AudioOutputSettings::SampleSize(fmt)),
55  m_doPassthru(passthru), m_originalChannels(original_ch)
56  {
57  }
58 
59  AVCodecID m_codecId {AV_CODEC_ID_NONE};
61  int m_sampleSize {-2};
62  int m_sampleRate {-1};
63  int m_channels {-1};
64  int m_codecProfile {0};
65  bool m_doPassthru {false};
67 
68  bool operator==(const AudioInfo &o) const
69  {
70  return (m_codecId==o.m_codecId && m_channels==o.m_channels &&
75  }
76  QString toString() const
77  {
78  return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)")
79  .arg(ff_codec_id_string(m_codecId),4).arg(m_sampleRate,6)
81  .arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile);
82  }
83 };
84 
87 {
88  friend void HandleStreamChange(void *data);
89  public:
90  static void GetDecoders(RenderOptions &opts);
91  AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo,
92  PlayerFlags flags);
93  ~AvFormatDecoder() override;
94 
95  // Deleted functions should be public.
96  AvFormatDecoder(const AvFormatDecoder &) = delete; // not copyable
97  AvFormatDecoder &operator=(const AvFormatDecoder &) = delete; // not copyable
98 
99  void SetEof(bool eof) override; // DecoderBase
100 
101  MythCodecMap* CodecMap(void);
102  void CloseCodecs();
103  void CloseContext();
104  void Reset(bool reset_video_data, bool seek_reset,
105  bool reset_file) override; // DecoderBase
106 
109  static bool CanHandle(TestBufferVec & testbuf,
110  const QString &filename);
111 
113  int OpenFile(MythMediaBuffer *Buffer, bool novideo,
114  TestBufferVec & testbuf) override; // DecoderBase
115 
116  bool GetFrame(DecodeType Type, bool &Retry) override; // DecoderBase
117 
118  bool IsLastFrameKey(void) const override { return false; } // DecoderBase
119 
121  void WriteStoredData(MythMediaBuffer *Buffer, bool storevid,
122  long timecodeOffset) override // DecoderBase
123  { (void)Buffer; (void)storevid; (void)timecodeOffset;}
124 
126  void SetRawAudioState(bool state) override { (void)state; } // DecoderBase
127 
129  bool GetRawAudioState(void) const override { return false; } // DecoderBase
130 
132  void SetRawVideoState(bool state) override { (void)state; } // DecoderBase
133 
135  bool GetRawVideoState(void) const override { return false; } // DecoderBase
136 
138  long UpdateStoredFrameNum(long frame) override { (void)frame; return 0;} // DecoderBase
139 
140  QString GetCodecDecoderName(void) const override; // DecoderBase
141  QString GetRawEncodingType(void) override; // DecoderBase
142  MythCodecID GetVideoCodecID(void) const override { return m_videoCodecId; } // DecoderBase
143 
144  void SetDisablePassThrough(bool disable) override; // DecoderBase
145  void ForceSetupAudioStream(void) override; // DecoderBase
146  void AddTextData(unsigned char *buf, int len, int64_t timecode, char type);
147 
148  QString GetTrackDesc(uint Type, uint TrackNo) override;
149  int SetTrack(uint Type, int TrackNo) override;
150 
151  int ScanStreams(bool novideo);
152  int FindStreamInfo(void);
153 
154  int GetNumChapters() override; // DecoderBase
155  void GetChapterTimes(QList<long long> &times) override; // DecoderBase
156  int GetCurrentChapter(long long framesPlayed) override; // DecoderBase
157  long long GetChapter(int chapter) override; // DecoderBase
158  bool DoRewind(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
159  bool DoFastForward(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
160  void SetIdrOnlyKeyframes(bool value) override // DecoderBase
161  { m_avcParser->use_I_forKeyframes(!value); }
162 
163  int64_t NormalizeVideoTimecode(int64_t timecode) override; // DecoderBase
164  virtual int64_t NormalizeVideoTimecode(AVStream *st, int64_t timecode);
165 
166  int GetTeletextDecoderType(void) const override; // DecoderBase
167 
168  QString GetXDS(const QString &Key) const override; // DecoderBase
169  QByteArray GetSubHeader(uint TrackNo) override;
170  void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override; // DecoderBase
171 
172  // MHEG stuff
173  bool SetAudioByComponentTag(int Tag) override; // DecoderBase
174  bool SetVideoByComponentTag(int Tag) override; // DecoderBase
175 
176  // Stream language info
177  virtual int GetTeletextLanguage(uint Index);
178  virtual int GetSubtitleLanguage(uint /*unused*/, uint StreamIndex);
179  virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum);
180  virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex);
181  virtual AudioTrackType GetAudioTrackType(uint StreamIndex);
182 
183  static int GetMaxReferenceFrames(AVCodecContext *Context);
184 
185  protected:
186  int AutoSelectTrack(uint type) override; // DecoderBase
187  void ScanATSCCaptionStreams(int av_index);
188  void UpdateATSCCaptionTracks(void);
189  void UpdateCaptionTracksFromStreams(bool check_608, bool check_708);
190  void ScanTeletextCaptions(int av_index);
191  void ScanRawTextCaptions(int av_stream_index);
192  void ScanDSMCCStreams(void);
193  int AutoSelectAudioTrack(void);
194  int filter_max_ch(const AVFormatContext *ic,
195  const sinfo_vec_t &tracks,
196  const vector<int> &fs,
197  enum AVCodecID codecId = AV_CODEC_ID_NONE,
198  int profile = -1);
199 
200  friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic,
201  int flags);
202  friend int open_avf(URLContext *h, const char *filename, int flags);
203  friend int read_avf(URLContext *h, uint8_t *buf, int buf_size);
204  friend int write_avf(URLContext *h, uint8_t *buf, int buf_size);
205  friend int64_t seek_avf(URLContext *h, int64_t offset, int whence);
206  friend int close_avf(URLContext *h);
207 
208  void DecodeDTVCC(const uint8_t *buf, uint buf_size, bool scte);
209  void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte);
210  void InitByteContext(bool forceseek = false);
211  void InitVideoCodec(AVStream *stream, AVCodecContext *enc,
212  bool selectedStream = false);
213 
215  void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt);
216  int H264PreProcessPkt(AVStream *stream, AVPacket *pkt);
217  bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt);
218  virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry);
219  virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame);
220  bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt,
221  DecodeType decodetype);
222  bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt);
223  bool ProcessRawTextPacket(AVPacket *pkt);
224  virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt,
225  DecodeType decodetype);
226 
227  void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt);
228  void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt);
229  void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt);
230 
231  void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override; // DecoderBase
232 
233  inline bool DecoderWillDownmix(const AVCodecContext *ctx);
234  bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true);
235  bool SetupAudioStream(void);
236  void SetupAudioStreamSubIndexes(int streamIndex);
237  void RemoveAudioStreams();
238 
241  void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes);
242 
243  bool GenerateDummyVideoFrames(void);
244  bool HasVideo(const AVFormatContext *ic);
245  float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise = false);
246  static void av_update_stream_timings_video(AVFormatContext *ic);
247  bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec);
248 
249  void UpdateFramesPlayed(void) override; // DecoderBase
250  bool DoRewindSeek(long long desiredFrame) override; // DecoderBase
251  void DoFastForwardSeek(long long desiredFrame, bool &needflush) override; // DecoderBase
252  virtual void StreamChangeCheck(void);
253  virtual void PostProcessTracks(void) { }
254  virtual bool IsValidStream(int /*streamid*/) {return true;}
255 
256  int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size,
257  AVPacket *pkt);
258 
259  virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket);
260 
262 
263  AVCParser *m_avcParser {nullptr};
264 
265  AVFormatContext *m_ic {nullptr};
267 
268  // AVFormatParameters params;
269 
270  URLContext m_readContext {};
271 
272  int m_frameDecoded {0};
275 
276  struct SwsContext *m_swsCtx {nullptr};
277  bool m_directRendering {false};
278 
279  bool m_noDtsHack {false};
280  bool m_doRewind {false};
281 
282  bool m_gopSet {false};
284  bool m_seenGop {false};
286  int m_seqCount {0};
287 
288  QList<AVPacket*> m_storedPackets;
289 
290  int m_prevGopPos {0};
291 
292  // GetFrame
293  bool m_gotVideoFrame {false};
294  bool m_hasVideo {false};
296  bool m_skipAudio {false};
297  bool m_allowedQuit {false};
298 
299  uint32_t m_startCodeState {0xffffffff};
300 
301  long long m_lastVPts {0};
302  long long m_lastAPts {0};
303  long long m_lastCcPtsu {0};
304  long long m_firstVPts {0};
305  bool m_firstVPtsInuse {false};
306 
307  int64_t m_faultyPts {0};
308  int64_t m_faultyDts {0};
311  bool m_ptsDetected {false};
313  bool m_ptsSelected {true};
314  // set use_frame_timing true to utilize the pts values in returned
315  // frames. Set fale to use deprecated method.
316  bool m_useFrameTiming {false};
317 
318  bool m_forceDtsTimestamps {false};
319 
322 
324  int m_averrorCount {0};
325 
326  // Caption/Subtitle/Teletext decoders
330  CC608Decoder *m_ccd608 {nullptr};
331  CC708Decoder *m_ccd708 {nullptr};
332  TeletextDecoder *m_ttd {nullptr};
337  std::array<bool,68> m_ccX08InPmt {};
341  std::array<bool,68> m_ccX08InTracks {};
343  QList<StreamInfo> m_pmtTracks;
345  QList<TrackType> m_pmtTrackTypes;
348  QList<StreamInfo> m_streamTracks;
351  QList<TrackType> m_streamTrackTypes;
352 
354  InteractiveTV *m_itv {nullptr};
355 
356  // Audio
357  uint8_t *m_audioSamples {nullptr};
358  bool m_disablePassthru {false};
359 
362 
363  bool m_processFrames {true};
364 
365  bool m_streamsChanged { false };
366  bool m_resetHardwareDecoders { false };
367 
368  // Value in milliseconds, from setting AudioReadAhead
369  int m_audioReadAhead {100};
370 
371  QMutex m_avCodecLock { QMutex::Recursive };
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:2740
AvFormatDecoder::m_lastAPts
long long m_lastAPts
Definition: avformatdecoder.h:302
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4088
AvFormatDecoder::WriteStoredData
void WriteStoredData(MythMediaBuffer *Buffer, bool storevid, long timecodeOffset) override
This is a No-op for this class.
Definition: avformatdecoder.h:121
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< long long > &times) override
Definition: avformatdecoder.cpp:484
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:26
AudioInfo::m_channels
int m_channels
Definition: avformatdecoder.h:63
AvFormatDecoder::open_avf
friend int open_avf(URLContext *h, const char *filename, int flags)
AVCParser
Definition: AVCParser.h:30
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(const AvFormatDecoder &)=delete
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:309
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:118
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5166
AvFormatDecoder::m_noDtsHack
bool m_noDtsHack
Definition: avformatdecoder.h:279
AudioInfo::m_codecProfile
int m_codecProfile
Definition: avformatdecoder.h:64
AudioTrackType
AudioTrackType
Definition: decoderbase.h:56
AudioInfo::m_codecId
AVCodecID m_codecId
Definition: avformatdecoder.h:59
AvFormatDecoder::av_update_stream_timings_video
static void av_update_stream_timings_video(AVFormatContext *ic)
Definition: avformatdecoder.cpp:5398
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4076
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:280
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:501
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:61
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:898
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:296
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4336
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:293
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2546
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:329
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:288
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:818
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4175
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:354
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:76
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:323
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2718
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5199
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4189
CC608Decoder
Definition: cc608decoder.h:47
TeletextDecoder
Definition: teletextdecoder.h:9
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:98
AvFormatDecoder::SetIdrOnlyKeyframes
void SetIdrOnlyKeyframes(bool value) override
Definition: avformatdecoder.h:160
AvFormatDecoder::m_faultyPts
int64_t m_faultyPts
Definition: avformatdecoder.h:307
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:341
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:357
Context
QHash< QString, Action * > Context
Definition: action.h:77
SubtitleReader
Definition: subtitlereader.h:33
AvFormatDecoder::m_firstVPts
long long m_firstVPts
Definition: avformatdecoder.h:304
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4153
MythMediaBuffer
Definition: mythmediabuffer.h:50
AvFormatDecoder::SetRawAudioState
void SetRawAudioState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:126
AvFormatDecoder::IsValidStream
virtual bool IsValidStream(int)
Definition: avformatdecoder.h:254
TrackType
TrackType
Track types.
Definition: decoderbase.h:27
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:284
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:28
mythframe.h
PlayerFlags
PlayerFlags
Definition: mythplayer.h:79
MythPlayer
Definition: mythplayer.h:100
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:525
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:270
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:911
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1661
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:327
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4163
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:320
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:348
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:383
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:68
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:297
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:378
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2609
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:365
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:830
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5174
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:940
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:274
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:277
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
videodisplayprofile.h
programinfo.h
RenderOptions
Definition: videodisplayprofile.h:27
AvFormatDecoder::m_processFrames
bool m_processFrames
Definition: avformatdecoder.h:363
AvFormatDecoder::m_decodedVideoFrame
MythVideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:273
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:311
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1424
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:876
AudioInfo::m_sampleRate
int m_sampleRate
Definition: avformatdecoder.h:62
DecodeType
DecodeType
Definition: decoderbase.h:48
AvFormatDecoder::PreProcessVideoPacket
bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3319
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:331
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5092
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4202
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:343
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3378
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3911
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:265
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2579
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5136
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
AvFormatDecoder::m_cc608ParityTable
CC608Parity m_cc608ParityTable
Definition: avformatdecoder.h:333
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:87
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3552
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:541
MythCodecMap
Definition: mythavutil.h:24
uint
unsigned int uint
Definition: compat.h:140
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1459
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5102
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:312
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2562
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
CC608Parity
std::array< int, 256 > CC608Parity
Definition: avformatdecoder.h:43
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4043
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:313
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4575
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:310
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:286
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:321
AudioInfo
Definition: avformatdecoder.h:46
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:290
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3782
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:261
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:898
AvFormatDecoder::write_avf
friend int write_avf(URLContext *h, uint8_t *buf, int buf_size)
Buffer
Definition: MythExternControl.h:37
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
AvFormatDecoder::m_audioIn
AudioInfo m_audioIn
Definition: avformatdecoder.h:360
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *pkt)
Definition: avformatdecoder.cpp:4021
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2614
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:65
AvFormatDecoder::GetDecoders
static void GetDecoders(RenderOptions &opts)
Definition: avformatdecoder.cpp:307
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3949
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:324
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1856
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:294
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:1879
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:295
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5193
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:555
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:308
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2993
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:318
AvFormatDecoder::filter_max_ch
int filter_max_ch(const AVFormatContext *ic, const sinfo_vec_t &tracks, const vector< int > &fs, enum AVCodecID codecId=AV_CODEC_ID_NONE, int profile=-1)
Definition: avformatdecoder.cpp:4260
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4158
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:60
AudioOutputSettings
Definition: audiooutputsettings.h:50
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:66
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2551
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:361
AvFormatDecoder::m_avCodecLock
QMutex m_avCodecLock
Definition: avformatdecoder.h:371
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2572
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:263
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:366
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2924
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:351
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:253
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:5161
AvFormatDecoder::m_lastVPts
long long m_lastVPts
Definition: avformatdecoder.h:301
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:849
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4222
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:305
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:266
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:2830
AvFormatDecoder::m_lastCcPtsu
long long m_lastCcPtsu
Definition: avformatdecoder.h:303
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:282
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5110
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:328
AvFormatDecoder::GetVideoCodecID
MythCodecID GetVideoCodecID(void) const override
Definition: avformatdecoder.h:142
AvFormatDecoder::m_pmtTrackTypes
QList< TrackType > m_pmtTrackTypes
TrackType (608 or 708) for Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:345
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3868
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5246
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:477
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:276
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1801
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:358
AvFormatDecoder::m_audioReadAhead
int m_audioReadAhead
Definition: avformatdecoder.h:369
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:314
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1273
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2517
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:346
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:397
MythVideoFrame
Definition: mythframe.h:83
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:332
AvFormatDecoder::GetRawAudioState
bool GetRawAudioState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:129
AvFormatDecoder::H264PreProcessPkt
int H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3212
AvFormatDecoder::UpdateStoredFrameNum
long UpdateStoredFrameNum(long frame) override
This is a No-op for this class.
Definition: avformatdecoder.h:138
InteractiveTV
This is the interface between an MHEG engine and a MythTV TV object.
Definition: interactivetv.h:13
AvFormatDecoder::NormalizeVideoTimecode
int64_t NormalizeVideoTimecode(int64_t timecode) override
Definition: avformatdecoder.cpp:421
AvFormatDecoder::SetupAudioStreamSubIndexes
void SetupAudioStreamSubIndexes(int streamIndex)
Reacts to DUAL/STEREO changes on the fly and fix streams.
Definition: avformatdecoder.cpp:2659
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:25
MythAVFormatBuffer
Definition: mythavformatbuffer.h:14
AvFormatDecoder::GetRawVideoState
bool GetRawVideoState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:135
AvFormatDecoder::MpegPreProcessPkt
void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
Preprocess a packet, setting the video parms if necessary.
Definition: avformatdecoder.cpp:3113
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:316
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4791
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:337
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:2556
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:272
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1942
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1734
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:50
DecoderBase
Definition: decoderbase.h:121
AvFormatDecoder::m_ccd608
CC608Decoder * m_ccd608
Definition: avformatdecoder.h:330
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5219
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2855
AvFormatDecoder::SetRawVideoState
void SetRawVideoState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:132
AvFormatDecoder::m_startCodeState
uint32_t m_startCodeState
Definition: avformatdecoder.h:299