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.
9 #include "OptionalsReg.h"
11 #include "cores/VideoPlayer/VideoReferenceClock.h"
13 //-----------------------------------------------------------------------------
15 //-----------------------------------------------------------------------------
16 #if defined (HAVE_LIBVA)
17 #include <va/va_x11.h>
18 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
20 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
23 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGLES.h"
26 using namespace KODI::WINDOWING::X11
;
35 class CWinSystemX11GLContext
;
37 class CVaapiProxy
: public VAAPI::IVaapiWinSystem
40 CVaapiProxy() = default;
41 virtual ~CVaapiProxy() = default;
42 VADisplay
GetVADisplay() override
{ return vaGetDisplay(dpy
); };
43 void *GetEGLDisplay() override
{ return eglDisplay
; };
49 CVaapiProxy
* VaapiProxyCreate()
51 return new CVaapiProxy();
54 void VaapiProxyDelete(CVaapiProxy
*proxy
)
59 void VaapiProxyConfig(CVaapiProxy
*proxy
, void *dpy
, void *eglDpy
)
61 proxy
->dpy
= static_cast<Display
*>(dpy
);
62 proxy
->eglDisplay
= eglDpy
;
65 void VAAPIRegister(CVaapiProxy
*winSystem
, bool deepColor
)
67 VAAPI::CDecoder::Register(winSystem
, deepColor
);
71 void VAAPIRegisterRenderGL(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
73 EGLDisplay eglDpy
= winSystem
->eglDisplay
;
74 VADisplay vaDpy
= vaGetDisplay(winSystem
->dpy
);
75 CRendererVAAPIGL::Register(winSystem
, vaDpy
, eglDpy
, general
, deepColor
);
80 void VAAPIRegisterRenderGLES(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
82 EGLDisplay eglDpy
= winSystem
->eglDisplay
;
83 VADisplay vaDpy
= vaGetDisplay(winSystem
->dpy
);
84 CRendererVAAPIGLES::Register(winSystem
, vaDpy
, eglDpy
, general
, deepColor
);
103 CVaapiProxy
* VaapiProxyCreate()
108 void VaapiProxyDelete(CVaapiProxy
*proxy
)
112 void VaapiProxyConfig(CVaapiProxy
*proxy
, void *dpy
, void *eglDpy
)
116 void VAAPIRegister(CVaapiProxy
*winSystem
, bool deepColor
)
120 void VAAPIRegisterRenderGL(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
124 void VAAPIRegisterRenderGLES(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
133 //-----------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------
139 #include "VideoSyncGLX.h"
140 #include "GLContextGLX.h"
149 XID
GLXGetWindow(void* context
)
151 return static_cast<CGLContextGLX
*>(context
)->m_glxWindow
;
154 void* GLXGetContext(void* context
)
156 return static_cast<CGLContextGLX
*>(context
)->m_glxContext
;
159 CGLContext
* GLXContextCreate(Display
*dpy
)
161 return new CGLContextGLX(dpy
);
164 CVideoSync
* GLXVideoSyncCreate(CVideoReferenceClock
* clock
, CWinSystemX11GLContext
& winSystem
)
166 return new CVideoSyncGLX(clock
, winSystem
);
181 XID
GLXGetWindow(void* context
)
186 void* GLXGetContext(void* context
)
191 CGLContext
* GLXContextCreate(Display
*dpy
)
196 CVideoSync
* GLXVideoSyncCreate(CVideoReferenceClock
* clock
, CWinSystemX11GLContext
& winSystem
)
206 //-----------------------------------------------------------------------------
208 //-----------------------------------------------------------------------------
210 #if defined (HAVE_LIBVDPAU)
211 #include "cores/VideoPlayer/DVDCodecs/Video/VDPAU.h"
212 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.h"
221 void VDPAURegisterRender()
223 CRendererVDPAU::Register();
228 VDPAU::CDecoder::Register();
243 void VDPAURegisterRender()