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 "privatedecoder.h"
15 #include "audiooutputsettings.h"
16 #include "audiooutpututil.h"
17 #include "spdifencoder.h"
18 #include "vbilut.h"
19 #include "AVCParser.h"
20 #include "videodisplayprofile.h"
21 #include "mythcodeccontext.h"
22 #include "mythplayer.h"
23 
24 extern "C" {
25 #include "mythframe.h"
26 #include "libavcodec/avcodec.h"
27 #include "libavformat/avformat.h"
28 }
29 
30 #include "io/mythavformatbuffer.h"
31 
32 class TeletextDecoder;
33 class CC608Decoder;
34 class CC708Decoder;
35 class SubtitleReader;
36 class InteractiveTV;
37 class ProgramInfo;
38 class MythSqlDatabase;
39 
40 struct SwsContext;
41 
42 extern "C" void HandleStreamChange(void *data);
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 
85 
89 {
90  friend void HandleStreamChange(void *data);
91  public:
92  static void GetDecoders(RenderOptions &opts);
93  AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo,
94  PlayerFlags flags);
95  ~AvFormatDecoder() override;
96 
97  // Deleted functions should be public.
98  AvFormatDecoder(const AvFormatDecoder &) = delete; // not copyable
99  AvFormatDecoder &operator=(const AvFormatDecoder &) = delete; // not copyable
100 
101  void SetEof(bool eof) override; // DecoderBase
102 
103  MythCodecMap* CodecMap(void);
104  void CloseCodecs();
105  void CloseContext();
106  void Reset(bool reset_video_data, bool seek_reset,
107  bool reset_file) override; // DecoderBase
108 
111  static bool CanHandle(char testbuf[kDecoderProbeBufferSize],
112  const QString &filename,
113  int testbufsize = kDecoderProbeBufferSize);
114 
116  int OpenFile(MythMediaBuffer *Buffer, bool novideo,
117  char testbuf[kDecoderProbeBufferSize],
118  int testbufsize = kDecoderProbeBufferSize) override; // DecoderBase
119 
120  bool GetFrame(DecodeType Type, bool &Retry) override; // DecoderBase
121 
122  bool IsLastFrameKey(void) const override { return false; } // DecoderBase
123 
125  void WriteStoredData(MythMediaBuffer *Buffer, bool storevid,
126  long timecodeOffset) override // DecoderBase
127  { (void)Buffer; (void)storevid; (void)timecodeOffset;}
128 
130  void SetRawAudioState(bool state) override { (void)state; } // DecoderBase
131 
133  bool GetRawAudioState(void) const override { return false; } // DecoderBase
134 
136  void SetRawVideoState(bool state) override { (void)state; } // DecoderBase
137 
139  bool GetRawVideoState(void) const override { return false; } // DecoderBase
140 
142  long UpdateStoredFrameNum(long frame) override { (void)frame; return 0;} // DecoderBase
143 
144  QString GetCodecDecoderName(void) const override; // DecoderBase
145  QString GetRawEncodingType(void) override; // DecoderBase
146  MythCodecID GetVideoCodecID(void) const override { return m_videoCodecId; } // DecoderBase
147 
148  void SetDisablePassThrough(bool disable) override; // DecoderBase
149  void ForceSetupAudioStream(void) override; // DecoderBase
150  void AddTextData(unsigned char *buf, int len, int64_t timecode, char type);
151 
152  QString GetTrackDesc(uint Type, uint TrackNo) override;
153  int SetTrack(uint Type, int TrackNo) override;
154 
155  int ScanStreams(bool novideo);
156  int FindStreamInfo(void);
157 
158  int GetNumChapters() override; // DecoderBase
159  void GetChapterTimes(QList<long long> &times) override; // DecoderBase
160  int GetCurrentChapter(long long framesPlayed) override; // DecoderBase
161  long long GetChapter(int chapter) override; // DecoderBase
162  bool DoRewind(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
163  bool DoFastForward(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
164  void SetIdrOnlyKeyframes(bool value) override // DecoderBase
165  { m_avcParser->use_I_forKeyframes(!value); }
166 
167  int64_t NormalizeVideoTimecode(int64_t timecode) override; // DecoderBase
168  virtual int64_t NormalizeVideoTimecode(AVStream *st, int64_t timecode);
169 
170  int GetTeletextDecoderType(void) const override; // DecoderBase
171 
172  QString GetXDS(const QString &Key) const override; // DecoderBase
173  QByteArray GetSubHeader(uint TrackNo) override;
174  void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override; // DecoderBase
175 
176  // MHEG stuff
177  bool SetAudioByComponentTag(int Tag) override; // DecoderBase
178  bool SetVideoByComponentTag(int Tag) override; // DecoderBase
179 
180  // Stream language info
181  virtual int GetTeletextLanguage(uint Index);
182  virtual int GetSubtitleLanguage(uint /*unused*/, uint StreamIndex);
183  virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum);
184  virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex);
185  virtual AudioTrackType GetAudioTrackType(uint StreamIndex);
186 
187  static int GetMaxReferenceFrames(AVCodecContext *Context);
188 
189  protected:
190  int AutoSelectTrack(uint type) override; // DecoderBase
191  void ScanATSCCaptionStreams(int av_index);
192  void UpdateATSCCaptionTracks(void);
193  void UpdateCaptionTracksFromStreams(bool check_608, bool check_708);
194  void ScanTeletextCaptions(int av_index);
195  void ScanRawTextCaptions(int av_stream_index);
196  void ScanDSMCCStreams(void);
197  int AutoSelectAudioTrack(void);
198  int filter_max_ch(const AVFormatContext *ic,
199  const sinfo_vec_t &tracks,
200  const vector<int> &fs,
201  enum AVCodecID codecId = AV_CODEC_ID_NONE,
202  int profile = -1);
203 
204  friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic,
205  int flags);
206  friend int open_avf(URLContext *h, const char *filename, int flags);
207  friend int read_avf(URLContext *h, uint8_t *buf, int buf_size);
208  friend int write_avf(URLContext *h, uint8_t *buf, int buf_size);
209  friend int64_t seek_avf(URLContext *h, int64_t offset, int whence);
210  friend int close_avf(URLContext *h);
211 
212  void DecodeDTVCC(const uint8_t *buf, uint buf_size, bool scte);
213  void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte);
214  void InitByteContext(bool forceseek = false);
215  void InitVideoCodec(AVStream *stream, AVCodecContext *enc,
216  bool selectedStream = false);
217 
219  void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt);
220  int H264PreProcessPkt(AVStream *stream, AVPacket *pkt);
221  bool PreProcessVideoPacket(AVStream *stream, AVPacket *pkt);
222  virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry);
223  virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame);
224  bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt,
225  DecodeType decodetype);
226  bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt);
227  bool ProcessRawTextPacket(AVPacket *pkt);
228  virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt,
229  DecodeType decodetype);
230 
231  void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt);
232  void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt);
233  void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt);
234 
235  void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override; // DecoderBase
236 
237  inline bool DecoderWillDownmix(const AVCodecContext *ctx);
238  bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true);
239  bool SetupAudioStream(void);
240  void SetupAudioStreamSubIndexes(int streamIndex);
241  void RemoveAudioStreams();
242 
245  void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes);
246 
247  bool GenerateDummyVideoFrames(void);
248  bool HasVideo(const AVFormatContext *ic);
249  float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise = false);
250  static void av_update_stream_timings_video(AVFormatContext *ic);
251  static bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec);
252 
253  void UpdateFramesPlayed(void) override; // DecoderBase
254  bool DoRewindSeek(long long desiredFrame) override; // DecoderBase
255  void DoFastForwardSeek(long long desiredFrame, bool &needflush) override; // DecoderBase
256  virtual void StreamChangeCheck(void);
257  virtual void PostProcessTracks(void) { }
258  virtual bool IsValidStream(int /*streamid*/) {return true;}
259 
260  int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size,
261  AVPacket *pkt);
262 
263  virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket);
264 
266 
268 
269  AVCParser *m_avcParser {nullptr};
270 
271  AVFormatContext *m_ic {nullptr};
273 
274  // AVFormatParameters params;
275 
276  URLContext m_readContext {};
277 
278  int m_frameDecoded {0};
281 
282  struct SwsContext *m_swsCtx {nullptr};
283  bool m_directRendering {false};
284 
285  bool m_noDtsHack {false};
286  bool m_doRewind {false};
287 
288  bool m_gopSet {false};
290  bool m_seenGop {false};
292  int m_seqCount {0};
293 
294  QList<AVPacket*> m_storedPackets;
295 
296  int m_prevGopPos {0};
297 
298  // GetFrame
299  bool m_gotVideoFrame {false};
300  bool m_hasVideo {false};
302  bool m_skipAudio {false};
303  bool m_allowedQuit {false};
304 
305  uint32_t m_startCodeState {0xffffffff};
306 
307  long long m_lastVPts {0};
308  long long m_lastAPts {0};
309  long long m_lastCcPtsu {0};
310  long long m_firstVPts {0};
311  bool m_firstVPtsInuse {false};
312 
313  int64_t m_faultyPts {0};
314  int64_t m_faultyDts {0};
317  bool m_ptsDetected {false};
319  bool m_ptsSelected {true};
320  // set use_frame_timing true to utilize the pts values in returned
321  // frames. Set fale to use deprecated method.
322  bool m_useFrameTiming {false};
323 
324  bool m_forceDtsTimestamps {false};
325 
328 
330  int m_averrorCount {0};
331 
332  // Caption/Subtitle/Teletext decoders
336  CC608Decoder *m_ccd608 {nullptr};
337  CC708Decoder *m_ccd708 {nullptr};
338  TeletextDecoder *m_ttd {nullptr};
339  int m_cc608ParityTable[256] {0};
343  bool m_ccX08InPmt[64+4] {};
347  bool m_ccX08InTracks[64+4] {};
349  QList<StreamInfo> m_pmtTracks;
351  QList<TrackType> m_pmtTrackTypes;
354  QList<StreamInfo> m_streamTracks;
357  QList<TrackType> m_streamTrackTypes;
358 
360  InteractiveTV *m_itv {nullptr};
361 
362  // Audio
363  uint8_t *m_audioSamples {nullptr};
364  bool m_disablePassthru {false};
365 
368 
369  float m_fps {0.0F};
370  bool m_processFrames {true};
371 
372  bool m_streamsChanged { false };
373  bool m_resetHardwareDecoders { false };
374 
375  // Value in milliseconds, from setting AudioReadAhead
376  int m_audioReadAhead {100};
377 };
378 
379 #endif
380 
381 /* 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:2732
AvFormatDecoder::m_lastAPts
long long m_lastAPts
Definition: avformatdecoder.h:308
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:4109
AvFormatDecoder::WriteStoredData
void WriteStoredData(MythMediaBuffer *Buffer, bool storevid, long timecodeOffset) override
This is a No-op for this class.
Definition: avformatdecoder.h:125
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< long long > &times) override
Definition: avformatdecoder.cpp:491
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::AvFormatDecoder
AvFormatDecoder(const AvFormatDecoder &)=delete
AvFormatDecoder::read_avf
friend int read_avf(URLContext *h, uint8_t *buf, int buf_size)
AvFormatDecoder::m_decodedVideoFrame
VideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:279
AvFormatDecoder::m_lastPtsForFaultDetection
int64_t m_lastPtsForFaultDetection
Definition: avformatdecoder.h:315
AvFormatDecoder::m_ccX08InPmt
bool m_ccX08InPmt[64+4]
Lookup table for whether a stream was seen in the PMT entries 0-3 correspond to CEA-608 CC1 through C...
Definition: avformatdecoder.h:343
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:122
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:5212
AvFormatDecoder::m_noDtsHack
bool m_noDtsHack
Definition: avformatdecoder.h:285
kDecoderProbeBufferSize
const int kDecoderProbeBufferSize
Definition: decoderbase.h:22
AvFormatDecoder::CanHandle
static bool CanHandle(char testbuf[kDecoderProbeBufferSize], const QString &filename, int testbufsize=kDecoderProbeBufferSize)
Perform an av_probe_input_format on the passed data to see if we can decode it with this class.
Definition: avformatdecoder.cpp:856
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:5444
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4097
AvFormatDecoder::m_doRewind
bool m_doRewind
Definition: avformatdecoder.h:286
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:508
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:60
HandleStreamChange
void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:906
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:302
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4357
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:299
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2540
AvFormatDecoder::m_lastScteField
uint m_lastScteField
Definition: avformatdecoder.h:335
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:294
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:825
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:4196
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:360
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:75
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:329
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2712
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:5245
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4210
CC608Decoder
Definition: cc608decoder.h:42
TeletextDecoder
Definition: teletextdecoder.h:9
format.h
AudioOutputSettings::FormatToBits
static int FormatToBits(AudioFormat format)
Definition: audiooutputsettings.cpp:159
AVCParser::use_I_forKeyframes
void use_I_forKeyframes(bool val)
Definition: AVCParser.h:116
AvFormatDecoder::SetIdrOnlyKeyframes
void SetIdrOnlyKeyframes(bool value) override
Definition: avformatdecoder.h:164
AvFormatDecoder::m_faultyPts
int64_t m_faultyPts
Definition: avformatdecoder.h:313
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:363
Context
QHash< QString, Action * > Context
Definition: action.h:77
SubtitleReader
Definition: subtitlereader.h:33
AvFormatDecoder::m_firstVPts
long long m_firstVPts
Definition: avformatdecoder.h:310
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:4174
MythMediaBuffer
Definition: mythmediabuffer.h:50
AvFormatDecoder::SetRawAudioState
void SetRawAudioState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:130
AvFormatDecoder::IsValidStream
virtual bool IsValidStream(int)
Definition: avformatdecoder.h:258
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:290
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:25
mythframe.h
PlayerFlags
PlayerFlags
Definition: mythplayer.h:88
MythPlayer
Definition: mythplayer.h:165
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:681
VideoFrame
Definition: mythframe.h:138
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:532
AvFormatDecoder::m_readContext
URLContext m_readContext
Definition: avformatdecoder.h:276
AvFormatDecoder::FindStreamInfo
int FindStreamInfo(void)
Definition: avformatdecoder.cpp:919
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1650
AvFormatDecoder::m_ignoreScte
uint m_ignoreScte
Definition: avformatdecoder.h:333
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:4184
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:326
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:354
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:389
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:67
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:303
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:384
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2603
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:372
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:837
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:5220
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:280
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:283
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
videodisplayprofile.h
programinfo.h
RenderOptions
Definition: videodisplayprofile.h:28
AvFormatDecoder::m_processFrames
bool m_processFrames
Definition: avformatdecoder.h:370
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AvFormatDecoder::m_ptsDetected
bool m_ptsDetected
Definition: avformatdecoder.h:317
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1431
AvFormatDecoder::InitByteContext
void InitByteContext(bool forceseek=false)
Definition: avformatdecoder.cpp:884
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:3331
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:337
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:5124
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:4223
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:349
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3390
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3935
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:271
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2573
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:5165
sinfo_vec_t
vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:110
AvFormatDecoder
A decoder for video files.
Definition: avformatdecoder.h:89
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3580
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:548
privatedecoder.h
MythCodecMap
MythCodecMap Utility class that keeps pointers to an AVStream and its AVCodecContext.
Definition: mythavutil.h:87
uint
unsigned int uint
Definition: compat.h:140
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
Definition: avformatdecoder.cpp:1466
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:5134
AvFormatDecoder::m_reorderedPtsDetected
bool m_reorderedPtsDetected
Definition: avformatdecoder.h:318
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2556
AvFormatDecoder::close_avf
friend int close_avf(URLContext *h)
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4064
AvFormatDecoder::m_ptsSelected
bool m_ptsSelected
Definition: avformatdecoder.h:319
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4596
AvFormatDecoder::m_lastDtsForFaultDetection
int64_t m_lastDtsForFaultDetection
Definition: avformatdecoder.h:316
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:292
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:327
AudioInfo
Definition: avformatdecoder.h:45
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:296
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3806
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:267
AvFormatDecoder::HandleStreamChange
friend void HandleStreamChange(void *data)
Definition: avformatdecoder.cpp:906
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:366
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *pkt)
Definition: avformatdecoder.cpp:4042
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2608
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:64
AvFormatDecoder::GetDecoders
static void GetDecoders(RenderOptions &opts)
Definition: avformatdecoder.cpp:309
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3973
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:330
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1845
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:300
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:1868
AvFormatDecoder::m_fps
float m_fps
Definition: avformatdecoder.h:369
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:301
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:5239
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:562
AvFormatDecoder::m_faultyDts
int64_t m_faultyDts
Definition: avformatdecoder.h:314
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2995
AvFormatDecoder::m_forceDtsTimestamps
bool m_forceDtsTimestamps
Definition: avformatdecoder.h:324
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:4281
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:4179
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:59
AudioOutputSettings
Definition: audiooutputsettings.h:53
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:65
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2545
AvFormatDecoder::OpenFile
int OpenFile(MythMediaBuffer *Buffer, bool novideo, char testbuf[kDecoderProbeBufferSize], int testbufsize=kDecoderProbeBufferSize) override
Open our file and set up or audio and video parameters.
Definition: avformatdecoder.cpp:946
AvFormatDecoder::m_ccX08InTracks
bool m_ccX08InTracks[64+4]
Lookup table for whether a stream is represented in the UI entries 0-3 correspond to CEA-608 CC1 thro...
Definition: avformatdecoder.h:347
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:367
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2566
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:269
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:373
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2926
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:357
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:257
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:5205
AvFormatDecoder::m_lastVPts
long long m_lastVPts
Definition: avformatdecoder.h:307
decoderbase.h
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4243
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:311
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:272
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:2832
AvFormatDecoder::m_lastCcPtsu
long long m_lastCcPtsu
Definition: avformatdecoder.h:309
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:288
AvFormatDecoder::HasVideo
bool HasVideo(const AVFormatContext *ic)
Definition: avformatdecoder.cpp:5139
AvFormatDecoder::m_invertScteField
uint m_invertScteField
Definition: avformatdecoder.h:334
AvFormatDecoder::GetVideoCodecID
MythCodecID GetVideoCodecID(void) const override
Definition: avformatdecoder.h:146
AvFormatDecoder::m_pmtTrackTypes
QList< TrackType > m_pmtTrackTypes
TrackType (608 or 708) for Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:351
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3892
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5292
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:484
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:282
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1790
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:364
AvFormatDecoder::m_audioReadAhead
int m_audioReadAhead
Definition: avformatdecoder.h:376
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:319
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1280
AvFormatDecoder::OpenAVCodec
static bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2513
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:351
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:401
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:338
AvFormatDecoder::GetRawAudioState
bool GetRawAudioState(void) const override
This is a No-op for this class.
Definition: avformatdecoder.h:133
AvFormatDecoder::H264PreProcessPkt
int H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3221
PrivateDecoder
Definition: privatedecoder.h:19
AvFormatDecoder::UpdateStoredFrameNum
long UpdateStoredFrameNum(long frame) override
This is a No-op for this class.
Definition: avformatdecoder.h:142
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:428
AvFormatDecoder::SetupAudioStreamSubIndexes
void SetupAudioStreamSubIndexes(int streamIndex)
Reacts to DUAL/STEREO changes on the fly and fix streams.
Definition: avformatdecoder.cpp:2653
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:139
AvFormatDecoder::MpegPreProcessPkt
void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
Preprocess a packet, setting the video parms if necessary.
Definition: avformatdecoder.cpp:3115
AvFormatDecoder::m_useFrameTiming
bool m_useFrameTiming
Definition: avformatdecoder.h:322
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4808
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:2550
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:278
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1931
AvFormatDecoder::m_privateDec
PrivateDecoder * m_privateDec
Definition: avformatdecoder.h:265
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1723
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:336
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:5265
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)
Definition: avformatdecoder.cpp:2857
AvFormatDecoder::SetRawVideoState
void SetRawVideoState(bool state) override
This is a No-op for this class.
Definition: avformatdecoder.h:136
AvFormatDecoder::m_startCodeState
uint32_t m_startCodeState
Definition: avformatdecoder.h:305
AvFormatDecoder::m_cc608ParityTable
int m_cc608ParityTable[256]
Definition: avformatdecoder.h:339