MythTV  master
mythinteropgpu.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythcorecontext.h"
3 #include "mythrender_base.h"
4 #include "mythinteropgpu.h"
5 
6 #ifdef USING_OPENGL
8 #endif
9 
11 {
12  InteropMap result;
13  if (!gCoreContext->IsUIThread())
14  return result;
15 
16 #ifdef USING_OPENGL
17  MythOpenGLInterop::GetTypes(Render, result);
18 #endif
19  return result;
20 }
21 
23 {
24  if (Type == GL_VAAPIEGLDRM) return "GL-VAAPI-DRM";
25  if (Type == GL_VAAPIGLXPIX) return "GL-VAAPI-GLX-Pixmap";
26  if (Type == GL_VAAPIGLXCOPY) return "GL-VAAPI-GLX-Copy";
27  if (Type == GL_VTB) return "GL-VTB";
28  if (Type == GL_VTBSURFACE) return "GL-VTB-IOSurface";
29  if (Type == GL_MEDIACODEC) return "GL-MediaCodec-Surface";
30  if (Type == GL_VDPAU) return "GL-VDPAU";
31  if (Type == GL_NVDEC) return "GL-NVDEC";
32  if (Type == GL_MMAL) return "GL-MMAL";
33  if (Type == GL_DRMPRIME) return "GL-DRM-PRIME";
34  if (Type == DRM_DRMPRIME) return "DRM-DRM-PRIME";
35  if (Type == DUMMY) return "DUMMY";
36  return "Unsupported";
37 }
38 
40 {
41  QStringList result;
42  for (const auto & types : Types)
43  for (auto type : types.second)
44  result << TypeToString(type);
45  result.removeDuplicates();
46  return result.isEmpty() ? "None" : result.join(",");
47 }
48 
50 {
51  // This is used to store AVHWDeviceContext free and user_opaque when
52  // set by the decoder in use. This usually applies to VAAPI and VDPAU
53  // and we do not always want or need to use MythRenderOpenGL e.g. when
54  // checking functionality only.
55  return new MythInteropGPU(nullptr, DUMMY);
56 }
57 
59  : ReferenceCounter(TypeToString(Type), true),
60  m_context(Context),
61  m_player(Player),
62  m_type(Type)
63 {
64  if (m_context)
65  m_context->IncrRef();
66 }
67 
69 {
70  if (m_context)
71  m_context->DecrRef();
72 }
73 
75 {
76  return m_type;
77 }
78 
80 {
81  return m_player;
82 }
83 
85 {
86  m_defaultFree = FreeContext;
87 }
88 
90 {
91  m_defaultUserOpaque = UserOpaque;
92 }
93 
95 {
96  return m_defaultFree;
97 }
98 
100 {
101  return m_defaultUserOpaque;
102 }
103 
MythInteropGPU::m_type
InteropType m_type
Definition: mythinteropgpu.h:68
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
MythInteropGPU::GetDefaultFree
FreeAVHWDeviceContext GetDefaultFree()
Definition: mythinteropgpu.cpp:94
MythInteropGPU::GL_MEDIACODEC
@ GL_MEDIACODEC
Definition: mythinteropgpu.h:34
MythInteropGPU::GetPlayer
MythPlayerUI * GetPlayer()
Definition: mythinteropgpu.cpp:79
mythopenglinterop.h
MythInteropGPU::GL_VDPAU
@ GL_VDPAU
Definition: mythinteropgpu.h:35
MythInteropGPU::m_context
MythRender * m_context
Definition: mythinteropgpu.h:62
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1360
types
static const struct wl_interface * types[]
Definition: idle_inhibit_unstable_v1.c:39
MythInteropGPU::m_defaultUserOpaque
void * m_defaultUserOpaque
Definition: mythinteropgpu.h:66
MythInteropGPU::GetType
InteropType GetType()
Definition: mythinteropgpu.cpp:74
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
MythInteropGPU::TypeToString
static QString TypeToString(InteropType Type)
Definition: mythinteropgpu.cpp:22
MythInteropGPU::GL_MMAL
@ GL_MMAL
Definition: mythinteropgpu.h:37
MythInteropGPU::TypesToString
static QString TypesToString(const InteropMap &Types)
Definition: mythinteropgpu.cpp:39
MythInteropGPU::InteropMap
std::map< VideoFrameType, InteropTypes > InteropMap
Definition: mythinteropgpu.h:45
MythInteropGPU::GL_VTBSURFACE
@ GL_VTBSURFACE
Definition: mythinteropgpu.h:33
MythPlayerUI
Definition: mythplayerui.h:10
mythinteropgpu.h
mythrender_base.h
MythInteropGPU::m_defaultFree
FreeAVHWDeviceContext m_defaultFree
Definition: mythinteropgpu.h:65
MythInteropGPU::GL_VTB
@ GL_VTB
Definition: mythinteropgpu.h:32
MythInteropGPU::GL_DRMPRIME
@ GL_DRMPRIME
Definition: mythinteropgpu.h:38
MythInteropGPU::m_player
MythPlayerUI * m_player
Definition: mythinteropgpu.h:67
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
MythInteropGPU::GL_NVDEC
@ GL_NVDEC
Definition: mythinteropgpu.h:36
MythInteropGPU::DUMMY
@ DUMMY
Definition: mythinteropgpu.h:41
MythInteropGPU::CreateDummy
static MythInteropGPU * CreateDummy()
Definition: mythinteropgpu.cpp:49
FreeAVHWDeviceContext
void(*)(struct AVHWDeviceContext *) FreeAVHWDeviceContext
Definition: mythinteropgpu.h:18
MythInteropGPU::MythInteropGPU
MythInteropGPU(MythRender *Context, InteropType Type, MythPlayerUI *Player=nullptr)
Definition: mythinteropgpu.cpp:58
mythcorecontext.h
MythInteropGPU::GL_VAAPIEGLDRM
@ GL_VAAPIEGLDRM
Definition: mythinteropgpu.h:31
MythRender
Definition: mythrender_base.h:23
MythInteropGPU::GetTypes
static InteropMap GetTypes(MythRender *Render)
Definition: mythinteropgpu.cpp:10
MythInteropGPU::GL_VAAPIGLXCOPY
@ GL_VAAPIGLXCOPY
Definition: mythinteropgpu.h:29
MythInteropGPU::DRM_DRMPRIME
@ DRM_DRMPRIME
Definition: mythinteropgpu.h:39
MythInteropGPU::GetDefaultUserOpaque
void * GetDefaultUserOpaque()
Definition: mythinteropgpu.cpp:99
MythInteropGPU::SetDefaultUserOpaque
void SetDefaultUserOpaque(void *UserOpaque)
Definition: mythinteropgpu.cpp:89
Player
Definition: zmliveplayer.h:34
MythInteropGPU::SetDefaultFree
void SetDefaultFree(FreeAVHWDeviceContext FreeContext)
Definition: mythinteropgpu.cpp:84
MythInteropGPU::InteropType
InteropType
Definition: mythinteropgpu.h:26
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
MythInteropGPU::GL_VAAPIGLXPIX
@ GL_VAAPIGLXPIX
Definition: mythinteropgpu.h:30
MythInteropGPU::~MythInteropGPU
~MythInteropGPU() override
Definition: mythinteropgpu.cpp:68
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26
MythOpenGLInterop::GetTypes
static void GetTypes(MythRender *Render, MythInteropGPU::InteropMap &Types)
Definition: mythopenglinterop.cpp:32
MythInteropGPU
Definition: mythinteropgpu.h:21