MythTV  master
mythv4l2m2mcontext.h
Go to the documentation of this file.
1 #ifndef MYTHV4L2M2MCONTEXT_H
2 #define MYTHV4L2M2MCONTEXT_H
3 
4 // MythTV
5 #include "mythdrmprimecontext.h"
6 
7 using V4L2Profiles = QList<MythCodecContext::CodecProfile>;
8 using V4L2Mapping = QPair<const uint32_t, const MythCodecContext::CodecProfile>;
9 
11 {
12  public:
13  MythV4L2M2MContext(DecoderBase *Parent, MythCodecID CodecID);
14  ~MythV4L2M2MContext() override = default;
15  static MythCodecID GetSupportedCodec (AVCodecContext **Context,
16  AVCodec **Codec,
17  const QString &Decoder,
18  AVStream *Stream,
19  uint StreamType);
20  void InitVideoCodec (AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override;
21  bool RetrieveFrame (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override;
22  void SetDecoderOptions (AVCodecContext* Context, AVCodec* Codec) override;
23  int HwDecoderInit (AVCodecContext *Context) override;
24  bool DecoderWillResetOnFlush () override;
25  static bool GetBuffer (AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int/*Flags*/);
26  static bool HaveV4L2Codecs (bool Reinit = false);
27  static void GetDecoderList (QStringList &Decoders);
28 
29  static enum AVPixelFormat GetV4L2RequestFormat(AVCodecContext *Context, const AVPixelFormat *PixFmt);
30  static int InitialiseV4L2RequestContext(AVCodecContext *Context);
31  bool GetRequestBuffer(AVCodecContext* Context, MythVideoFrame* Frame, AVFrame* AvFrame);
32 
33  protected:
34  static const V4L2Profiles& GetStandardProfiles();
35  static const V4L2Profiles& GetRequestProfiles();
36 
37  private:
38  static V4L2Profiles GetProfiles(const std::vector<V4L2Mapping> &Profiles);
39 
40  bool m_request { false };
41 };
42 
43 #endif
MythV4L2M2MContext::DecoderWillResetOnFlush
bool DecoderWillResetOnFlush() override
Definition: mythv4l2m2mcontext.cpp:47
MythV4L2M2MContext::HwDecoderInit
int HwDecoderInit(AVCodecContext *Context) override
Definition: mythv4l2m2mcontext.cpp:126
Frame
Definition: zmdefines.h:93
MythV4L2M2MContext::InitVideoCodec
void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
Definition: mythv4l2m2mcontext.cpp:137
MythV4L2M2MContext::HaveV4L2Codecs
static bool HaveV4L2Codecs(bool Reinit=false)
Definition: mythv4l2m2mcontext.cpp:415
MythV4L2M2MContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythv4l2m2mcontext.cpp:393
V4L2Profiles
QList< MythCodecContext::CodecProfile > V4L2Profiles
Definition: mythv4l2m2mcontext.h:7
MythV4L2M2MContext::GetStandardProfiles
static const V4L2Profiles & GetStandardProfiles()
Definition: mythv4l2m2mcontext.cpp:261
MythV4L2M2MContext::~MythV4L2M2MContext
~MythV4L2M2MContext() override=default
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MythV4L2M2MContext::SetDecoderOptions
void SetDecoderOptions(AVCodecContext *Context, AVCodec *Codec) override
Reduce the number of capture buffers.
Definition: mythv4l2m2mcontext.cpp:188
Decoder
Definition: decoder.h:65
MythV4L2M2MContext::RetrieveFrame
bool RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
Definition: mythv4l2m2mcontext.cpp:172
MythV4L2M2MContext::GetRequestBuffer
bool GetRequestBuffer(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame)
Definition: mythv4l2m2mcontext.cpp:526
MythV4L2M2MContext::GetRequestProfiles
static const V4L2Profiles & GetRequestProfiles()
Definition: mythv4l2m2mcontext.cpp:464
V4L2Mapping
QPair< const uint32_t, const MythCodecContext::CodecProfile > V4L2Mapping
Definition: mythv4l2m2mcontext.h:8
MythV4L2M2MContext::GetProfiles
static V4L2Profiles GetProfiles(const std::vector< V4L2Mapping > &Profiles)
Definition: mythv4l2m2mcontext.cpp:287
MythDRMPRIMEContext
A generic context handler for codecs that return AV_PIX_FMT_DRM_PRIME frames.
Definition: mythdrmprimecontext.h:14
uint
unsigned int uint
Definition: compat.h:140
MythV4L2M2MContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythv4l2m2mcontext.cpp:52
MythV4L2M2MContext::GetV4L2RequestFormat
static enum AVPixelFormat GetV4L2RequestFormat(AVCodecContext *Context, const AVPixelFormat *PixFmt)
Definition: mythv4l2m2mcontext.cpp:486
MythV4L2M2MContext
A handler for V4L2 Memory2Memory codecs.
Definition: mythv4l2m2mcontext.h:10
MythV4L2M2MContext::MythV4L2M2MContext
MythV4L2M2MContext(DecoderBase *Parent, MythCodecID CodecID)
Definition: mythv4l2m2mcontext.cpp:42
MythV4L2M2MContext::InitialiseV4L2RequestContext
static int InitialiseV4L2RequestContext(AVCodecContext *Context)
Definition: mythv4l2m2mcontext.cpp:503
MythV4L2M2MContext::m_request
bool m_request
Definition: mythv4l2m2mcontext.h:40
MythV4L2M2MContext::GetBuffer
static bool GetBuffer(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int)
Retrieve a frame from CPU memory.
Definition: mythv4l2m2mcontext.cpp:212
MythVideoFrame
Definition: mythframe.h:88
mythdrmprimecontext.h
DecoderBase
Definition: decoderbase.h:120