MythTV master
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Static Private Member Functions | Private Attributes | List of all members
MythV4L2M2MContext Class Reference

A handler for V4L2 Memory2Memory codecs. More...

#include <libmythtv/decoders/mythv4l2m2mcontext.h>

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

Public Member Functions

 MythV4L2M2MContext (DecoderBase *Parent, MythCodecID CodecID)
 
 ~MythV4L2M2MContext () override=default
 
void InitVideoCodec (AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
 
bool RetrieveFrame (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
 
void SetDecoderOptions (AVCodecContext *Context, const AVCodec *Codec) override
 Reduce the number of capture buffers. More...
 
int HwDecoderInit (AVCodecContext *Context) override
 
bool DecoderWillResetOnFlush () override
 
- Public Member Functions inherited from MythDRMPRIMEContext
 MythDRMPRIMEContext (DecoderBase *Parent, MythCodecID CodecID)
 
 ~MythDRMPRIMEContext () override
 
int HwDecoderInit (AVCodecContext *Context) override
 
void InitVideoCodec (AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
 
bool RetrieveFrame (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
 
bool DecoderWillResetOnFlush (void) override
 
bool GetDRMBuffer (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int)
 
- Public Member Functions inherited from MythCodecContext
 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 MythCodecID GetSupportedCodec (AVCodecContext **Context, const AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
 
static bool GetBuffer (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int)
 Retrieve a frame from CPU memory. More...
 
static bool HaveV4L2Codecs (bool Reinit=false)
 
static void GetDecoderList (QStringList &Decoders)
 
static enum AVPixelFormat GetV4L2RequestFormat (AVCodecContext *Context, const AVPixelFormat *PixFmt)
 
static int InitialiseV4L2RequestContext (AVCodecContext *Context)
 
- Static Public Member Functions inherited from MythDRMPRIMEContext
static MythCodecID GetSupportedCodec (AVCodecContext **Context, const AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
 
static bool HavePrimeDecoders (bool Reinit=false, AVCodecID Codec=AV_CODEC_ID_NONE)
 
static enum AVPixelFormat GetFormat (AVCodecContext *Context, const AVPixelFormat *PixFmt)
 
- Static Public Member Functions inherited from MythCodecContext
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)
 

Static Protected Member Functions

static const V4L2ProfilesGetStandardProfiles ()
 
static const V4L2ProfilesGetRequestProfiles ()
 
- Static Protected Member Functions inherited from MythDRMPRIMEContext
static MythCodecID GetPrimeCodec (AVCodecContext **Context, const AVCodec **Codec, AVStream *Stream, MythCodecID Successs, MythCodecID Failure, const QString &CodecName, AVPixelFormat Format)
 
- Static Protected Member Functions inherited from MythCodecContext
static void DestroyInterop (MythInteropGPU *Interop)
 
static void NewHardwareFramesContext (void)
 Track the number of concurrent frames contexts. More...
 

Static Private Member Functions

static V4L2Profiles GetProfiles (const std::vector< V4L2Mapping > &Profiles)
 

Private Attributes

bool m_request { false }
 

Additional Inherited Members

- Public Types inherited from MythCodecContext
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
}
 
- Protected Member Functions inherited from MythCodecContext
virtual bool RetrieveHWFrame (MythVideoFrame *Frame, AVFrame *AvFrame)
 
- Protected Attributes inherited from MythDRMPRIMEContext
MythOpenGLInteropm_interop { nullptr }
 
- Protected Attributes inherited from MythCodecContext
DecoderBasem_parent { nullptr }
 
MythCodecID m_codecID { kCodec_NONE }
 
bool m_resetRequired { false }
 
- Static Protected Attributes inherited from MythDRMPRIMEContext
static QRecursiveMutex s_drmPrimeLock
 
static QStringList s_drmPrimeDecoders
 
- Static Protected Attributes inherited from MythCodecContext
static QAtomicInt s_hwFramesContextCount
 

Detailed Description

A handler for V4L2 Memory2Memory codecs.

The bulk of the 'direct rendering' support is in MythDRMPRIMEContext. This sub-class handles v4l2 specific functionality checks and support for software frame formats.

Definition at line 10 of file mythv4l2m2mcontext.h.

Constructor & Destructor Documentation

◆ MythV4L2M2MContext()

MythV4L2M2MContext::MythV4L2M2MContext ( DecoderBase Parent,
MythCodecID  CodecID 
)

Definition at line 41 of file mythv4l2m2mcontext.cpp.

◆ ~MythV4L2M2MContext()

MythV4L2M2MContext::~MythV4L2M2MContext ( )
overridedefault

Member Function Documentation

◆ DecoderWillResetOnFlush()

bool MythV4L2M2MContext::DecoderWillResetOnFlush ( void  )
overridevirtual

Reimplemented from MythDRMPRIMEContext.

Definition at line 46 of file mythv4l2m2mcontext.cpp.

◆ GetBuffer()

bool MythV4L2M2MContext::GetBuffer ( AVCodecContext *  Context,
MythVideoFrame Frame,
AVFrame AvFrame,
int   
)
static

Retrieve a frame from CPU memory.

This is similar to the default, direct render supporting, get_av_buffer in AvFormatDecoder but we copy the data from the AVFrame rather than providing our own buffer (the codec does not support direct rendering).

Definition at line 211 of file mythv4l2m2mcontext.cpp.

Referenced by RetrieveFrame().

◆ GetDecoderList()

void MythV4L2M2MContext::GetDecoderList ( QStringList &  Decoders)
static

Definition at line 391 of file mythv4l2m2mcontext.cpp.

Referenced by MythCodecContext::GetDecoderDescription().

◆ GetProfiles()

V4L2Profiles MythV4L2M2MContext::GetProfiles ( const std::vector< V4L2Mapping > &  Profiles)
staticprivate

Definition at line 286 of file mythv4l2m2mcontext.cpp.

Referenced by GetRequestProfiles(), and GetStandardProfiles().

◆ GetRequestProfiles()

const V4L2Profiles & MythV4L2M2MContext::GetRequestProfiles ( )
staticprotected

◆ GetStandardProfiles()

const V4L2Profiles & MythV4L2M2MContext::GetStandardProfiles ( )
staticprotected

Definition at line 260 of file mythv4l2m2mcontext.cpp.

Referenced by GetDecoderList(), GetSupportedCodec(), and HaveV4L2Codecs().

◆ GetSupportedCodec()

MythCodecID MythV4L2M2MContext::GetSupportedCodec ( AVCodecContext **  Context,
const AVCodec **  Codec,
const QString &  Decoder,
AVStream *  Stream,
uint  StreamType 
)
static

Definition at line 51 of file mythv4l2m2mcontext.cpp.

Referenced by MythCodecContext::FindDecoder().

◆ GetV4L2RequestFormat()

AVPixelFormat MythV4L2M2MContext::GetV4L2RequestFormat ( AVCodecContext *  Context,
const AVPixelFormat *  PixFmt 
)
static

Definition at line 484 of file mythv4l2m2mcontext.cpp.

Referenced by InitVideoCodec().

◆ HaveV4L2Codecs()

bool MythV4L2M2MContext::HaveV4L2Codecs ( bool  Reinit = false)
static

Definition at line 413 of file mythv4l2m2mcontext.cpp.

Referenced by MythCodecContext::GetDecoders().

◆ HwDecoderInit()

int MythV4L2M2MContext::HwDecoderInit ( AVCodecContext *  Context)
overridevirtual

Reimplemented from MythDRMPRIMEContext.

Definition at line 125 of file mythv4l2m2mcontext.cpp.

◆ InitialiseV4L2RequestContext()

int MythV4L2M2MContext::InitialiseV4L2RequestContext ( AVCodecContext *  Context)
static

Definition at line 501 of file mythv4l2m2mcontext.cpp.

Referenced by GetV4L2RequestFormat().

◆ InitVideoCodec()

void MythV4L2M2MContext::InitVideoCodec ( AVCodecContext *  Context,
bool  SelectedStream,
bool DirectRendering 
)
overridevirtual

Reimplemented from MythDRMPRIMEContext.

Definition at line 136 of file mythv4l2m2mcontext.cpp.

◆ RetrieveFrame()

bool MythV4L2M2MContext::RetrieveFrame ( AVCodecContext *  Context,
MythVideoFrame Frame,
AVFrame AvFrame 
)
overridevirtual

Reimplemented from MythDRMPRIMEContext.

Definition at line 171 of file mythv4l2m2mcontext.cpp.

◆ SetDecoderOptions()

void MythV4L2M2MContext::SetDecoderOptions ( AVCodecContext *  Context,
const AVCodec *  Codec 
)
overridevirtual

Reduce the number of capture buffers.

Testing on Pi 3, the default of 20 is too high and leads to memory allocation failures in the the kernel driver.

Reimplemented from MythCodecContext.

Definition at line 187 of file mythv4l2m2mcontext.cpp.

Member Data Documentation

◆ m_request

bool MythV4L2M2MContext::m_request { false }
private

Definition at line 39 of file mythv4l2m2mcontext.h.

Referenced by InitVideoCodec(), RetrieveFrame(), and SetDecoderOptions().


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