MythTV master
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MythCodecContext Class Reference

#include <libmythtv/decoders/mythcodeccontext.h>

Inheritance diagram for MythCodecContext:
[legend]
Collaboration diagram for MythCodecContext:
[legend]

Public Types

enum  CodecProfile : std::uint8_t {
  NoProfile = 0 , MPEG1 , MPEG2 , MPEG2Simple ,
  MPEG2Main , MPEG2422 , MPEG2High , MPEG2Spatial ,
  MPEG2SNR , MPEG4 , MPEG4Simple , MPEG4SimpleScaleable ,
  MPEG4Core , MPEG4Main , MPEG4NBit , MPEG4ScaleableTexture ,
  MPEG4SimpleFace , MPEG4BasicAnimated , MPEG4Hybrid , MPEG4AdvancedRT ,
  MPEG4CoreScaleable , MPEG4AdvancedCoding , MPEG4AdvancedCore , MPEG4AdvancedScaleableTexture ,
  MPEG4SimpleStudio , MPEG4AdvancedSimple , H263 , H264 ,
  H264Baseline , H264ConstrainedBaseline , H264Main , H264MainExtended ,
  H264High , H264High10 , H264Extended , H264High422 ,
  H264High444 , H264ConstrainedHigh , HEVC , HEVCMain ,
  HEVCMain10 , HEVCMainStill , HEVCRext , HEVCMain10HDR ,
  HEVCMain10HDRPlus , VC1 , VC1Simple , VC1Main ,
  VC1Complex , VC1Advanced , VP8 , VP9 ,
  VP9_0 , VP9_1 , VP9_2 , VP9_3 ,
  VP9_2HDR , VP9_2HDRPlus , VP9_3HDR , VP9_3HDRPlus ,
  AV1 , AV1Main , AV1High , AV1Professional ,
  MJPEG
}
 

Public Member Functions

 MythCodecContext (DecoderBase *Parent, MythCodecID CodecID)
 
virtual ~MythCodecContext ()=default
 
virtual void InitVideoCodec (AVCodecContext *Context, bool SelectedStream, bool &DirectRendering)
 
virtual int HwDecoderInit (AVCodecContext *)
 
virtual bool RetrieveFrame (AVCodecContext *, MythVideoFrame *, AVFrame *)
 
virtual int FilteredReceiveFrame (AVCodecContext *Context, AVFrame *Frame)
 Retrieve and process/filter AVFrame. More...
 
virtual void SetDeinterlacing (AVCodecContext *, MythVideoProfile *, bool)
 
virtual void PostProcessFrame (AVCodecContext *, MythVideoFrame *)
 
virtual bool IsDeinterlacing (bool &, bool=false)
 
virtual void SetDecoderOptions (AVCodecContext *, const AVCodec *)
 
virtual bool DecoderWillResetOnFlush (void)
 
virtual bool DecoderWillResetOnAspect (void)
 
virtual bool DecoderNeedsReset (AVCodecContext *)
 

Static Public Member Functions

static MythCodecContextCreateContext (DecoderBase *Parent, MythCodecID Codec)
 
static void GetDecoders (RenderOptions &Opts, bool Reinit=false)
 
static QStringList GetDecoderDescription (void)
 
static MythCodecID FindDecoder (const QString &Decoder, AVStream *Stream, AVCodecContext **Context, const AVCodec **Codec)
 
static int GetBuffer (struct AVCodecContext *Context, AVFrame *Frame, int Flags)
 A generic hardware buffer initialisation method when using AVHWFramesContext. More...
 
static bool GetBuffer2 (struct AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int Flags)
 A generic hardware buffer initialisation method when AVHWFramesContext is NOT used. More...
 
static int InitialiseDecoder (AVCodecContext *Context, CreateHWDecoder Callback, const QString &Debug)
 Initialise a hardware decoder that is expected to use AVHWFramesContext. More...
 
static int InitialiseDecoder2 (AVCodecContext *Context, CreateHWDecoder Callback, const QString &Debug)
 Initialise a hardware decoder that is NOT expected to use AVHWFramesContext. More...
 
static void ReleaseBuffer (void *Opaque, uint8_t *Data)
 
static void FramesContextFinished (AVHWFramesContext *Context)
 
static void DeviceContextFinished (AVHWDeviceContext *Context)
 
static void CreateDecoderCallback (void *Wait, void *Context, void *Callback)
 
static MythPlayerUIGetPlayerUI (AVCodecContext *Context)
 
static bool FrameTypeIsSupported (AVCodecContext *Context, VideoFrameType Format)
 
static AVBufferRef * CreateDevice (AVHWDeviceType Type, MythInteropGPU *Interop, const QString &Device=QString())
 
static bool IsUnsupportedProfile (AVCodecContext *Context)
 Most hardware decoders do not support these codecs/profiles. More...
 
static QString GetProfileDescription (CodecProfile Profile, QSize Size, VideoFrameType Format=FMT_NONE, uint ColorDepth=0)
 
static CodecProfile FFmpegToMythProfile (AVCodecID CodecID, int Profile)
 

Protected Member Functions

virtual bool RetrieveHWFrame (MythVideoFrame *Frame, AVFrame *AvFrame)
 

Static Protected Member Functions

static void DestroyInterop (MythInteropGPU *Interop)
 
static void NewHardwareFramesContext (void)
 Track the number of concurrent frames contexts. More...
 

Protected Attributes

DecoderBasem_parent { nullptr }
 
MythCodecID m_codecID { kCodec_NONE }
 
bool m_resetRequired { false }
 

Static Protected Attributes

static QAtomicInt s_hwFramesContextCount
 

Detailed Description

Definition at line 52 of file mythcodeccontext.h.

Member Enumeration Documentation

◆ CodecProfile

enum MythCodecContext::CodecProfile : std::uint8_t
Enumerator
NoProfile 
MPEG1 
MPEG2 
MPEG2Simple 
MPEG2Main 
MPEG2422 
MPEG2High 
MPEG2Spatial 
MPEG2SNR 
MPEG4 
MPEG4Simple 
MPEG4SimpleScaleable 
MPEG4Core 
MPEG4Main 
MPEG4NBit 
MPEG4ScaleableTexture 
MPEG4SimpleFace 
MPEG4BasicAnimated 
MPEG4Hybrid 
MPEG4AdvancedRT 
MPEG4CoreScaleable 
MPEG4AdvancedCoding 
MPEG4AdvancedCore 
MPEG4AdvancedScaleableTexture 
MPEG4SimpleStudio 
MPEG4AdvancedSimple 
H263 
H264 
H264Baseline 
H264ConstrainedBaseline 
H264Main 
H264MainExtended 
H264High 
H264High10 
H264Extended 
H264High422 
H264High444 
H264ConstrainedHigh 
HEVC 
HEVCMain 
HEVCMain10 
HEVCMainStill 
HEVCRext 
HEVCMain10HDR 
HEVCMain10HDRPlus 
VC1 
VC1Simple 
VC1Main 
VC1Complex 
VC1Advanced 
VP8 
VP9 
VP9_0 
VP9_1 
VP9_2 
VP9_3 
VP9_2HDR 
VP9_2HDRPlus 
VP9_3HDR 
VP9_3HDRPlus 
AV1 
AV1Main 
AV1High 
AV1Professional 
MJPEG 

Definition at line 55 of file mythcodeccontext.h.

Constructor & Destructor Documentation

◆ MythCodecContext()

MythCodecContext::MythCodecContext ( DecoderBase Parent,
MythCodecID  CodecID 
)
explicit

Definition at line 71 of file mythcodeccontext.cpp.

Referenced by CreateContext().

◆ ~MythCodecContext()

virtual MythCodecContext::~MythCodecContext ( )
virtualdefault

Member Function Documentation

◆ CreateContext()

MythCodecContext * MythCodecContext::CreateContext ( DecoderBase Parent,
MythCodecID  Codec 
)
static

Definition at line 77 of file mythcodeccontext.cpp.

Referenced by AvFormatDecoder::InitVideoCodec().

◆ CreateDecoderCallback()

void MythCodecContext::CreateDecoderCallback ( void *  Wait,
void *  Context,
void *  Callback 
)
static

Definition at line 494 of file mythcodeccontext.cpp.

Referenced by InitialiseDecoder(), and InitialiseDecoder2().

◆ CreateDevice()

AVBufferRef * MythCodecContext::CreateDevice ( AVHWDeviceType  Type,
MythInteropGPU Interop,
const QString &  Device = QString() 
)
static

◆ DecoderNeedsReset()

virtual bool MythCodecContext::DecoderNeedsReset ( AVCodecContext *  )
inlinevirtual

Reimplemented in MythVDPAUContext.

Definition at line 160 of file mythcodeccontext.h.

Referenced by AvFormatDecoder::ProcessVideoPacket(), and AvFormatDecoder::SeekReset().

◆ DecoderWillResetOnAspect()

virtual bool MythCodecContext::DecoderWillResetOnAspect ( void  )
inlinevirtual

◆ DecoderWillResetOnFlush()

virtual bool MythCodecContext::DecoderWillResetOnFlush ( void  )
inlinevirtual

◆ DestroyInterop()

void MythCodecContext::DestroyInterop ( MythInteropGPU Interop)
staticprotected

◆ DeviceContextFinished()

void MythCodecContext::DeviceContextFinished ( AVHWDeviceContext *  Context)
static

◆ FFmpegToMythProfile()

MythCodecContext::CodecProfile MythCodecContext::FFmpegToMythProfile ( AVCodecID  CodecID,
int  Profile 
)
static

◆ FilteredReceiveFrame()

int MythCodecContext::FilteredReceiveFrame ( AVCodecContext *  Context,
AVFrame Frame 
)
virtual

Retrieve and process/filter AVFrame.

Note
This default implementation implements no processing/filtering

Reimplemented in MythVAAPIContext.

Definition at line 623 of file mythcodeccontext.cpp.

Referenced by AvFormatDecoder::ProcessVideoPacket().

◆ FindDecoder()

MythCodecID MythCodecContext::FindDecoder ( const QString &  Decoder,
AVStream *  Stream,
AVCodecContext **  Context,
const AVCodec **  Codec 
)
static

Definition at line 250 of file mythcodeccontext.cpp.

Referenced by AvFormatDecoder::autoSelectVideoTrack().

◆ FramesContextFinished()

void MythCodecContext::FramesContextFinished ( AVHWFramesContext *  Context)
static

◆ FrameTypeIsSupported()

bool MythCodecContext::FrameTypeIsSupported ( AVCodecContext *  Context,
VideoFrameType  Format 
)
static

◆ GetBuffer()

int MythCodecContext::GetBuffer ( struct AVCodecContext *  Context,
AVFrame Frame,
int  Flags 
)
static

A generic hardware buffer initialisation method when using AVHWFramesContext.

Definition at line 327 of file mythcodeccontext.cpp.

Referenced by MythVAAPIContext::InitVideoCodec(), and MythVDPAUContext::InitVideoCodec().

◆ GetBuffer2()

bool MythCodecContext::GetBuffer2 ( struct AVCodecContext *  Context,
MythVideoFrame Frame,
AVFrame AvFrame,
int  Flags 
)
static

A generic hardware buffer initialisation method when AVHWFramesContext is NOT used.

Definition at line 377 of file mythcodeccontext.cpp.

Referenced by MythMediaCodecContext::RetrieveFrame(), and MythVTBContext::RetrieveFrame().

◆ GetDecoderDescription()

QStringList MythCodecContext::GetDecoderDescription ( void  )
static

Definition at line 119 of file mythcodeccontext.cpp.

Referenced by StatusBox::doDecoderStatus().

◆ GetDecoders()

void MythCodecContext::GetDecoders ( RenderOptions Opts,
bool  Reinit = false 
)
static

Definition at line 147 of file mythcodeccontext.cpp.

Referenced by MythVideoProfile::InitStatics().

◆ GetPlayerUI()

MythPlayerUI * MythCodecContext::GetPlayerUI ( AVCodecContext *  Context)
static

◆ GetProfileDescription()

QString MythCodecContext::GetProfileDescription ( CodecProfile  Profile,
QSize  Size,
VideoFrameType  Format = FMT_NONE,
uint  ColorDepth = 0 
)
static

◆ HwDecoderInit()

virtual int MythCodecContext::HwDecoderInit ( AVCodecContext *  )
inlinevirtual

◆ InitialiseDecoder()

int MythCodecContext::InitialiseDecoder ( AVCodecContext *  Context,
CreateHWDecoder  Callback,
const QString &  Debug 
)
static

Initialise a hardware decoder that is expected to use AVHWFramesContext.

Definition at line 526 of file mythcodeccontext.cpp.

Referenced by MythVAAPIContext::GetFormat(), and MythVDPAUContext::GetFormat().

◆ InitialiseDecoder2()

int MythCodecContext::InitialiseDecoder2 ( AVCodecContext *  Context,
CreateHWDecoder  Callback,
const QString &  Debug 
)
static

Initialise a hardware decoder that is NOT expected to use AVHWFramesContext.

Definition at line 543 of file mythcodeccontext.cpp.

Referenced by MythV4L2M2MContext::GetV4L2RequestFormat(), MythMediaCodecContext::HwDecoderInit(), MythNVDECContext::HwDecoderInit(), and MythVTBContext::HwDecoderInit().

◆ InitVideoCodec()

void MythCodecContext::InitVideoCodec ( AVCodecContext *  Context,
bool  SelectedStream,
bool DirectRendering 
)
virtual

◆ IsDeinterlacing()

virtual bool MythCodecContext::IsDeinterlacing ( bool ,
bool  = false 
)
inlinevirtual

◆ IsUnsupportedProfile()

bool MythCodecContext::IsUnsupportedProfile ( AVCodecContext *  Context)
static

Most hardware decoders do not support these codecs/profiles.

Definition at line 598 of file mythcodeccontext.cpp.

Referenced by MythNVDECContext::GetSupportedCodec(), MythVDPAUContext::GetSupportedCodec(), and MythVTBContext::GetSupportedCodec().

◆ NewHardwareFramesContext()

void MythCodecContext::NewHardwareFramesContext ( void  )
staticprotected

Track the number of concurrent frames contexts.

More than one hardware frames context is indicative of wider issues and needs to be avoided.

This currently only applies to VDPAU and VAAPI

Definition at line 431 of file mythcodeccontext.cpp.

Referenced by MythVDPAUContext::GetFormat2(), MythNVDECContext::InitFramesContext(), MythVTBContext::InitFramesContext(), MythVAAPIContext::InitialiseContext(), MythVDPAUContext::InitialiseContext(), and MythVAAPIContext::InitialiseContext2().

◆ PostProcessFrame()

virtual void MythCodecContext::PostProcessFrame ( AVCodecContext *  ,
MythVideoFrame  
)
inlinevirtual

Reimplemented in MythMediaCodecContext, MythNVDECContext, and MythVAAPIContext.

Definition at line 155 of file mythcodeccontext.h.

Referenced by AvFormatDecoder::ProcessVideoFrame().

◆ ReleaseBuffer()

void MythCodecContext::ReleaseBuffer ( void *  Opaque,
uint8_t *  Data 
)
static

◆ RetrieveFrame()

virtual bool MythCodecContext::RetrieveFrame ( AVCodecContext *  ,
MythVideoFrame ,
AVFrame  
)
inlinevirtual

◆ RetrieveHWFrame()

bool MythCodecContext::RetrieveHWFrame ( MythVideoFrame Frame,
AVFrame AvFrame 
)
protectedvirtual

◆ SetDecoderOptions()

virtual void MythCodecContext::SetDecoderOptions ( AVCodecContext *  ,
const AVCodec *   
)
inlinevirtual

Reimplemented in MythMMALContext, and MythV4L2M2MContext.

Definition at line 157 of file mythcodeccontext.h.

Referenced by AvFormatDecoder::autoSelectVideoTrack().

◆ SetDeinterlacing()

virtual void MythCodecContext::SetDeinterlacing ( AVCodecContext *  ,
MythVideoProfile ,
bool   
)
inlinevirtual

Reimplemented in MythNVDECContext.

Definition at line 154 of file mythcodeccontext.h.

Referenced by AvFormatDecoder::InitVideoCodec().

Member Data Documentation

◆ m_codecID

MythCodecID MythCodecContext::m_codecID { kCodec_NONE }
protected

◆ m_parent

DecoderBase* MythCodecContext::m_parent { nullptr }
protected

◆ m_resetRequired

bool MythCodecContext::m_resetRequired { false }
protected

Definition at line 170 of file mythcodeccontext.h.

Referenced by MythVDPAUContext::DecoderNeedsReset().

◆ s_hwFramesContextCount

QAtomicInt MythCodecContext::s_hwFramesContextCount
staticprotected

Definition at line 166 of file mythcodeccontext.h.

Referenced by FramesContextFinished(), and NewHardwareFramesContext().


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