MythTV  master
mythnvdecinterop.h
Go to the documentation of this file.
1 #ifndef MYTHNVDECINTEROP_H
2 #define MYTHNVDECINTEROP_H
3 
4 // MythTV
5 #include "mythopenglinterop.h"
6 
7 // FFmpeg
8 extern "C" {
9 #include "compat/cuda/dynlink_loader.h"
10 #include "libavutil/hwcontext_cuda.h"
11 }
12 
14 {
15  friend class MythOpenGLInterop;
16 
17  public:
19  static bool CreateCUDAContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs,
20  CUcontext &CudaContext);
21  static void CleanupContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs,
22  CUcontext &CudaContext);
23 
24  bool IsValid(void);
25  CUcontext GetCUDAContext(void);
26  vector<MythVideoTexture*> Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace,
27  VideoFrame *Frame, FrameScanType Scan) override;
28 
29  protected:
32  ~MythNVDECInterop() override;
33 
34  private:
35  bool InitialiseCuda(void);
36  void DeleteTextures(void) override;
37  void RotateReferenceFrames(CUdeviceptr Buffer);
38  static bool CreateCUDAPriv(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs,
39  CUcontext &CudaContext, bool &Retry);
40  CUcontext m_cudaContext;
41  CudaFunctions *m_cudaFuncs { nullptr };
42  QVector<CUdeviceptr> m_referenceFrames;
43 };
44 
45 #endif // MYTHNVDECINTEROP_H
MythNVDECInterop::Create
static MythNVDECInterop * Create(MythRenderOpenGL *Context)
Definition: mythnvdecinterop.cpp:78
MythNVDECInterop::m_referenceFrames
QVector< CUdeviceptr > m_referenceFrames
Definition: mythnvdecinterop.h:42
MythNVDECInterop::m_cudaContext
CUcontext m_cudaContext
Definition: mythnvdecinterop.h:40
MythNVDECInterop::Acquire
vector< MythVideoTexture * > Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan) override
Map CUDA video memory to OpenGL textures.
Definition: mythnvdecinterop.cpp:102
mythopenglinterop.h
Frame
Definition: zmdefines.h:94
FrameScanType
FrameScanType
Definition: videoouttypes.h:79
Context
QHash< QString, Action * > Context
Definition: action.h:77
MythDate::Format
Format
Definition: mythdate.h:13
MythNVDECInterop
Definition: mythnvdecinterop.h:14
VideoFrame
Definition: mythframe.h:138
MythNVDECInterop::RotateReferenceFrames
void RotateReferenceFrames(CUdeviceptr Buffer)
Definition: mythnvdecinterop.cpp:408
MythNVDECInterop::GetInteropType
static Type GetInteropType(VideoFrameType Format)
Definition: mythnvdecinterop.cpp:85
MythOpenGLInterop
Definition: mythopenglinterop.h:24
MythNVDECInterop::DeleteTextures
void DeleteTextures(void) override
Definition: mythnvdecinterop.cpp:37
MythNVDECInterop::CreateCUDAContext
static bool CreateCUDAContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
Definition: mythnvdecinterop.cpp:369
MythNVDECInterop::IsValid
bool IsValid(void)
Definition: mythnvdecinterop.cpp:68
MythOpenGLInterop::Type
Type
Definition: mythopenglinterop.h:30
MythNVDECInterop::InitialiseCuda
bool InitialiseCuda(void)
Initialise a CUDA context.
Definition: mythnvdecinterop.cpp:309
MythNVDECInterop::CreateCUDAPriv
static bool CreateCUDAPriv(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext, bool &Retry)
Definition: mythnvdecinterop.cpp:314
MythRenderOpenGL
Definition: mythrenderopengl.h:95
MythNVDECInterop::MythNVDECInterop
MythNVDECInterop(MythRenderOpenGL *Context)
Definition: mythnvdecinterop.cpp:23
VideoColourSpace
VideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: videocolourspace.h:18
Buffer
Definition: MythExternControl.h:37
MythNVDECInterop::CleanupContext
static void CleanupContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
Definition: mythnvdecinterop.cpp:393
MythNVDECInterop::~MythNVDECInterop
~MythNVDECInterop() override
Definition: mythnvdecinterop.cpp:30
MythNVDECInterop::GetCUDAContext
CUcontext GetCUDAContext(void)
Definition: mythnvdecinterop.cpp:73
VideoFrameType
VideoFrameType
Definition: mythframe.h:25
MythNVDECInterop::m_cudaFuncs
CudaFunctions * m_cudaFuncs
Definition: mythnvdecinterop.h:41