[filesystem][SpecialProtocol] Removed assert from GetPath
[xbmc.git] / xbmc / windowing / X11 / OptionalsReg.cpp
blobecfd780c721c35c48d8c8ca36569574bb1521b7e
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "OptionalsReg.h"
11 //-----------------------------------------------------------------------------
12 // VAAPI
13 //-----------------------------------------------------------------------------
14 #if defined (HAVE_LIBVA)
15 #include <va/va_x11.h>
16 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
17 #if defined(HAS_GL)
18 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
19 #endif
20 #if defined(HAS_GLES)
21 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGLES.h"
22 #endif
24 using namespace KODI::WINDOWING::X11;
26 namespace KODI
28 namespace WINDOWING
30 namespace X11
33 class CWinSystemX11GLContext;
35 class CVaapiProxy : public VAAPI::IVaapiWinSystem
37 public:
38 CVaapiProxy() = default;
39 virtual ~CVaapiProxy() = default;
40 VADisplay GetVADisplay() override { return vaGetDisplay(dpy); };
41 void *GetEGLDisplay() override { return eglDisplay; };
43 Display *dpy;
44 void *eglDisplay;
47 CVaapiProxy* VaapiProxyCreate()
49 return new CVaapiProxy();
52 void VaapiProxyDelete(CVaapiProxy *proxy)
54 delete proxy;
57 void VaapiProxyConfig(CVaapiProxy *proxy, void *dpy, void *eglDpy)
59 proxy->dpy = static_cast<Display*>(dpy);
60 proxy->eglDisplay = eglDpy;
63 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
65 VAAPI::CDecoder::Register(winSystem, deepColor);
68 #if defined(HAS_GL)
69 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
71 EGLDisplay eglDpy = winSystem->eglDisplay;
72 VADisplay vaDpy = vaGetDisplay(winSystem->dpy);
73 CRendererVAAPIGL::Register(winSystem, vaDpy, eglDpy, general, deepColor);
75 #endif
77 #if defined(HAS_GLES)
78 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
80 EGLDisplay eglDpy = winSystem->eglDisplay;
81 VADisplay vaDpy = vaGetDisplay(winSystem->dpy);
82 CRendererVAAPIGLES::Register(winSystem, vaDpy, eglDpy, general, deepColor);
84 #endif
89 #else
90 namespace KODI
92 namespace WINDOWING
94 namespace X11
97 class CVaapiProxy
101 CVaapiProxy* VaapiProxyCreate()
103 return nullptr;
106 void VaapiProxyDelete(CVaapiProxy *proxy)
110 void VaapiProxyConfig(CVaapiProxy *proxy, void *dpy, void *eglDpy)
114 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
118 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
122 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
129 #endif
131 //-----------------------------------------------------------------------------
132 // GLX
133 //-----------------------------------------------------------------------------
135 #ifdef HAS_GLX
136 #include <GL/glx.h>
137 #include "VideoSyncGLX.h"
138 #include "GLContextGLX.h"
140 namespace KODI
142 namespace WINDOWING
144 namespace X11
147 XID GLXGetWindow(void* context)
149 return static_cast<CGLContextGLX*>(context)->m_glxWindow;
152 void* GLXGetContext(void* context)
154 return static_cast<CGLContextGLX*>(context)->m_glxContext;
157 CGLContext* GLXContextCreate(Display *dpy)
159 return new CGLContextGLX(dpy);
163 CVideoSync* GLXVideoSyncCreate(void* clock, CWinSystemX11GLContext& winSystem)
165 return new CVideoSyncGLX(clock, winSystem);
171 #else
173 namespace KODI
175 namespace WINDOWING
177 namespace X11
180 XID GLXGetWindow(void* context)
182 return 0;
185 void* GLXGetContext(void* context)
187 return nullptr;
190 CGLContext* GLXContextCreate(Display *dpy)
192 return nullptr;
195 CVideoSync* GLXVideoSyncCreate(void* clock, CWinSystemX11GLContext& winSystem)
197 return nullptr;
203 #endif
205 //-----------------------------------------------------------------------------
206 // VDPAU
207 //-----------------------------------------------------------------------------
209 #if defined (HAVE_LIBVDPAU)
210 #include "cores/VideoPlayer/DVDCodecs/Video/VDPAU.h"
211 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.h"
213 namespace KODI
215 namespace WINDOWING
217 namespace X11
220 void VDPAURegisterRender()
222 CRendererVDPAU::Register();
225 void VDPAURegister()
227 VDPAU::CDecoder::Register();
233 #else
235 namespace KODI
237 namespace WINDOWING
239 namespace X11
242 void VDPAURegisterRender()
247 void VDPAURegister()
255 #endif