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 "mythcodeccontext.h"
20 #include "mythplayer.h"
21 
22 extern "C" {
23 #include "mythframe.h"
24 #include "libavcodec/avcodec.h"
25 #include "libavformat/avformat.h"
26 }
27 
28 #include "io/mythavformatbuffer.h"
29 
30 class TeletextDecoder;
31 class CC608Decoder;
32 class CC708Decoder;
33 class SubtitleReader;
34 class InteractiveTV;
35 class ProgramInfo;
36 class MythSqlDatabase;
37 
38 struct SwsContext;
39 
40 extern "C" void HandleStreamChange(void *data);
41 
42 using CC608Parity = std::array<int,256>;
43 
44 class AudioInfo
45 {
46  public:
47  AudioInfo() = default;
48 
49  AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru,
50  int original_ch, int profile = 0) :
51  m_codecId(id), format(fmt),
52  m_sampleSize(ch * AudioOutputSettings::SampleSize(fmt)),
54  m_doPassthru(passthru), m_originalChannels(original_ch)
55  {
56  }
57 
58  AVCodecID m_codecId {AV_CODEC_ID_NONE};
60  int m_sampleSize {-2};
61  int m_sampleRate {-1};
62  int m_channels {-1};
63  int m_codecProfile {0};
64  bool m_doPassthru {false};
66 
67  bool operator==(const AudioInfo &o) const
68  {
69  return (m_codecId==o.m_codecId && m_channels==o.m_channels &&
74  }
75  QString toString() const
76  {
77  return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)")
78  .arg(ff_codec_id_string(m_codecId),4).arg(m_sampleRate,6)
80  .arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile);
81  }
82 };
83 
86 {
87  friend void HandleStreamChange(void *data);
88 
89  public:
90  AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo,
91  PlayerFlags flags);
92  ~AvFormatDecoder() override;
93 
94  // Deleted functions should be public.
95  AvFormatDecoder(const AvFormatDecoder &) = delete; // not copyable
96  AvFormatDecoder &operator=(const AvFormatDecoder &) = delete; // not copyable
97 
98  void SetEof(bool eof) override; // DecoderBase
99 
100  MythCodecMap* CodecMap(void);
101  void CloseCodecs();
102  void CloseContext();
103  void Reset(bool reset_video_data, bool seek_reset,
104  bool reset_file) override; // DecoderBase
105 
108  static bool CanHandle(TestBufferVec & testbuf,
109  const QString &filename);
110 
112  int OpenFile(MythMediaBuffer *Buffer, bool novideo,
113  TestBufferVec & testbuf) override; // DecoderBase
114 
115  bool GetFrame(DecodeType Type, bool &Retry) override; // DecoderBase
116 
117  bool IsLastFrameKey(void) const override { return false; } // DecoderBase
118 
120  void WriteStoredData(MythMediaBuffer *Buffer, bool storevid,
121  long timecodeOffset) override // DecoderBase
122  { (void)Buffer; (void)storevid; (void)timecodeOffset;}
123 
125  void SetRawAudioState(bool state) override { (void)state; } // DecoderBase
126 
128  bool GetRawAudioState(void) const override { return false; } // DecoderBase
129 
131  void SetRawVideoState(bool state) override { (void)state; } // DecoderBase
132 
134  bool GetRawVideoState(void) const override { return false; } // DecoderBase
135 
137  long UpdateStoredFrameNum(long frame) override { (void)frame; return 0;} // DecoderBase
138 
139  QString GetCodecDecoderName(void) const override; // DecoderBase
140  QString GetRawEncodingType(void) override; // DecoderBase
141  MythCodecID GetVideoCodecID(void) const override { return m_videoCodecId; } // DecoderBase
142 
143  void SetDisablePassThrough(bool disable) override; // DecoderBase
144  void ForceSetupAudioStream(void) override; // DecoderBase
145  void AddTextData(unsigned char *buf, int len, int64_t timecode, char type);
146 
147  QString GetTrackDesc(uint Type, uint TrackNo) override;
148  int SetTrack(uint Type, int TrackNo) override;
149 
150  int ScanStreams(bool novideo);
151  int FindStreamInfo(void);
152 
153  int GetNumChapters() override; // DecoderBase
154  void GetChapterTimes(QList<long long> &times) override; // DecoderBase
155  int GetCurrentChapter(long long framesPlayed) override; // DecoderBase
156  long long GetChapter(int chapter) override; // DecoderBase
157  bool DoRewind(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
158  bool DoFastForward(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
159  void SetIdrOnlyKeyframes(bool value) override // DecoderBase
160  { m_avcParser->use_I_forKeyframes(!value); }
161 
162  int64_t NormalizeVideoTimecode(int64_t timecode) override; // DecoderBase
163  virtual int64_t NormalizeVideoTimecode(AVStream *st, int64_t timecode);
164 
165  int GetTeletextDecoderType(void) const override; // DecoderBase
166 
167  QString GetXDS(const QString &Key) const override; // DecoderBase
168  QByteArray GetSubHeader(uint TrackNo) override;
169  void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override; // DecoderBase
170 
171  // MHEG stuff
172  bool SetAudioByComponentTag(int Tag) override; // DecoderBase
173  bool SetVideoByComponentTag(int Tag) override; // DecoderBase
174 
175  // Stream language info
176  virtual int GetTeletextLanguage(uint Index);
177  virtual int GetSubtitleLanguage(uint /*unused*/, uint StreamIndex);
178  virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum);
179  virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex);
180  virtual AudioTrackType GetAudioTrackType(uint StreamIndex);
181 
182  static int GetMaxReferenceFrames(AVCodecContext *Context);
183 
184  protected:
185  int AutoSelectTrack(uint type) override; // DecoderBase
186  void ScanATSCCaptionStreams(int av_index);
187  void UpdateATSCCaptionTracks(void);
188  void UpdateCaptionTracksFromStreams(bool check_608, bool check_708);
189  void ScanTeletextCaptions(int av_index);
190  void ScanRawTextCaptions(int av_stream_index);
191  void ScanDSMCCStreams(void);
192  int AutoSelectAudioTrack(void);
193  int filter_max_ch(const AVFormatContext *ic,
194  const sinfo_vec_t &tracks,
195  const vector<int> &fs,
196  enum AVCodecID codecId = AV_CODEC_ID_NONE,
197  int profile = -1);
198 
199  friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic,
200  int flags);
201  friend int open_avf(URLContext *h, const char *filename, int flags);
202  friend int read_avf(URLContext *h, uint8_t *buf, int buf_size);
203  friend int write_avf(URLContext *h, uint8_t *buf, int buf_size);
204  friend int64_t seek_avf(URLContext *h, int64_t offset, int whence);
205  friend int close_avf(URLContext *h);
206 
207  void DecodeDTVCC(const uint8_t *buf, uint buf_size, bool scte);
208  void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte);
209  void InitByteContext(bool forceseek = false);
210  void InitVideoCodec(AVStream *stream, AVCodecContext *enc,
211  bool selectedStream = false);
212 
214  void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt);
215  int H264PreProcessPkt(AVStream *stream, AVPacket *pkt);
216  bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt);
217  virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry);
218  virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame);
219  bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt,
220  DecodeType decodetype);
221  bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt);
222  bool ProcessRawTextPacket(AVPacket* Packet);
223  virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt,
224  DecodeType decodetype);
225 
226  void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt);
227  void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt);
228  void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt);
229 
230  void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override; // DecoderBase
231 
232  inline bool DecoderWillDownmix(const AVCodecContext *ctx);
233  bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true);
234  bool SetupAudioStream(void);
235  void SetupAudioStreamSubIndexes(int streamIndex);
236  void RemoveAudioStreams();
237 
240  void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes);
241 
242  bool GenerateDummyVideoFrames(void);
243  bool HasVideo(const AVFormatContext *ic);
244  float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise = false);
245  static void av_update_stream_timings_video(AVFormatContext *ic);
246  bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec);
247 
248  void UpdateFramesPlayed(void) override; // DecoderBase
249  bool DoRewindSeek(long long desiredFrame) override; // DecoderBase
250  void DoFastForwardSeek(long long desiredFrame, bool &needflush) override; // DecoderBase
251  virtual void StreamChangeCheck(void);
252  virtual void PostProcessTracks(void) { }
253  virtual bool IsValidStream(int /*streamid*/) {return true;}
254 
255  int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size,
256  AVPacket *pkt);
257 
258  virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket);
259 
261 
262  AVCParser *m_avcParser {nullptr};
263 
264  AVFormatContext *m_ic {nullptr};
266 
267  // AVFormatParameters params;
268 
269  URLContext m_readContext {};
270 
271  int m_frameDecoded {0};
274 
275  struct SwsContext *m_swsCtx {nullptr};
276  bool m_directRendering {false};
277 
278  bool m_noDtsHack {false};
279  bool m_doRewind {false};
280 
281  bool m_gopSet {false};
283  bool m_seenGop {false};
285  int m_seqCount {0};
286 
287  QList<AVPacket*> m_storedPackets;
288 
289  int m_prevGopPos {0};
290 
291  // GetFrame
292  bool m_gotVideoFrame {false};
293  bool m_hasVideo {false};
295  bool m_skipAudio {false};
296  bool m_allowedQuit {false};
297 
298  uint32_t m_startCodeState {0xffffffff};
299 
300  long long m_lastVPts {0};
301  long long m_lastAPts {0};
302  long long m_lastCcPtsu {0};
303  long long m_firstVPts {0};
304  bool m_firstVPtsInuse {false};
305 
306  int64_t m_faultyPts {0};
307  int64_t m_faultyDts {0};
310  bool m_ptsDetected {false};
312  bool m_ptsSelected {true};
313  // set use_frame_timing true to utilize the pts values in returned
314  // frames. Set fale to use deprecated method.
315  bool m_useFrameTiming {false};
316 
317  bool m_forceDtsTimestamps {false};
318 
321 
323  int m_averrorCount {0};
324 
325  // Caption/Subtitle/Teletext decoders
329  CC608Decoder *m_ccd608 {nullptr};
330  CC708Decoder *m_ccd708 {nullptr};
331  TeletextDecoder *m_ttd {nullptr};
336  std::array<bool,68> m_ccX08InPmt {};
340  std::array<bool,68> m_ccX08InTracks {};
342  QList<StreamInfo> m_pmtTracks;
344  QList<TrackType> m_pmtTrackTypes;
347  QList<StreamInfo> m_streamTracks;
350  QList<TrackType> m_streamTrackTypes;
351 
353  InteractiveTV *m_itv {nullptr};
354 
355  // Audio
356  uint8_t *m_audioSamples {nullptr};
357  bool m_disablePassthru {false};
358 
361 
362  bool m_processFrames {true};
363 
364  bool m_streamsChanged { false };
365  bool m_resetHardwareDecoders { false };
366 
367  // Value in milliseconds, from setting AudioReadAhead
368  int m_audioReadAhead {100};
369 
370  QMutex m_avCodecLock { QMutex::Recursive };
371 };
372 
373 #endif
374 
375 /* 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:2735
AvFormatDecoder::m_lastAPts
long long m_lastAPts
Definition: avformatdecoder.h:301
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4080
AvFormatDecoder::WriteStoredData
void WriteStoredData(MythMediaBuffer *Buffer, bool storevid, long timecodeOffset) override
This is a No-op for this class.
Definition: avformatdecoder.h:120
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< long long > &times) override
Definition: avformatdecoder.cpp:477
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:26
AudioInfo::m_channels
int m_channels
Definition: avformatdecoder.h:62
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:308
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:117
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5158
AvFormatDecoder::m_noDtsHack
bool m_noDtsHack
Definition: avformatdecoder.h:278
AudioInfo::m_codecProfile
int m_codecProfile
Definition: avformatdecoder.h:63
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
AudioInfo::m_codecId
AVCodecID m_codecId
Definition: avformatdecoder.h:58
AvFormatDecoder::av_update_stream_timings_video
static void av_update_stream_timings_video(AVFormatContext *ic)
Definition: avformatdecoder.cpp:5390
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4068
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:279
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:494
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:60
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:891
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:295
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4328
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:292
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2541
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:328
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:287
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:811
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4167
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:353
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:75
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:322
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2713
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5191
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4181
CC608Decoder
Definition: cc608decoder.h:46
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:159
AvFormatDecoder::m_faultyPts
int64_t m_faultyPts
Definition: avformatdecoder.h:306
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:340
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:356
SubtitleReader
Definition: subtitlereader.h:32
AvFormatDecoder::m_firstVPts
long long m_firstVPts
Definition: avformatdecoder.h:303
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4145
MythMediaBuffer
Definition: mythmediabuffer.h:49
AvFormatDecoder::SetRawAudioState
void SetRawAudioState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:125
AvFormatDecoder::IsValidStream
virtual bool IsValidStream(int)
Definition: avformatdecoder.h:253
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:283
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:27
mythframe.h
PlayerFlags
PlayerFlags
Definition: mythplayer.h:62
MythPlayer
Definition: mythplayer.h:83
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:667
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:518
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:269
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:904
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1656
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:326
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4155
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:319
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:347
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:376
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:67
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:296
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:371
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2604
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:364
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:823
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5166
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:933
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:273
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:276
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:362
AvFormatDecoder::m_decodedVideoFrame
MythVideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:272
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:310
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1419
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:869
AudioInfo::m_sampleRate
int m_sampleRate
Definition: avformatdecoder.h:61
DecodeType
DecodeType
Definition: decoderbase.h:47
AvFormatDecoder::PreProcessVideoPacket
bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3313
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *Packet)
Definition: avformatdecoder.cpp:4015
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:330
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5084
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4194
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:342
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3372
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:3905
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:264
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2574
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5128
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
AvFormatDecoder::m_cc608ParityTable
CC608Parity m_cc608ParityTable
Definition: avformatdecoder.h:332
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:85
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3546
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:534
MythCodecMap
Definition: mythavutil.h:21
uint
unsigned int uint
Definition: compat.h:141
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1454
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5094
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:311
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2557
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
CC608Parity
std::array< int, 256 > CC608Parity
Definition: avformatdecoder.h:42
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4035
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:312
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4567
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:309
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:285
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:320
AudioInfo
Definition: avformatdecoder.h:44
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:289
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3776
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:260
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:891
AvFormatDecoder::write_avf
friend int write_avf(URLContext *h, uint8_t *buf, int buf_size)
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:359
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2609
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:64
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3943
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:323
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1851
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:293
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:1874
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:294
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5185
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:548
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:307
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2987
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:317
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:4252
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4150
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:59
AudioOutputSettings
Definition: audiooutputsettings.h:49
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:65
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2546
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:360
AvFormatDecoder::m_avCodecLock
QMutex m_avCodecLock
Definition: avformatdecoder.h:370
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2567
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:262
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:365
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2918
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:350
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:252
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:5153
AvFormatDecoder::m_lastVPts
long long m_lastVPts
Definition: avformatdecoder.h:300
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:842
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4214
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:304
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:265
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:2824
AvFormatDecoder::m_lastCcPtsu
long long m_lastCcPtsu
Definition: avformatdecoder.h:302
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:281
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5102
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:327
AvFormatDecoder::GetVideoCodecID
MythCodecID GetVideoCodecID(void) const override
Definition: avformatdecoder.h:141
AvFormatDecoder::m_pmtTrackTypes
QList< TrackType > m_pmtTrackTypes
TrackType (608 or 708) for Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:344
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3862
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5238
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:470
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:275
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1796
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:357
AvFormatDecoder::m_audioReadAhead
int m_audioReadAhead
Definition: avformatdecoder.h:368
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:307
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1266
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2512
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:339
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:390
MythVideoFrame
Definition: mythframe.h:85
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:331
AvFormatDecoder::GetRawAudioState
bool GetRawAudioState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:128
AvFormatDecoder::H264PreProcessPkt
int H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3206
AvFormatDecoder::UpdateStoredFrameNum
long UpdateStoredFrameNum(long frame) override
This is a No-op for this class.
Definition: avformatdecoder.h:137
InteractiveTV
This is the interface between an MHEG engine and a MythTV TV object.
Definition: interactivetv.h:15
AvFormatDecoder::NormalizeVideoTimecode
int64_t NormalizeVideoTimecode(int64_t timecode) override
Definition: avformatdecoder.cpp:414
AvFormatDecoder::SetupAudioStreamSubIndexes
void SetupAudioStreamSubIndexes(int streamIndex)
Reacts to DUAL/STEREO changes on the fly and fix streams.
Definition: avformatdecoder.cpp:2654
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:134
AvFormatDecoder::MpegPreProcessPkt
void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
Preprocess a packet, setting the video parms if necessary.
Definition: avformatdecoder.cpp:3107
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:315
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4783
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:336
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:2551
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:271
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1937
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1729
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:49
DecoderBase
Definition: decoderbase.h:120
AvFormatDecoder::m_ccd608
CC608Decoder * m_ccd608
Definition: avformatdecoder.h:329
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5211
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2849
AvFormatDecoder::SetRawVideoState
void SetRawVideoState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:131
AvFormatDecoder::m_startCodeState
uint32_t m_startCodeState
Definition: avformatdecoder.h:298