MythTV  master
mythnvdecinterop.h
Go to the documentation of this file.
1 #ifndef MYTHNVDECINTEROP_H
2 #define MYTHNVDECINTEROP_H
3 
4 // MythTV
6 
7 // FFmpeg
8 extern "C" {
9 #include "compat/cuda/dynlink_loader.h"
10 #include "libavutil/hwcontext_cuda.h"
11 }
12 
14 {
15  public:
16  static void GetNVDECTypes(MythRenderOpenGL* Render, MythInteropGPU::InteropMap& Types);
18  static bool CreateCUDAContext(MythRenderOpenGL* GLContext, CudaFunctions*& CudaFuncs,
19  CUcontext& CudaContext);
20  static void CleanupContext(MythRenderOpenGL* GLContext, CudaFunctions*& CudaFuncs,
21  CUcontext& CudaContext);
22 
23  bool IsValid();
24  CUcontext GetCUDAContext();
25 
26  std::vector<MythVideoTextureOpenGL*>
27  Acquire(MythRenderOpenGL* Context, MythVideoColourSpace* ColourSpace,
28  MythVideoFrame* Frame, FrameScanType Scan) override;
29 
30  protected:
32  ~MythNVDECInterop() override;
33 
34  private:
35  bool InitialiseCuda();
36  void DeleteTextures() 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::GetNVDECTypes
static void GetNVDECTypes(MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
Definition: mythnvdecinterop.cpp:94
MythNVDECInterop::m_referenceFrames
QVector< CUdeviceptr > m_referenceFrames
Definition: mythnvdecinterop.h:42
MythNVDECInterop::m_cudaContext
CUcontext m_cudaContext
Definition: mythnvdecinterop.h:40
mythopenglinterop.h
Frame
Definition: zmdefines.h:93
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
MythNVDECInterop
Definition: mythnvdecinterop.h:13
MythNVDECInterop::RotateReferenceFrames
void RotateReferenceFrames(CUdeviceptr Buffer)
Definition: mythnvdecinterop.cpp:412
MythInteropGPU::InteropMap
std::map< VideoFrameType, InteropTypes > InteropMap
Definition: mythinteropgpu.h:44
MythPlayerUI
Definition: mythplayerui.h:10
MythOpenGLInterop
Definition: mythopenglinterop.h:17
MythNVDECInterop::Acquire
std::vector< MythVideoTextureOpenGL * > Acquire(MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
Map CUDA video memory to OpenGL textures.
Definition: mythnvdecinterop.cpp:108
MythNVDECInterop::CreateCUDAContext
static bool CreateCUDAContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
Definition: mythnvdecinterop.cpp:373
MythNVDECInterop::IsValid
bool IsValid()
Definition: mythnvdecinterop.cpp:68
MythNVDECInterop::CreateCUDAPriv
static bool CreateCUDAPriv(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext, bool &Retry)
Definition: mythnvdecinterop.cpp:318
MythNVDECInterop::DeleteTextures
void DeleteTextures() override
Definition: mythnvdecinterop.cpp:37
MythRenderOpenGL
Definition: mythrenderopengl.h:100
Buffer
Definition: MythExternControl.h:36
MythNVDECInterop::GetCUDAContext
CUcontext GetCUDAContext()
Definition: mythnvdecinterop.cpp:73
MythNVDECInterop::InitialiseCuda
bool InitialiseCuda()
Initialise a CUDA context.
Definition: mythnvdecinterop.cpp:313
MythNVDECInterop::CreateNVDEC
static MythNVDECInterop * CreateNVDEC(MythPlayerUI *Player, MythRenderOpenGL *Context)
Definition: mythnvdecinterop.cpp:78
MythNVDECInterop::CleanupContext
static void CleanupContext(MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
Definition: mythnvdecinterop.cpp:397
MythNVDECInterop::~MythNVDECInterop
~MythNVDECInterop() override
Definition: mythnvdecinterop.cpp:30
Player
Definition: zmliveplayer.h:34
MythVideoFrame
Definition: mythframe.h:88
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:18
MythNVDECInterop::m_cudaFuncs
CudaFunctions * m_cudaFuncs
Definition: mythnvdecinterop.h:41
MythNVDECInterop::MythNVDECInterop
MythNVDECInterop(MythPlayerUI *Player, MythRenderOpenGL *Context)
Definition: mythnvdecinterop.cpp:24