MythTV  master
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
AvFormatDecoderBD Class Reference

#include <avformatdecoderbd.h>

Inheritance diagram for AvFormatDecoderBD:
Inheritance graph
[legend]
Collaboration diagram for AvFormatDecoderBD:
Collaboration graph
[legend]

Public Member Functions

 AvFormatDecoderBD (MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
 
void Reset (bool reset_video_data, bool seek_reset, bool reset_file) override
 
void UpdateFramesPlayed (void) override
 
int ReadPacket (AVFormatContext *ctx, AVPacket *pkt, bool &storePacket) override
 
- Public Member Functions inherited from AvFormatDecoder
 AvFormatDecoder (MythPlayer *parent, const ProgramInfo &pginfo, PlayerFlags flags)
 
virtual ~AvFormatDecoder ()
 
void SetEof (bool eof) override
 
void CloseCodecs ()
 
void CloseContext ()
 
void Reset (bool reset_video_data, bool seek_reset, bool reset_file) override
 
int OpenFile (RingBuffer *rbuffer, bool novideo, char testbuf[kDecoderProbeBufferSize], int testbufsize=kDecoderProbeBufferSize) override
 Open our file and set up or audio and video parameters. More...
 
bool GetFrame (DecodeType Type, bool &Retry) override
 Demux, preprocess and possibly decode a frame of video/audio. More...
 
bool IsLastFrameKey (void) const override
 
void WriteStoredData (RingBuffer *rb, bool storevid, long timecodeOffset) override
 This is a No-op for this class. More...
 
void SetRawAudioState (bool state) override
 This is a No-op for this class. More...
 
bool GetRawAudioState (void) const override
 This is a No-op for this class. More...
 
void SetRawVideoState (bool state) override
 This is a No-op for this class. More...
 
bool GetRawVideoState (void) const override
 This is a No-op for this class. More...
 
long UpdateStoredFrameNum (long frame) override
 This is a No-op for this class. More...
 
QString GetCodecDecoderName (void) const override
 
QString GetRawEncodingType (void) override
 
MythCodecID GetVideoCodecID (void) const override
 
void SetDisablePassThrough (bool disable) override
 Disables AC3/DTS pass through. More...
 
void ForceSetupAudioStream (void) override
 
void AddTextData (unsigned char *buf, int len, int64_t timecode, char type)
 
QString GetTrackDesc (uint type, uint trackNo) const override
 
int SetTrack (uint type, int trackNo) override
 
int ScanStreams (bool novideo)
 
int FindStreamInfo (void)
 
int GetNumChapters () override
 
void GetChapterTimes (QList< long long > &times) override
 
int GetCurrentChapter (long long framesPlayed) override
 
long long GetChapter (int chapter) override
 
bool DoRewind (long long desiredFrame, bool discardFrames=true) override
 
bool DoFastForward (long long desiredFrame, bool discardFrames=true) override
 Skips ahead or rewinds to desiredFrame. More...
 
void SetIdrOnlyKeyframes (bool value) override
 
int64_t NormalizeVideoTimecode (int64_t timecode) override
 
virtual int64_t NormalizeVideoTimecode (AVStream *st, int64_t timecode)
 
int GetTeletextDecoderType (void) const override
 
QString GetXDS (const QString &) const override
 
QByteArray GetSubHeader (uint trackNo) const override
 
void GetAttachmentData (uint trackNo, QByteArray &filename, QByteArray &data) override
 
bool SetAudioByComponentTag (int tag) override
 
bool SetVideoByComponentTag (int tag) override
 
virtual int GetTeletextLanguage (uint lang_idx) const
 Returns TeleText language. More...
 
virtual int GetCaptionLanguage (TrackType trackType, int service_num)
 Return ATSC Closed Caption Language. More...
 
virtual AudioTrackType GetAudioTrackType (uint stream_index)
 
- Public Member Functions inherited from DecoderBase
 DecoderBase (MythPlayer *parent, const ProgramInfo &pginfo)
 
 DecoderBase (const DecoderBase &rhs)
 
virtual ~DecoderBase ()
 
virtual void SetEofState (EofState eof)
 
EofState GetEof (void)
 
void SetSeekSnap (uint64_t snap)
 
uint64_t GetSeekSnap (void) const
 
void SetLiveTVMode (bool live)
 
void SetProgramInfo (const ProgramInfo &pginfo)
 
virtual void SetWatchingRecording (bool mode)
 
MythPlayerGetPlayer ()
 
uint64_t TranslatePositionFrameToMs (long long position, float fallback_framerate, const frm_dir_map_t &cutlist)
 
uint64_t TranslatePositionMsToFrame (uint64_t dur_ms, float fallback_framerate, const frm_dir_map_t &cutlist)
 
float GetVideoAspect (void) const
 
virtual void ClearStoredData (void)
 
virtual double GetFPS (void) const
 
uint GetRawBitrate (void) const
 Returns the estimated bitrate if the video were played at normal speed. More...
 
long long GetFramesRead (void) const
 
long long GetFramesPlayed (void) const
 
void SetFramesPlayed (long long newValue)
 
virtual void ResetPosMap (void)
 
virtual bool SyncPositionMap (void)
 Updates the position map used for skipping frames. More...
 
virtual bool PosMapFromDb (void)
 
virtual bool PosMapFromEnc (void)
 Queries encoder for position map data that has not been committed to the DB yet. More...
 
virtual bool FindPosition (long long desired_value, bool search_adjusted, int &lower_bound, int &upper_bound)
 
uint64_t SavePositionMapDelta (long long first_frame, long long last_frame)
 
void SetTranscoding (bool value)
 
bool IsErrored () const
 
bool HasPositionMap (void) const
 
void SetWaitForChange (void)
 
bool GetWaitForChange (void) const
 
void SetReadAdjust (long long adjust)
 
void SetDecodeAllSubtitles (bool val)
 
virtual QStringList GetTracks (uint type) const
 
virtual uint GetTrackCount (uint type) const
 
virtual int GetTrackLanguageIndex (uint type, uint trackNo) const
 
int GetTrack (uint type) const
 
StreamInfo GetTrackInfo (uint type, uint trackNo) const
 
int IncrementTrack (uint type)
 
int DecrementTrack (uint type)
 
int ChangeTrack (uint type, int dir)
 
virtual bool InsertTrack (uint type, const StreamInfo &)
 
int NextTrack (uint type)
 
void SaveTotalDuration (void)
 
void ResetTotalDuration (void)
 
void SaveTotalFrames (void)
 
void TrackTotalDuration (bool track)
 
int GetfpsMultiplier (void)
 
MythCodecContextGetMythCodecContext (void)
 
VideoDisplayProfileGetVideoDisplayProfile (void)
 
AVPixelFormat GetBestVideoFormat (AVPixelFormat *Formats)
 Find a suitable frame format that is mutually acceptable to the decoder and render device. More...
 

Protected Member Functions

bool IsValidStream (int streamid) override
 
- Protected Member Functions inherited from AvFormatDecoder
int AutoSelectTrack (uint type) override
 Select best track. More...
 
void ScanATSCCaptionStreams (int av_index)
 
void UpdateATSCCaptionTracks (void)
 
void UpdateCaptionTracksFromStreams (bool check_608, bool check_708)
 
void ScanTeletextCaptions (int av_index)
 
void ScanRawTextCaptions (int av_stream_index)
 
void ScanDSMCCStreams (void)
 Check to see whether there is a Network Boot Ifo sub-descriptor in the PMT which requires the MHEG application to reboot. More...
 
int AutoSelectAudioTrack (void)
 Selects the best audio track. More...
 
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)
 
void DecodeDTVCC (const uint8_t *buf, uint buf_size, bool scte)
 
void DecodeCCx08 (const uint8_t *buf, uint buf_size, bool scte)
 
void InitByteContext (bool forceseek=false)
 
void InitVideoCodec (AVStream *stream, AVCodecContext *enc, bool selectedStream=false)
 
void MpegPreProcessPkt (AVStream *stream, AVPacket *pkt)
 Preprocess a packet, setting the video parms if necessary. More...
 
int H264PreProcessPkt (AVStream *stream, AVPacket *pkt)
 
bool PreProcessVideoPacket (AVStream *stream, AVPacket *pkt)
 
virtual bool ProcessVideoPacket (AVStream *stream, AVPacket *pkt, bool &Retry)
 
virtual bool ProcessVideoFrame (AVStream *Stream, AVFrame *AvFrame)
 
bool ProcessAudioPacket (AVStream *stream, AVPacket *pkt, DecodeType decodetype)
 
bool ProcessSubtitlePacket (AVStream *stream, AVPacket *pkt)
 
bool ProcessRawTextPacket (AVPacket *pkt)
 
virtual bool ProcessDataPacket (AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
 
void ProcessVBIDataPacket (const AVStream *stream, const AVPacket *pkt)
 Process ivtv proprietary embedded vertical blanking interval captions. More...
 
void ProcessDVBDataPacket (const AVStream *stream, const AVPacket *pkt)
 Process DVB Teletext. More...
 
void ProcessDSMCCPacket (const AVStream *stream, const AVPacket *pkt)
 Process DSMCC object carousel packet. More...
 
void SeekReset (long long, uint skipFrames, bool doFlush, bool discardFrames) override
 
bool DecoderWillDownmix (const AVCodecContext *ctx)
 
bool DoPassThrough (const AVCodecParameters *par, bool withProfile=true)
 
bool SetupAudioStream (void)
 Reinitializes audio if it needs to be reinitialized. More...
 
void SetupAudioStreamSubIndexes (int streamIndex)
 Reacts to DUAL/STEREO changes on the fly and fix streams. More...
 
void RemoveAudioStreams ()
 remove audio streams from the context used by dvd code during title transitions to remove stale audio streams More...
 
void HandleGopStart (AVPacket *pkt, bool can_reliably_parse_keyframes)
 Update our position map, keyframe distance, and the like. More...
 
bool GenerateDummyVideoFrames (void)
 
bool HasVideo (const AVFormatContext *ic)
 
float normalized_fps (AVStream *stream, AVCodecContext *enc)
 
void UpdateFramesPlayed (void) override
 
bool DoRewindSeek (long long desiredFrame) override
 
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 it if exact seeks is not enabled. More...
 
virtual void PostProcessTracks (void)
 
int DecodeAudio (AVCodecContext *ctx, uint8_t *buffer, int &data_size, AVPacket *pkt)
 
- Protected Member Functions inherited from DecoderBase
void AutoSelectTracks (void)
 
void ResetTracks (void)
 
void FileChanged (void)
 
long long ConditionallyUpdatePosMap (long long desiredFrame)
 
long long GetLastFrameInPosMap (void) const
 
unsigned long GetPositionMapSize (void) const
 
long long GetKey (const PosMapEntry &entry) const
 

Private Member Functions

bool DoRewindSeek (long long desiredFrame) override
 
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 it if exact seeks is not enabled. More...
 
void StreamChangeCheck (void) override
 
int GetSubtitleLanguage (uint subtitle_index, uint stream_index) override
 Returns DVD Subtitle language. More...
 
int GetAudioLanguage (uint audio_index, uint stream_index) override
 
long long BDFindPosition (long long desiredFrame)
 

Additional Inherited Members

- Static Public Member Functions inherited from AvFormatDecoder
static void GetDecoders (RenderOptions &opts)
 
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. More...
 
static int GetMaxReferenceFrames (AVCodecContext *Context)
 
- Static Public Member Functions inherited from DecoderBase
static uint64_t TranslatePositionAbsToRel (const frm_dir_map_t &deleteMap, uint64_t absPosition, const frm_pos_map_t &map=frm_pos_map_t(), float fallback_ratio=1.0)
 
static uint64_t TranslatePositionRelToAbs (const frm_dir_map_t &deleteMap, uint64_t relPosition, const frm_pos_map_t &map=frm_pos_map_t(), float fallback_ratio=1.0)
 
static uint64_t TranslatePosition (const frm_pos_map_t &map, long long key, float fallback_ratio)
 
- Static Protected Member Functions inherited from AvFormatDecoder
static void av_update_stream_timings_video (AVFormatContext *ic)
 
static bool OpenAVCodec (AVCodecContext *avctx, const AVCodec *codec)
 
- Protected Attributes inherited from AvFormatDecoder
PrivateDecoderm_private_dec {nullptr}
 
bool m_is_db_ignored
 
H264Parserm_h264_parser {nullptr}
 
AVFormatContext * m_ic {nullptr}
 
URLContext m_readcontext {}
 
int m_frame_decoded {0}
 
VideoFramem_decoded_video_frame {nullptr}
 
AVFRingBufferm_avfRingBuffer {nullptr}
 
struct SwsContext * m_sws_ctx {nullptr}
 
bool m_directrendering {false}
 
bool m_no_dts_hack {false}
 
bool m_dorewind {false}
 
bool m_gopset {false}
 
bool m_seen_gop {false}
 A flag to indicate that we've seen a GOP frame. Used in junction with seq_count. More...
 
int m_seq_count {0}
 A counter used to determine if we need to force a call to HandleGopStart. More...
 
QList< AVPacket * > m_storedPackets
 
int m_prevgoppos {0}
 
bool m_gotVideoFrame {false}
 
bool m_hasVideo {false}
 
bool m_needDummyVideoFrames {false}
 
bool m_skipaudio {false}
 
bool m_allowedquit {false}
 
uint32_t m_start_code_state {0xffffffff}
 
long long m_lastvpts {0}
 
long long m_lastapts {0}
 
long long m_lastccptsu {0}
 
long long m_firstvpts {0}
 
bool m_firstvptsinuse {false}
 
int64_t m_faulty_pts {0}
 
int64_t m_faulty_dts {0}
 
int64_t m_last_pts_for_fault_detection {0}
 
int64_t m_last_dts_for_fault_detection {0}
 
bool m_pts_detected {false}
 
bool m_reordered_pts_detected {false}
 
bool m_pts_selected {true}
 
bool m_use_frame_timing {false}
 
bool m_force_dts_timestamps {false}
 
PlayerFlags playerFlags
 
MythCodecID m_video_codec_id {kCodec_NONE}
 
int m_maxkeyframedist {-1}
 
int m_averror_count {0}
 
uint m_ignore_scte {0}
 
uint m_invert_scte_field {0}
 
uint m_last_scte_field {0}
 
CC608Decoderm_ccd608 {nullptr}
 
CC708Decoderm_ccd708 {nullptr}
 
TeletextDecoderm_ttd {nullptr}
 
int m_cc608_parity_table [256] {0}
 
bool m_ccX08_in_pmt [64+4] {}
 Lookup table for whether a stream was seen in the PMT entries 0-3 correspond to CEA-608 CC1 through CC4, while entries 4-67 corresport to CEA-708 streams 0 through 64. More...
 
bool m_ccX08_in_tracks [64+4] {}
 Lookup table for whether a stream is represented in the UI entries 0-3 correspond to CEA-608 CC1 through CC4, while entries 4-67 corresport to CEA-708 streams 0 through 64. More...
 
QList< StreamInfom_pmt_tracks
 StreamInfo for 608 and 708 Captions seen in the PMT descriptor. More...
 
QList< TrackTypem_pmt_track_types
 TrackType (608 or 708) for Captions seen in the PMT descriptor. More...
 
QList< StreamInfom_stream_tracks
 StreamInfo for 608 and 708 Captions seen in the caption stream itself but not seen in the PMT. More...
 
QList< TrackTypem_stream_track_types
 TrackType (608 or 708) for Captions seen in the caption stream itself but not seen in the PMT. More...
 
InteractiveTVm_itv {nullptr}
 MHEG/MHP decoder. More...
 
uint8_t * m_audioSamples {nullptr}
 
bool m_disable_passthru {false}
 
AudioInfo m_audioIn
 
AudioInfo m_audioOut
 
float m_fps {0.0F}
 
bool m_processFrames {true}
 
bool m_streams_changed { false }
 
bool m_resetHardwareDecoders { false }
 
int m_audioReadAhead {100}
 
- Protected Attributes inherited from DecoderBase
MythPlayerm_parent {nullptr}
 
ProgramInfom_playbackinfo {nullptr}
 
AudioPlayerm_audio {nullptr}
 
RingBufferringBuffer {nullptr}
 
int m_current_width {640}
 
int m_current_height {480}
 
float m_current_aspect {1.33333f}
 
double m_fps {29.97}
 
int m_fpsMultiplier {1}
 
int m_fpsSkip {0}
 
uint m_bitrate {4000}
 
long long m_framesPlayed {0}
 
long long m_framesRead {0}
 
unsigned long long m_frameCounter {0}
 
AVRational m_totalDuration
 
long long m_lastKey {0}
 
int m_keyframedist {-1}
 
long long m_indexOffset {0}
 
MythAVCopy m_copyFrame
 
bool m_trackTotalDuration {false}
 
EofState m_ateof {kEofStateNone}
 
bool m_exitafterdecoded {false}
 
bool m_transcoding {false}
 
bool m_hasFullPositionMap {false}
 
bool m_recordingHasPositionMap {false}
 
bool m_posmapStarted {false}
 
MarkTypes m_positionMapType {MARK_UNSET}
 
QMutex m_positionMapLock {QMutex::Recursive}
 
vector< PosMapEntrym_positionMap
 
frm_pos_map_t m_frameToDurMap
 
frm_pos_map_t m_durToFrameMap
 
bool m_dontSyncPositionMap {false}
 
QDateTime m_lastPositionMapUpdate
 
uint64_t m_seeksnap {UINT64_MAX}
 
bool m_livetv {false}
 
bool m_watchingrecording {false}
 
bool m_hasKeyFrameAdjustTable {false}
 
bool m_getrawframes {false}
 
bool m_getrawvideo {false}
 
bool m_errored {false}
 
bool m_waitingForChange {false}
 
long long m_readAdjust {0}
 
bool m_justAfterChange {false}
 
int m_videoRotation {0}
 
bool m_decodeAllSubtitles {false}
 
int m_currentTrack [kTrackTypeCount]
 
sinfo_vec_t m_tracks [kTrackTypeCount]
 
StreamInfo m_wantedTrack [kTrackTypeCount]
 
StreamInfo m_selectedTrack [(uint) kTrackTypeCount]
 
vector< int > m_languagePreference
 language preferences for auto-selection of streams More...
 
MythCodecContextm_mythcodecctx {nullptr}
 
VideoDisplayProfile m_videoDisplayProfile
 

Detailed Description

Definition at line 6 of file avformatdecoderbd.h.

Constructor & Destructor Documentation

◆ AvFormatDecoderBD()

AvFormatDecoderBD::AvFormatDecoderBD ( MythPlayer parent,
const ProgramInfo pginfo,
PlayerFlags  flags 
)

Definition at line 9 of file avformatdecoderbd.cpp.

Member Function Documentation

◆ Reset()

void AvFormatDecoderBD::Reset ( bool  reset_video_data,
bool  seek_reset,
bool  reset_file 
)
overridevirtual

Reimplemented from DecoderBase.

Definition at line 22 of file avformatdecoderbd.cpp.

Referenced by StreamChangeCheck().

◆ UpdateFramesPlayed()

void AvFormatDecoderBD::UpdateFramesPlayed ( void  )
overridevirtual

Reimplemented from DecoderBase.

Definition at line 28 of file avformatdecoderbd.cpp.

Referenced by StreamChangeCheck().

◆ ReadPacket()

int AvFormatDecoderBD::ReadPacket ( AVFormatContext *  ctx,
AVPacket *  pkt,
bool storePacket 
)
overridevirtual

Reimplemented from AvFormatDecoder.

Definition at line 113 of file avformatdecoderbd.cpp.

◆ IsValidStream()

bool AvFormatDecoderBD::IsValidStream ( int  streamid)
overrideprotectedvirtual

Reimplemented from AvFormatDecoder.

Definition at line 15 of file avformatdecoderbd.cpp.

◆ DoRewindSeek()

bool AvFormatDecoderBD::DoRewindSeek ( long long  desiredFrame)
overrideprivatevirtual

Reimplemented from DecoderBase.

Definition at line 38 of file avformatdecoderbd.cpp.

◆ DoFastForwardSeek()

void AvFormatDecoderBD::DoFastForwardSeek ( long long  desiredFrame,
bool needflush 
)
overrideprivatevirtual

Seeks to the keyframe just before the desiredFrame if exact seeks is enabled, or the frame just after it if exact seeks is not enabled.

The seek is not made if framesPlayed is greater than the keyframe this would jump too. This means that frame-by-frame seeking after a keyframe must be done elsewhere.

If the seek is made the needflush parameter is set.

Parameters
desiredFrameframe we are attempting to seek to.
needflushset to true if a seek is made.

Reimplemented from DecoderBase.

Definition at line 49 of file avformatdecoderbd.cpp.

◆ StreamChangeCheck()

void AvFormatDecoderBD::StreamChangeCheck ( void  )
overrideprivatevirtual

Reimplemented from AvFormatDecoder.

Definition at line 60 of file avformatdecoderbd.cpp.

◆ GetSubtitleLanguage()

int AvFormatDecoderBD::GetSubtitleLanguage ( uint  subtitle_index,
uint  stream_index 
)
overrideprivatevirtual

Returns DVD Subtitle language.

Reimplemented from AvFormatDecoder.

Definition at line 86 of file avformatdecoderbd.cpp.

◆ GetAudioLanguage()

int AvFormatDecoderBD::GetAudioLanguage ( uint  audio_index,
uint  stream_index 
)
overrideprivatevirtual

Reimplemented from AvFormatDecoder.

Definition at line 100 of file avformatdecoderbd.cpp.

◆ BDFindPosition()

long long AvFormatDecoderBD::BDFindPosition ( long long  desiredFrame)
private

Definition at line 142 of file avformatdecoderbd.cpp.

Referenced by DoFastForwardSeek(), and DoRewindSeek().


The documentation for this class was generated from the following files: