MythTV  master
avformatdecoder.h
Go to the documentation of this file.
1 
2 #ifndef AVFORMATDECODER_H_
3 #define AVFORMATDECODER_H_
4 
5 #include <array>
6 #include <cstdint>
7 
8 extern "C" {
9 #include "libavcodec/avcodec.h"
10 #include "libavformat/avformat.h"
11 }
12 
13 #include <QList>
14 #include <QMap>
15 #include <QString>
16 
21 
22 #include "captions/vbilut.h"
23 #include "decoderbase.h"
24 #include "io/mythavformatbuffer.h"
25 #include "mpeg/AVCParser.h"
26 #include "mythcodeccontext.h"
27 #include "mythplayer.h"
28 
29 class TeletextDecoder;
30 class CC608Decoder;
31 class CC708Decoder;
32 class SubtitleReader;
33 class InteractiveTV;
34 class MythSqlDatabase;
35 
36 struct SwsContext;
37 
38 class AudioInfo
39 {
40  public:
41  AudioInfo() = default;
42 
43  AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru,
44  int original_ch, int profile = 0) :
45  m_codecId(id), format(fmt),
46  m_sampleSize(ch * AudioOutputSettings::SampleSize(fmt)),
48  m_doPassthru(passthru), m_originalChannels(original_ch)
49  {
50  }
51 
52  AVCodecID m_codecId {AV_CODEC_ID_NONE};
54  int m_sampleSize {-2};
55  int m_sampleRate {-1};
56  int m_channels {-1};
57  int m_codecProfile {0};
58  bool m_doPassthru {false};
60 
61  bool operator==(const AudioInfo &o) const
62  {
63  return (m_codecId==o.m_codecId && m_channels==o.m_channels &&
68  }
69  QString toString() const
70  {
71  return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)")
72  .arg(avcodec_get_name(m_codecId),4).arg(m_sampleRate,6)
74  .arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile);
75  }
76 };
77 
80 {
81  public:
82  AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo,
83  PlayerFlags flags);
84  ~AvFormatDecoder() override;
85 
86  // Deleted functions should be public.
87  AvFormatDecoder(const AvFormatDecoder &) = delete; // not copyable
88  AvFormatDecoder &operator=(const AvFormatDecoder &) = delete; // not copyable
89 
90  void SetEof(bool eof) override; // DecoderBase
91 
92  MythCodecMap* CodecMap(void);
93  void CloseCodecs();
94  void CloseContext();
95  void Reset(bool reset_video_data, bool seek_reset,
96  bool reset_file) override; // DecoderBase
97 
100  static bool CanHandle(TestBufferVec & testbuf,
101  const QString &filename);
102 
104  int OpenFile(MythMediaBuffer *Buffer, bool novideo,
105  TestBufferVec & testbuf) override; // DecoderBase
106 
107  bool GetFrame(DecodeType Type, bool &Retry) override; // DecoderBase
108 
109  bool IsLastFrameKey(void) const override { return false; } // DecoderBase
110 
111  QString GetCodecDecoderName(void) const override; // DecoderBase
112  QString GetRawEncodingType(void) override; // DecoderBase
113  MythCodecID GetVideoCodecID(void) const override { return m_videoCodecId; } // DecoderBase
114 
115  void SetDisablePassThrough(bool disable) override; // DecoderBase
116  void ForceSetupAudioStream(void) override; // DecoderBase
117  void AddTextData(unsigned char *buf, int len, int64_t timecode, char type);
118 
119  QString GetTrackDesc(uint Type, uint TrackNo) override;
120  int SetTrack(uint Type, int TrackNo) override;
121 
122  int ScanStreams(bool novideo);
123 
124  int GetNumChapters() override; // DecoderBase
125  void GetChapterTimes(QList<std::chrono::seconds> &times) override; // DecoderBase
126  int GetCurrentChapter(long long framesPlayed) override; // DecoderBase
127  long long GetChapter(int chapter) override; // DecoderBase
128  bool DoRewind(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
129  bool DoFastForward(long long desiredFrame, bool discardFrames = true) override; // DecoderBase
130  void SetIdrOnlyKeyframes(bool value) override // DecoderBase
131  { m_avcParser->use_I_forKeyframes(!value); }
132 
133  std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override; // DecoderBase
134  virtual std::chrono::milliseconds NormalizeVideoTimecode(AVStream *st, std::chrono::milliseconds timecode);
135 
136  int GetTeletextDecoderType(void) const override; // DecoderBase
137 
138  QString GetXDS(const QString &Key) const override; // DecoderBase
139  QByteArray GetSubHeader(uint TrackNo) override;
140  void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override; // DecoderBase
141 
142  // MHEG stuff
143  bool SetAudioByComponentTag(int Tag) override; // DecoderBase
144  bool SetVideoByComponentTag(int Tag) override; // DecoderBase
145 
146  // Stream language info
147  virtual int GetTeletextLanguage(uint Index);
148  virtual int GetSubtitleLanguage(uint /*unused*/, uint StreamIndex);
149  virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum);
150  virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex);
151  virtual AudioTrackType GetAudioTrackType(uint StreamIndex);
152 
153  static int GetMaxReferenceFrames(AVCodecContext *Context);
154 
155  static void streams_changed(void *data, int avprogram_id);
156 
157  protected:
158  int AutoSelectTrack(uint type) override; // DecoderBase
159  void ScanATSCCaptionStreams(int av_index);
160  void UpdateATSCCaptionTracks(void);
161  void UpdateCaptionTracksFromStreams(bool check_608, bool check_708);
162  void ScanTeletextCaptions(int av_index);
163  void ScanRawTextCaptions(int av_stream_index);
164  void ScanDSMCCStreams(AVBufferRef* pmt_section);
165  int AutoSelectAudioTrack(void);
166  int filter_max_ch(const AVFormatContext *ic,
167  const sinfo_vec_t &tracks,
168  const std::vector<int>&fs,
169  enum AVCodecID codecId = AV_CODEC_ID_NONE,
170  int profile = -1);
171  int selectBestAudioTrack(int lang_key, const std::vector<int> &ftype);
172 
173  friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic,
174  int flags);
175 
176  void DecodeCCx08(const uint8_t *buf, uint buf_size);
177  void InitVideoCodec(AVStream *stream, AVCodecContext *codecContext,
178  bool selectedStream = false);
179 
181  void MpegPreProcessPkt(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt);
182  int H264PreProcessPkt(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt);
183  bool PreProcessVideoPacket(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt);
184  virtual bool ProcessVideoPacket(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt, bool &Retry);
185  virtual bool ProcessVideoFrame(AVCodecContext* codecContext, AVStream *Stream, AVFrame *AvFrame);
186  bool ProcessAudioPacket(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt,
187  DecodeType decodetype);
188  bool ProcessSubtitlePacket(AVCodecContext* codecContext, AVStream *stream, AVPacket *pkt);
189  bool ProcessRawTextPacket(AVPacket* Packet);
190  virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt,
191  DecodeType decodetype);
192 
193  void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt);
194  void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt);
195  void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt);
196 
197  void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override; // DecoderBase
198 
199  inline bool DecoderWillDownmix(const AVCodecContext *ctx);
200  bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true);
201  bool SetupAudioStream(void);
202  void SetupAudioStreamSubIndexes(int streamIndex);
203  void RemoveAudioStreams();
204 
207  void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes);
208 
209  bool GenerateDummyVideoFrames(void);
210  bool HasVideo();
211  float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise = false);
212  static void av_update_stream_timings_video(AVFormatContext *ic);
213  bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec);
214 
215  void UpdateFramesPlayed(void) override; // DecoderBase
216  bool DoRewindSeek(long long desiredFrame) override; // DecoderBase
217  void DoFastForwardSeek(long long desiredFrame, bool &needflush) override; // DecoderBase
218  virtual void StreamChangeCheck(void);
219  virtual void PostProcessTracks(void) { }
220  virtual bool IsValidStream(int /*streamid*/) {return true;}
221 
222  int DecodeAudio(AVCodecContext *ctx, uint8_t *buffer, int &data_size,
223  AVPacket *pkt);
224 
225  virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket);
226 
227  bool FlagIsSet(PlayerFlags arg) { return m_playerFlags & arg; }
228 
229  int autoSelectVideoTrack(int& scanerror);
230  void remove_tracks_not_in_same_AVProgram(int stream_index);
231 
233  AVProgram* get_current_AVProgram();
234 
235  bool do_av_seek(long long desiredFrame, bool discardFrames, int flags);
236 
238 
239  AVCParser *m_avcParser {nullptr};
240 
241  AVFormatContext *m_ic {nullptr};
243 
244  // AVFormatParameters params;
245 
246  int m_frameDecoded {0};
249 
250  struct SwsContext *m_swsCtx {nullptr};
251  bool m_directRendering {false};
252 
253  bool m_gopSet {false};
255  bool m_seenGop {false};
257  int m_seqCount {0};
258 
259  QList<AVPacket*> m_storedPackets;
260 
261  int m_prevGopPos {0};
262 
263  // GetFrame
264  bool m_gotVideoFrame {false};
265  bool m_hasVideo {false};
267  bool m_skipAudio {false};
268  bool m_allowedQuit {false};
269 
270  uint32_t m_startCodeState {0xffffffff};
271 
272  std::chrono::milliseconds m_lastVPts {0ms};
273  std::chrono::milliseconds m_lastAPts {0ms};
274  std::chrono::microseconds m_lastCcPtsu {0ms};
275  std::chrono::milliseconds m_firstVPts {0ms};
276  bool m_firstVPtsInuse {false};
277 
280 
282  int m_averrorCount {0};
283 
284  // Caption/Subtitle/Teletext decoders
285  CC608Decoder *m_ccd608 {nullptr};
286  CC708Decoder *m_ccd708 {nullptr};
287  TeletextDecoder *m_ttd {nullptr};
291  std::array<bool,68> m_ccX08InPmt {};
295  std::array<bool,68> m_ccX08InTracks {};
297  QList<StreamInfo> m_pmtTracks;
299  QList<TrackType> m_pmtTrackTypes;
302  QList<StreamInfo> m_streamTracks;
305  QList<TrackType> m_streamTrackTypes;
306 
308  InteractiveTV *m_itv {nullptr};
309 
310  // Audio
311  uint8_t *m_audioSamples {nullptr};
312  bool m_disablePassthru {false};
313 
316 
317  bool m_processFrames {true};
318 
319  bool m_streamsChanged { false };
320  bool m_resetHardwareDecoders { false };
321 
322  // Value in milliseconds, from setting AudioReadAhead
323  std::chrono::milliseconds m_audioReadAhead {100ms};
324 
325  QRecursiveMutex m_avCodecLock;
326 };
327 
328 #endif
329 
330 /* 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:2663
AvFormatDecoder::GetTrackDesc
QString GetTrackDesc(uint Type, uint TrackNo) override
Definition: avformatdecoder.cpp:3870
AudioInfo::m_channels
int m_channels
Definition: avformatdecoder.h:56
AVCParser
Definition: AVCParser.h:30
AvFormatDecoder::IsLastFrameKey
bool IsLastFrameKey(void) const override
Definition: avformatdecoder.h:109
AvFormatDecoder::GetRawEncodingType
QString GetRawEncodingType(void) override
Definition: avformatdecoder.cpp:4922
AudioInfo::m_codecProfile
int m_codecProfile
Definition: avformatdecoder.h:57
AudioInfo::m_codecId
AVCodecID m_codecId
Definition: avformatdecoder.h:52
AvFormatDecoder::av_update_stream_timings_video
static void av_update_stream_timings_video(AVFormatContext *ic)
Definition: avformatdecoder.cpp:5154
AvFormatDecoder::GetChapterTimes
void GetChapterTimes(QList< std::chrono::seconds > &times) override
Definition: avformatdecoder.cpp:526
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:3858
AvFormatDecoder::GetCurrentChapter
int GetCurrentChapter(long long framesPlayed) override
Definition: avformatdecoder.cpp:543
AudioInfo::m_sampleSize
int m_sampleSize
Definition: avformatdecoder.h:54
DecodeType
DecodeType
Definition: decoderbase.h:47
AvFormatDecoder::m_skipAudio
bool m_skipAudio
Definition: avformatdecoder.h:267
AvFormatDecoder::do_av_seek
bool do_av_seek(long long desiredFrame, bool discardFrames, int flags)
Definition: avformatdecoder.cpp:617
AvFormatDecoder::AutoSelectAudioTrack
int AutoSelectAudioTrack(void)
Selects the best audio track.
Definition: avformatdecoder.cpp:4172
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
audiooutpututil.h
AvFormatDecoder::m_gotVideoFrame
bool m_gotVideoFrame
Definition: avformatdecoder.h:264
AvFormatDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: avformatdecoder.cpp:2462
spdifencoder.h
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:259
AvFormatDecoder::SetEof
void SetEof(bool eof) override
Definition: avformatdecoder.cpp:794
AvFormatDecoder::GetAttachmentData
void GetAttachmentData(uint TrackNo, QByteArray &Filename, QByteArray &Data) override
Definition: avformatdecoder.cpp:3969
AvFormatDecoder::ProcessAudioPacket
bool ProcessAudioPacket(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4352
AvFormatDecoder::m_itv
InteractiveTV * m_itv
MHEG/MHP decoder.
Definition: avformatdecoder.h:308
AudioInfo::toString
QString toString() const
Definition: avformatdecoder.h:69
AvFormatDecoder::m_maxKeyframeDist
int m_maxKeyframeDist
Definition: avformatdecoder.h:281
AvFormatDecoder::RemoveAudioStreams
void RemoveAudioStreams()
remove audio streams from the context used by dvd code during title transitions to remove stale audio...
Definition: avformatdecoder.cpp:2621
AudioInfo::AudioInfo
AudioInfo()=default
AvFormatDecoder::NormalizeVideoTimecode
std::chrono::milliseconds NormalizeVideoTimecode(std::chrono::milliseconds timecode) override
Definition: avformatdecoder.cpp:463
AvFormatDecoder::DecoderWillDownmix
bool DecoderWillDownmix(const AVCodecContext *ctx)
Definition: avformatdecoder.cpp:4955
AvFormatDecoder::SetAudioByComponentTag
bool SetAudioByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:3983
CC608Decoder
Definition: cc608decoder.h:90
TeletextDecoder
Definition: teletextdecoder.h:8
AvFormatDecoder::autoSelectVideoTrack
int autoSelectVideoTrack(int &scanerror)
Definition: avformatdecoder.cpp:1865
AudioOutputSettings::FormatToBits
static int FormatToBits(AudioFormat format)
Definition: audiooutputsettings.cpp:150
AVCParser::use_I_forKeyframes
void use_I_forKeyframes(bool val)
Definition: AVCParser.h:118
AvFormatDecoder::HasVideo
bool HasVideo()
Definition: avformatdecoder.cpp:4865
AvFormatDecoder::SetIdrOnlyKeyframes
void SetIdrOnlyKeyframes(bool value) override
Definition: avformatdecoder.h:130
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:295
AvFormatDecoder::m_audioSamples
uint8_t * m_audioSamples
Definition: avformatdecoder.h:311
SubtitleReader
Definition: subtitlereader.h:42
AvFormatDecoder::GetTeletextDecoderType
int GetTeletextDecoderType(void) const override
Definition: avformatdecoder.cpp:3947
MythMediaBuffer
Definition: mythmediabuffer.h:59
AvFormatDecoder::IsValidStream
virtual bool IsValidStream(int)
Definition: avformatdecoder.h:220
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVCodecContext *codecContext, AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3356
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:255
mythplayer.h
CC708Decoder
Definition: cc708decoder.h:27
PlayerFlags
PlayerFlags
Definition: mythplayer.h:64
MythPlayer
Definition: mythplayer.h:83
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:667
mythavformatbuffer.h
AvFormatDecoder::GetChapter
long long GetChapter(int chapter) override
Definition: avformatdecoder.cpp:567
AvFormatDecoder::ScanATSCCaptionStreams
void ScanATSCCaptionStreams(int av_index)
Definition: avformatdecoder.cpp:1575
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:118
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3242
AvFormatDecoder::GetSubHeader
QByteArray GetSubHeader(uint TrackNo) override
Definition: avformatdecoder.cpp:3957
AvFormatDecoder::m_playerFlags
PlayerFlags m_playerFlags
Definition: avformatdecoder.h:278
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:302
AvFormatDecoder::CloseCodecs
void CloseCodecs()
Definition: avformatdecoder.cpp:428
AudioInfo::operator==
bool operator==(const AudioInfo &o) const
Definition: avformatdecoder.h:61
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:15
AvFormatDecoder::m_allowedQuit
bool m_allowedQuit
Definition: avformatdecoder.h:268
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:423
AvFormatDecoder::GetAudioLanguage
virtual int GetAudioLanguage(uint AudioIndex, uint StreamIndex)
Definition: avformatdecoder.cpp:2525
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:319
AvFormatDecoder::m_firstVPts
std::chrono::milliseconds m_firstVPts
Definition: avformatdecoder.h:275
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:806
AvFormatDecoder::SetDisablePassThrough
void SetDisablePassThrough(bool disable) override
Disables AC3/DTS pass through.
Definition: avformatdecoder.cpp:4930
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:892
AvFormatDecoder::m_avfRingBuffer
MythAVFormatBuffer * m_avfRingBuffer
Definition: avformatdecoder.h:248
AvFormatDecoder::m_directRendering
bool m_directRendering
Definition: avformatdecoder.h:251
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
AvFormatDecoder::MpegPreProcessPkt
void MpegPreProcessPkt(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt)
Preprocess a packet, setting the video parms if necessary.
Definition: avformatdecoder.cpp:2988
programinfo.h
AvFormatDecoder::ScanDSMCCStreams
void ScanDSMCCStreams(AVBufferRef *pmt_section)
Check to see whether there is a Network Boot Ifo sub-descriptor in the PMT which requires the MHEG ap...
Definition: avformatdecoder.cpp:1800
AvFormatDecoder::m_processFrames
bool m_processFrames
Definition: avformatdecoder.h:317
AvFormatDecoder::m_decodedVideoFrame
MythVideoFrame * m_decodedVideoFrame
Definition: avformatdecoder.h:247
vbilut.h
hardwareprofile.scan.profile
profile
Definition: scan.py:96
AvFormatDecoder::GetMaxReferenceFrames
static int GetMaxReferenceFrames(AVCodecContext *Context)
Definition: avformatdecoder.cpp:1336
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:25
AudioInfo::m_sampleRate
int m_sampleRate
Definition: avformatdecoder.h:55
AvFormatDecoder::ProcessRawTextPacket
bool ProcessRawTextPacket(AVPacket *Packet)
Definition: avformatdecoder.cpp:3806
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
AvFormatDecoder::m_ccd708
CC708Decoder * m_ccd708
Definition: avformatdecoder.h:286
AvFormatDecoder::StreamChangeCheck
virtual void StreamChangeCheck(void)
Definition: avformatdecoder.cpp:4846
AvFormatDecoder::SetVideoByComponentTag
bool SetVideoByComponentTag(int Tag) override
Definition: avformatdecoder.cpp:3996
AvFormatDecoder::m_pmtTracks
QList< StreamInfo > m_pmtTracks
StreamInfo for 608 and 708 Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:297
AvFormatDecoder::m_lastVPts
std::chrono::milliseconds m_lastVPts
Definition: avformatdecoder.h:272
AvFormatDecoder::ProcessDSMCCPacket
void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt)
Process DSMCC object carousel packet.
Definition: avformatdecoder.cpp:3685
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:241
AvFormatDecoder::get_current_AVProgram
AVProgram * get_current_AVProgram()
Definition: avformatdecoder.cpp:5214
AvFormatDecoder::GetCaptionLanguage
virtual int GetCaptionLanguage(TrackType TrackType, int ServiceNum)
Return ATSC Closed Caption Language.
Definition: avformatdecoder.cpp:2495
AvFormatDecoder::GenerateDummyVideoFrames
bool GenerateDummyVideoFrames(void)
Definition: avformatdecoder.cpp:4892
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
AvFormatDecoder::remove_tracks_not_in_same_AVProgram
void remove_tracks_not_in_same_AVProgram(int stream_index)
Definition: avformatdecoder.cpp:2053
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:79
AvFormatDecoder::DoRewind
bool DoRewind(long long desiredFrame, bool discardFrames=true) override
Definition: avformatdecoder.cpp:583
MythCodecMap
Definition: mythavutil.h:26
AvFormatDecoder::ReadPacket
virtual int ReadPacket(AVFormatContext *ctx, AVPacket *pkt, bool &storePacket)
Definition: avformatdecoder.cpp:4857
AvFormatDecoder::GetTeletextLanguage
virtual int GetTeletextLanguage(uint Index)
Returns TeleText language.
Definition: avformatdecoder.cpp:2478
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:3827
AvFormatDecoder::m_lastAPts
std::chrono::milliseconds m_lastAPts
Definition: avformatdecoder.h:273
AvFormatDecoder::m_seqCount
int m_seqCount
A counter used to determine if we need to force a call to HandleGopStart.
Definition: avformatdecoder.h:257
AVCParser.h
AvFormatDecoder::m_videoCodecId
MythCodecID m_videoCodecId
Definition: avformatdecoder.h:279
AudioInfo
Definition: avformatdecoder.h:38
AvFormatDecoder::m_prevGopPos
int m_prevGopPos
Definition: avformatdecoder.h:261
AvFormatDecoder::ProcessVBIDataPacket
void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt)
Process ivtv proprietary embedded vertical blanking interval captions.
Definition: avformatdecoder.cpp:3543
AvFormatDecoder::m_isDbIgnored
bool m_isDbIgnored
Definition: avformatdecoder.h:237
AvFormatDecoder::PreProcessVideoPacket
bool PreProcessVideoPacket(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3184
AvFormatDecoder::m_audioReadAhead
std::chrono::milliseconds m_audioReadAhead
Definition: avformatdecoder.h:323
AvFormatDecoder::FlagIsSet
bool FlagIsSet(PlayerFlags arg)
Definition: avformatdecoder.h:227
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:314
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2530
AudioInfo::m_doPassthru
bool m_doPassthru
Definition: avformatdecoder.h:58
AvFormatDecoder::m_averrorCount
int m_averrorCount
Definition: avformatdecoder.h:282
AvFormatDecoder::ScanRawTextCaptions
void ScanRawTextCaptions(int av_stream_index)
Definition: avformatdecoder.cpp:1777
AvFormatDecoder::m_hasVideo
bool m_hasVideo
Definition: avformatdecoder.h:265
AvFormatDecoder::m_needDummyVideoFrames
bool m_needDummyVideoFrames
Definition: avformatdecoder.h:266
AvFormatDecoder::ForceSetupAudioStream
void ForceSetupAudioStream(void) override
Definition: avformatdecoder.cpp:4949
AvFormatDecoder::m_lastCcPtsu
std::chrono::microseconds m_lastCcPtsu
Definition: avformatdecoder.h:274
AvFormatDecoder::DoFastForward
bool DoFastForward(long long desiredFrame, bool discardFrames=true) override
Skips ahead or rewinds to desiredFrame.
Definition: avformatdecoder.cpp:595
AvFormatDecoder::HandleGopStart
void HandleGopStart(AVPacket *pkt, bool can_reliably_parse_keyframes)
Update our position map, keyframe distance, and the like.
Definition: avformatdecoder.cpp:2868
AvFormatDecoder::GetXDS
QString GetXDS(const QString &Key) const override
Definition: avformatdecoder.cpp:3952
AvFormatDecoder::m_avCodecLock
QRecursiveMutex m_avCodecLock
Definition: avformatdecoder.h:325
AudioInfo::format
AudioFormat format
Definition: avformatdecoder.h:53
AudioOutputSettings
Definition: audiooutputsettings.h:48
AudioInfo::m_originalChannels
int m_originalChannels
Definition: avformatdecoder.h:59
AvFormatDecoder::DoRewindSeek
bool DoRewindSeek(long long desiredFrame) override
Definition: avformatdecoder.cpp:2467
AvFormatDecoder::m_audioOut
AudioInfo m_audioOut
Definition: avformatdecoder.h:315
AvFormatDecoder::GetSubtitleLanguage
virtual int GetSubtitleLanguage(uint, uint StreamIndex)
Returns DVD Subtitle language.
Definition: avformatdecoder.cpp:2488
AvFormatDecoder::m_avcParser
AVCParser * m_avcParser
Definition: avformatdecoder.h:239
AvFormatDecoder::m_resetHardwareDecoders
bool m_resetHardwareDecoders
Definition: avformatdecoder.h:320
AvFormatDecoder::UpdateCaptionTracksFromStreams
void UpdateCaptionTracksFromStreams(bool check_608, bool check_708)
Definition: avformatdecoder.cpp:2799
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:305
AvFormatDecoder::PostProcessTracks
virtual void PostProcessTracks(void)
Definition: avformatdecoder.h:219
AvFormatDecoder::GetCodecDecoderName
QString GetCodecDecoderName(void) const override
Definition: avformatdecoder.cpp:4917
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:24
AvFormatDecoder::CanHandle
static bool CanHandle(TestBufferVec &testbuf, const QString &filename)
Perform an av_probe_input_format on the passed data to see if we can decode it with this class.
Definition: avformatdecoder.cpp:825
decoderbase.h
AvFormatDecoder::DecodeCCx08
void DecodeCCx08(const uint8_t *buf, uint buf_size)
Definition: avformatdecoder.cpp:2758
AvFormatDecoder::AutoSelectTrack
int AutoSelectTrack(uint type) override
Select best track.
Definition: avformatdecoder.cpp:4016
AvFormatDecoder::H264PreProcessPkt
int H264PreProcessPkt(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3082
AvFormatDecoder::m_firstVPtsInuse
bool m_firstVPtsInuse
Definition: avformatdecoder.h:276
AvFormatDecoder::m_codecMap
MythCodecMap m_codecMap
Definition: avformatdecoder.h:242
AvFormatDecoder::AddTextData
void AddTextData(unsigned char *buf, int len, int64_t timecode, char type)
AvFormatDecoder::m_gopSet
bool m_gopSet
Definition: avformatdecoder.h:253
AvFormatDecoder::selectBestAudioTrack
int selectBestAudioTrack(int lang_key, const std::vector< int > &ftype)
Definition: avformatdecoder.cpp:4084
AvFormatDecoder::GetVideoCodecID
MythCodecID GetVideoCodecID(void) const override
Definition: avformatdecoder.h:113
AvFormatDecoder::m_pmtTrackTypes
QList< TrackType > m_pmtTrackTypes
TrackType (608 or 708) for Captions seen in the PMT descriptor.
Definition: avformatdecoder.h:299
AvFormatDecoder::ProcessDVBDataPacket
void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt)
Process DVB Teletext.
Definition: avformatdecoder.cpp:3628
mythcodeccontext.h
AvFormatDecoder::SetupAudioStream
bool SetupAudioStream(void)
Reinitializes audio if it needs to be reinitialized.
Definition: avformatdecoder.cpp:5005
AvFormatDecoder::GetNumChapters
int GetNumChapters() override
Definition: avformatdecoder.cpp:519
AvFormatDecoder::m_swsCtx
struct SwsContext * m_swsCtx
Definition: avformatdecoder.h:250
AvFormatDecoder::filter_max_ch
int filter_max_ch(const AVFormatContext *ic, const sinfo_vec_t &tracks, const std::vector< int > &fs, enum AVCodecID codecId=AV_CODEC_ID_NONE, int profile=-1)
Definition: avformatdecoder.cpp:4054
AvFormatDecoder::ScanTeletextCaptions
void ScanTeletextCaptions(int av_index)
Definition: avformatdecoder.cpp:1720
AvFormatDecoder::m_disablePassthru
bool m_disablePassthru
Definition: avformatdecoder.h:312
AvFormatDecoder::InitVideoCodec
void InitVideoCodec(AVStream *stream, AVCodecContext *codecContext, bool selectedStream=false)
Definition: avformatdecoder.cpp:1370
AvFormatDecoder::AvFormatDecoder
AvFormatDecoder(MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
Definition: avformatdecoder.cpp:362
AvFormatDecoder::GetVideoFrameRate
float GetVideoFrameRate(AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
Definition: avformatdecoder.cpp:1218
AvFormatDecoder::OpenAVCodec
bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
Definition: avformatdecoder.cpp:2433
AvFormatDecoder::~AvFormatDecoder
~AvFormatDecoder() override
Definition: avformatdecoder.cpp:392
TrackType
TrackType
Track types.
Definition: decoderbase.h:26
AvFormatDecoder::CloseContext
void CloseContext()
Definition: avformatdecoder.cpp:442
MythVideoFrame
Definition: mythframe.h:87
AvFormatDecoder::m_ttd
TeletextDecoder * m_ttd
Definition: avformatdecoder.h:287
InteractiveTV
This is the interface between an MHEG engine and a MythTV TV object.
Definition: interactivetv.h:15
AvFormatDecoder::SetupAudioStreamSubIndexes
void SetupAudioStreamSubIndexes(int streamIndex)
Reacts to DUAL/STEREO changes on the fly and fix streams.
Definition: avformatdecoder.cpp:2562
MythAVFormatBuffer
Definition: mythavformatbuffer.h:12
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4546
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:291
build_compdb.filename
filename
Definition: build_compdb.py:21
AvFormatDecoder::get_current_AVStream_index
int get_current_AVStream_index(TrackType type)
Definition: avformatdecoder.cpp:5205
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:2472
AvFormatDecoder::operator=
AvFormatDecoder & operator=(const AvFormatDecoder &)=delete
audiooutputsettings.h
AvFormatDecoder::m_frameDecoded
int m_frameDecoded
Definition: avformatdecoder.h:246
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:2090
AvFormatDecoder::ProcessSubtitlePacket
bool ProcessSubtitlePacket(AVCodecContext *codecContext, AVStream *stream, AVPacket *pkt)
Definition: avformatdecoder.cpp:3723
AvFormatDecoder::UpdateATSCCaptionTracks
void UpdateATSCCaptionTracks(void)
Definition: avformatdecoder.cpp:1651
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:43
DecoderBase
Definition: decoderbase.h:120
AvFormatDecoder::m_ccd608
CC608Decoder * m_ccd608
Definition: avformatdecoder.h:285
AvFormatDecoder::DoPassThrough
bool DoPassThrough(const AVCodecParameters *par, bool withProfile=true)
Definition: avformatdecoder.cpp:4978
AvFormatDecoder::streams_changed
static void streams_changed(void *data, int avprogram_id)
Definition: avformatdecoder.cpp:852
uint
unsigned int uint
Definition: freesurround.h:24
AvFormatDecoder::m_startCodeState
uint32_t m_startCodeState
Definition: avformatdecoder.h:270