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

#include <mythbddecoder.h>

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

Public Member Functions

 MythBDDecoder (MythPlayer *Parent, const ProgramInfo &PGInfo, PlayerFlags Flags)
 
void Reset (bool ResetVideoData, bool SeekReset, bool ResetFile) 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)
 
 ~AvFormatDecoder () override
 
 AvFormatDecoder (const AvFormatDecoder &)=delete
 
AvFormatDecoderoperator= (const AvFormatDecoder &)=delete
 
void SetEof (bool eof) override
 
MythCodecMapCodecMap (void)
 
void CloseCodecs ()
 
void CloseContext ()
 
void Reset (bool reset_video_data, bool seek_reset, bool reset_file) override
 
int OpenFile (MythMediaBuffer *Buffer, 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 (MythMediaBuffer *Buffer, 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) 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 &Key) const override
 
QByteArray GetSubHeader (uint TrackNo) override
 
void GetAttachmentData (uint TrackNo, QByteArray &Filename, QByteArray &Data) override
 
bool SetAudioByComponentTag (int Tag) override
 
bool SetVideoByComponentTag (int Tag) override
 
virtual int GetTeletextLanguage (uint Index)
 Returns TeleText language. More...
 
virtual int GetCaptionLanguage (TrackType TrackType, int ServiceNum)
 Return ATSC Closed Caption Language. More...
 
virtual AudioTrackType GetAudioTrackType (uint StreamIndex)
 
- 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 DecodeAll)
 
virtual QStringList GetTracks (uint Type)
 
virtual uint GetTrackCount (uint Type)
 
virtual int GetTrackLanguageIndex (uint Type, uint TrackNo)
 
int GetTrack (uint Type)
 
StreamInfo GetTrackInfo (uint Type, uint TrackNo)
 
int ChangeTrack (uint Type, int Dir)
 
virtual bool InsertTrack (uint Type, const StreamInfo &Info)
 
int NextTrack (uint Type)
 
void SaveTotalDuration (void)
 
void ResetTotalDuration (void)
 
void SaveTotalFrames (void)
 
void TrackTotalDuration (bool track)
 
int GetfpsMultiplier (void) const
 
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 newkey, 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 GetVideoFrameRate (AVStream *Stream, AVCodecContext *Context, bool Sanitise=false)
 
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 SubtitleIndex, uint StreamIndex) override
 Returns DVD Subtitle language. More...
 
int GetAudioLanguage (uint AudioIndex, uint StreamIndex) 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_privateDec {nullptr}
 
bool m_isDbIgnored
 
AVCParserm_avcParser {nullptr}
 
AVFormatContext * m_ic {nullptr}
 
MythCodecMap m_codecMap { }
 
URLContext m_readContext {}
 
int m_frameDecoded {0}
 
VideoFramem_decodedVideoFrame {nullptr}
 
MythAVFormatBufferm_avfRingBuffer {nullptr}
 
struct SwsContext * m_swsCtx {nullptr}
 
bool m_directRendering {false}
 
bool m_noDtsHack {false}
 
bool m_doRewind {false}
 
bool m_gopSet {false}
 
bool m_seenGop {false}
 A flag to indicate that we've seen a GOP frame. Used in junction with seq_count. More...
 
int m_seqCount {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_startCodeState {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_faultyPts {0}
 
int64_t m_faultyDts {0}
 
int64_t m_lastPtsForFaultDetection {0}
 
int64_t m_lastDtsForFaultDetection {0}
 
bool m_ptsDetected {false}
 
bool m_reorderedPtsDetected {false}
 
bool m_ptsSelected {true}
 
bool m_useFrameTiming {false}
 
bool m_forceDtsTimestamps {false}
 
PlayerFlags m_playerFlags
 
MythCodecID m_videoCodecId {kCodec_NONE}
 
int m_maxKeyframeDist {-1}
 
int m_averrorCount {0}
 
uint m_ignoreScte {0}
 
uint m_invertScteField {0}
 
uint m_lastScteField {0}
 
CC608Decoderm_ccd608 {nullptr}
 
CC708Decoderm_ccd708 {nullptr}
 
TeletextDecoderm_ttd {nullptr}
 
int m_cc608ParityTable [256] {0}
 
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 CC4, while entries 4-67 corresport to CEA-708 streams 0 through 64. More...
 
bool m_ccX08InTracks [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_pmtTracks
 StreamInfo for 608 and 708 Captions seen in the PMT descriptor. More...
 
QList< TrackTypem_pmtTrackTypes
 TrackType (608 or 708) for Captions seen in the PMT descriptor. More...
 
QList< StreamInfom_streamTracks
 StreamInfo for 608 and 708 Captions seen in the caption stream itself but not seen in the PMT. More...
 
QList< TrackTypem_streamTrackTypes
 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_disablePassthru {false}
 
AudioInfo m_audioIn
 
AudioInfo m_audioOut
 
float m_fps {0.0F}
 
bool m_processFrames {true}
 
bool m_streamsChanged { false }
 
bool m_resetHardwareDecoders { false }
 
int m_audioReadAhead {100}
 
- Protected Attributes inherited from DecoderBase
MythPlayerm_parent {nullptr}
 
ProgramInfom_playbackInfo {nullptr}
 
AudioPlayerm_audio {nullptr}
 
MythMediaBufferm_ringBuffer {nullptr}
 
double m_fps {29.97}
 
int m_fpsMultiplier {1}
 
int m_fpsSkip {0}
 
uint m_bitrate {4000}
 
int m_currentWidth {640}
 
int m_currentHeight {480}
 
float m_currentAspect {1.33333F}
 
long long m_framesPlayed {0}
 
long long m_framesRead {0}
 
unsigned long long m_frameCounter {0}
 
AVRational m_totalDuration
 
int m_keyframeDist {-1}
 
long long m_lastKey {0}
 
long long m_indexOffset {0}
 
MythAVCopy m_copyFrame
 
bool m_nextDecodedFrameIsKeyFrame { false }
 
EofState m_atEof {kEofStateNone}
 
bool m_trackTotalDuration {false}
 
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
 
QDateTime m_lastPositionMapUpdate
 
uint64_t m_seekSnap {UINT64_MAX}
 
bool m_dontSyncPositionMap {false}
 
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}
 
bool m_justAfterChange {false}
 
long long m_readAdjust {0}
 
int m_videoRotation {0}
 
QMutex m_trackLock { QMutex::Recursive }
 
bool m_decodeAllSubtitles { false }
 
int m_currentTrack [kTrackTypeCount] { -1 }
 
vector< StreamInfom_tracks [kTrackTypeCount]
 
StreamInfo m_wantedTrack [kTrackTypeCount]
 
StreamInfo m_selectedTrack [kTrackTypeCount]
 
vector< int > m_languagePreference
 language preferences for auto-selection of streams More...
 
MythCodecContextm_mythCodecCtx { nullptr }
 
VideoDisplayProfile m_videoDisplayProfile
 

Detailed Description

Definition at line 7 of file mythbddecoder.h.

Constructor & Destructor Documentation

◆ MythBDDecoder()

MythBDDecoder::MythBDDecoder ( MythPlayer Parent,
const ProgramInfo PGInfo,
PlayerFlags  Flags 
)

Definition at line 9 of file mythbddecoder.cpp.

Member Function Documentation

◆ Reset()

void MythBDDecoder::Reset ( bool  ResetVideoData,
bool  SeekReset,
bool  ResetFile 
)
overridevirtual

Reimplemented from DecoderBase.

Definition at line 21 of file mythbddecoder.cpp.

Referenced by StreamChangeCheck().

◆ UpdateFramesPlayed()

void MythBDDecoder::UpdateFramesPlayed ( void  )
overridevirtual

Reimplemented from DecoderBase.

Definition at line 27 of file mythbddecoder.cpp.

Referenced by StreamChangeCheck().

◆ ReadPacket()

int MythBDDecoder::ReadPacket ( AVFormatContext *  Ctx,
AVPacket *  Pkt,
bool StorePacket 
)
overridevirtual

Reimplemented from AvFormatDecoder.

Definition at line 106 of file mythbddecoder.cpp.

◆ IsValidStream()

bool MythBDDecoder::IsValidStream ( int  StreamId)
overrideprotectedvirtual

Reimplemented from AvFormatDecoder.

Definition at line 14 of file mythbddecoder.cpp.

◆ DoRewindSeek()

bool MythBDDecoder::DoRewindSeek ( long long  DesiredFrame)
overrideprivatevirtual

Reimplemented from DecoderBase.

Definition at line 37 of file mythbddecoder.cpp.

◆ DoFastForwardSeek()

void MythBDDecoder::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 48 of file mythbddecoder.cpp.

◆ StreamChangeCheck()

void MythBDDecoder::StreamChangeCheck ( void  )
overrideprivatevirtual

Reimplemented from AvFormatDecoder.

Definition at line 59 of file mythbddecoder.cpp.

◆ GetSubtitleLanguage()

int MythBDDecoder::GetSubtitleLanguage ( uint  ,
uint  StreamIndex 
)
overrideprivatevirtual

Returns DVD Subtitle language.

Reimplemented from AvFormatDecoder.

Definition at line 84 of file mythbddecoder.cpp.

◆ GetAudioLanguage()

int MythBDDecoder::GetAudioLanguage ( uint  AudioIndex,
uint  StreamIndex 
)
overrideprivatevirtual

Reimplemented from AvFormatDecoder.

Definition at line 95 of file mythbddecoder.cpp.

◆ BDFindPosition()

long long MythBDDecoder::BDFindPosition ( long long  DesiredFrame)
private

Definition at line 132 of file mythbddecoder.cpp.

Referenced by DoFastForwardSeek(), and DoRewindSeek().


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