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