MythTV
master
libs
libmythtv
mythinteropgpu.cpp
Go to the documentation of this file.
1
// MythTV
2
#include "
libmythbase/mythcorecontext.h
"
3
#include "
libmythui/mythrender_base.h
"
4
#include "
mythinteropgpu.h
"
5
6
#ifdef USING_OPENGL
7
#include "
opengl/mythopenglinterop.h
"
8
#endif
9
10
MythInteropGPU::InteropMap
MythInteropGPU::GetTypes
(
MythRender
* Render)
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
22
QString
MythInteropGPU::TypeToString
(
InteropType
Type)
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
39
QString
MythInteropGPU::TypesToString
(
const
InteropMap
&Types)
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
49
MythInteropGPU
*
MythInteropGPU::CreateDummy
()
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
58
MythInteropGPU::MythInteropGPU
(
MythRender
* Context,
InteropType
Type,
MythPlayerUI
*
Player
)
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
68
MythInteropGPU::~MythInteropGPU
()
69
{
70
if
(
m_context
)
71
m_context
->
DecrRef
();
72
}
73
74
MythInteropGPU::InteropType
MythInteropGPU::GetType
()
75
{
76
return
m_type
;
77
}
78
79
MythPlayerUI
*
MythInteropGPU::GetPlayer
()
80
{
81
return
m_player
;
82
}
83
84
void
MythInteropGPU::SetDefaultFree
(
FreeAVHWDeviceContext
FreeContext)
85
{
86
m_defaultFree
= FreeContext;
87
}
88
89
void
MythInteropGPU::SetDefaultUserOpaque
(
void
* UserOpaque)
90
{
91
m_defaultUserOpaque
= UserOpaque;
92
}
93
94
FreeAVHWDeviceContext
MythInteropGPU::GetDefaultFree
()
95
{
96
return
m_defaultFree
;
97
}
98
99
void
*
MythInteropGPU::GetDefaultUserOpaque
()
100
{
101
return
m_defaultUserOpaque
;
102
}
103
MythInteropGPU::m_type
InteropType m_type
Definition:
mythinteropgpu.h:67
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:33
MythInteropGPU::GetPlayer
MythPlayerUI * GetPlayer()
Definition:
mythinteropgpu.cpp:79
mythopenglinterop.h
MythInteropGPU::GL_VDPAU
@ GL_VDPAU
Definition:
mythinteropgpu.h:34
MythInteropGPU::m_context
MythRender * m_context
Definition:
mythinteropgpu.h:61
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition:
mythcorecontext.cpp:1347
types
static const struct wl_interface * types[]
Definition:
idle_inhibit_unstable_v1.c:39
MythInteropGPU::m_defaultUserOpaque
void * m_defaultUserOpaque
Definition:
mythinteropgpu.h:65
MythInteropGPU::GetType
InteropType GetType()
Definition:
mythinteropgpu.cpp:74
true
VERBOSE_PREAMBLE Most true
Definition:
verbosedefs.h:95
MythInteropGPU::TypeToString
static QString TypeToString(InteropType Type)
Definition:
mythinteropgpu.cpp:22
MythInteropGPU::GL_MMAL
@ GL_MMAL
Definition:
mythinteropgpu.h:36
MythInteropGPU::TypesToString
static QString TypesToString(const InteropMap &Types)
Definition:
mythinteropgpu.cpp:39
MythInteropGPU::InteropMap
std::map< VideoFrameType, InteropTypes > InteropMap
Definition:
mythinteropgpu.h:44
MythInteropGPU::GL_VTBSURFACE
@ GL_VTBSURFACE
Definition:
mythinteropgpu.h:32
MythPlayerUI
Definition:
mythplayerui.h:10
mythinteropgpu.h
mythrender_base.h
MythInteropGPU::m_defaultFree
FreeAVHWDeviceContext m_defaultFree
Definition:
mythinteropgpu.h:64
hardwareprofile.getLink.type
type
Definition:
getLink.py:57
MythInteropGPU::GL_VTB
@ GL_VTB
Definition:
mythinteropgpu.h:31
MythInteropGPU::GL_DRMPRIME
@ GL_DRMPRIME
Definition:
mythinteropgpu.h:37
MythInteropGPU::m_player
MythPlayerUI * m_player
Definition:
mythinteropgpu.h:66
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition:
mythcorecontext.cpp:55
MythInteropGPU::GL_NVDEC
@ GL_NVDEC
Definition:
mythinteropgpu.h:35
MythInteropGPU::DUMMY
@ DUMMY
Definition:
mythinteropgpu.h:40
MythInteropGPU::CreateDummy
static MythInteropGPU * CreateDummy()
Definition:
mythinteropgpu.cpp:49
FreeAVHWDeviceContext
void(*)(struct AVHWDeviceContext *) FreeAVHWDeviceContext
Definition:
mythinteropgpu.h:17
MythInteropGPU::MythInteropGPU
MythInteropGPU(MythRender *Context, InteropType Type, MythPlayerUI *Player=nullptr)
Definition:
mythinteropgpu.cpp:58
mythcorecontext.h
MythInteropGPU::GL_VAAPIEGLDRM
@ GL_VAAPIEGLDRM
Definition:
mythinteropgpu.h:30
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:28
MythInteropGPU::DRM_DRMPRIME
@ DRM_DRMPRIME
Definition:
mythinteropgpu.h:38
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:25
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition:
referencecounter.cpp:101
MythInteropGPU::GL_VAAPIGLXPIX
@ GL_VAAPIGLXPIX
Definition:
mythinteropgpu.h:29
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:33
MythInteropGPU
Definition:
mythinteropgpu.h:20
Generated on Wed Sep 6 2023 03:18:28 for MythTV by
1.8.17