Debian Codegraph @

xbmc/windowing/X11/OptionalsReg.cpp

raw
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #include "OptionalsReg.h"
10
11 #include "cores/VideoPlayer/VideoReferenceClock.h"
12
13 //-----------------------------------------------------------------------------
14 // VAAPI
15 //-----------------------------------------------------------------------------
16 #if defined (HAVE_LIBVA)
17 #include <va/va_x11.h>
18 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
19 #if defined(HAS_GL)
20 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
21 #endif
22 #if defined(HAS_GLES)
23 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGLES.h"
24 #endif
25
26 using namespace KODI::WINDOWING::X11;
27
28 namespace KODI
29 {
30 namespace WINDOWING
31 {
32 namespace X11
33 {
34
35 class CWinSystemX11GLContext;
36
37 class CVaapiProxy : public VAAPI::IVaapiWinSystem
38 {
39 public:
40 CVaapiProxy() = default;
41 virtual ~CVaapiProxy() = default;
42 VADisplay GetVADisplay() override { return vaGetDisplay(dpy); };
43 void *GetEGLDisplay() override { return eglDisplay; };
44
45 Display *dpy;
46 void *eglDisplay;
47 };
48
49 CVaapiProxy* VaapiProxyCreate()
50 {
51 return new CVaapiProxy();
52 }
53
54 void VaapiProxyDelete(CVaapiProxy *proxy)
55 {
56 delete proxy;
57 }
58
59 void VaapiProxyConfig(CVaapiProxy *proxy, void *dpy, void *eglDpy)
60 {
61 proxy->dpy = static_cast<Display*>(dpy);
62 proxy->eglDisplay = eglDpy;
63 }
64
65 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
66 {
67 VAAPI::CDecoder::Register(winSystem, deepColor);
68 }
69
70 #if defined(HAS_GL)
71 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
72 {
73 EGLDisplay eglDpy = winSystem->eglDisplay;
74 VADisplay vaDpy = vaGetDisplay(winSystem->dpy);
75 CRendererVAAPIGL::Register(winSystem, vaDpy, eglDpy, general, deepColor);
76 }
77 #endif
78
79 #if defined(HAS_GLES)
80 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
81 {
82 EGLDisplay eglDpy = winSystem->eglDisplay;
83 VADisplay vaDpy = vaGetDisplay(winSystem->dpy);
84 CRendererVAAPIGLES::Register(winSystem, vaDpy, eglDpy, general, deepColor);
85 }
86 #endif
87 }
88 }
89 }
90
91 #else
92 namespace KODI
93 {
94 namespace WINDOWING
95 {
96 namespace X11
97 {
98
99 class CVaapiProxy
100 {
101 };
102
103 CVaapiProxy* VaapiProxyCreate()
104 {
105 return nullptr;
106 }
107
108 void VaapiProxyDelete(CVaapiProxy *proxy)
109 {
110 }
111
112 void VaapiProxyConfig(CVaapiProxy *proxy, void *dpy, void *eglDpy)
113 {
114 }
115
116 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
117 {
118 }
119
120 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
121 {
122 }
123
124 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
125 {
126 }
127
128 }
129 }
130 }
131 #endif
132
133 //-----------------------------------------------------------------------------
134 // GLX
135 //-----------------------------------------------------------------------------
136
137 #ifdef HAS_GLX
138 #include <GL/glx.h>
139 #include "VideoSyncGLX.h"
140 #include "GLContextGLX.h"
141
142 namespace KODI
143 {
144 namespace WINDOWING
145 {
146 namespace X11
147 {
148
149 XID GLXGetWindow(void* context)
150 {
151 return static_cast<CGLContextGLX*>(context)->m_glxWindow;
152 }
153
154 void* GLXGetContext(void* context)
155 {
156 return static_cast<CGLContextGLX*>(context)->m_glxContext;
157 }
158
159 CGLContext* GLXContextCreate(Display *dpy)
160 {
161 return new CGLContextGLX(dpy);
162 }
163
164 CVideoSync* GLXVideoSyncCreate(CVideoReferenceClock* clock, CWinSystemX11GLContext& winSystem)
165 {
166 return new CVideoSyncGLX(clock, winSystem);
167 }
168
169 }
170 }
171 }
172 #else
173
174 namespace KODI
175 {
176 namespace WINDOWING
177 {
178 namespace X11
179 {
180
181 XID GLXGetWindow(void* context)
182 {
183 return 0;
184 }
185
186 void* GLXGetContext(void* context)
187 {
188 return nullptr;
189 }
190
191 CGLContext* GLXContextCreate(Display *dpy)
192 {
193 return nullptr;
194 }
195
196 CVideoSync* GLXVideoSyncCreate(CVideoReferenceClock* clock, CWinSystemX11GLContext& winSystem)
197 {
198 return nullptr;
199 }
200
201 }
202 }
203 }
204 #endif
205
206 //-----------------------------------------------------------------------------
207 // VDPAU
208 //-----------------------------------------------------------------------------
209
210 #if defined (HAVE_LIBVDPAU)
211 #include "cores/VideoPlayer/DVDCodecs/Video/VDPAU.h"
212 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.h"
213
214 namespace KODI
215 {
216 namespace WINDOWING
217 {
218 namespace X11
219 {
220
221 void VDPAURegisterRender()
222 {
223 CRendererVDPAU::Register();
224 }
225
226 void VDPAURegister()
227 {
228 VDPAU::CDecoder::Register();
229 }
230
231 }
232 }
233 }
234 #else
235
236 namespace KODI
237 {
238 namespace WINDOWING
239 {
240 namespace X11
241 {
242
243 void VDPAURegisterRender()
244 {
245
246 }
247
248 void VDPAURegister()
249 {
250
251 }
252
253 }
254 }
255 }
256 #endif
257