| 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 |
//----------------------------------------------------------------------------- |
| 12 |
// VAAPI |
| 13 |
//----------------------------------------------------------------------------- |
| 14 |
#if defined(HAVE_LIBVA) && defined(HAS_EGL) |
| 15 |
#include <va/va_wayland.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 |
| 23 |
|
| 24 |
namespace KODI |
| 25 |
{ |
| 26 |
namespace WINDOWING |
| 27 |
{ |
| 28 |
namespace WAYLAND |
| 29 |
{ |
| 30 |
|
| 31 |
class CVaapiProxy : public VAAPI::IVaapiWinSystem |
| 32 |
{ |
| 33 |
public: |
| 34 |
CVaapiProxy() = default; |
| 35 |
virtual ~CVaapiProxy() = default; |
| 36 |
VADisplay GetVADisplay() override { return vaGetDisplayWl(dpy); }; |
| 37 |
void *GetEGLDisplay() override { return eglDisplay; }; |
| 38 |
|
| 39 |
wl_display *dpy; |
| 40 |
void *eglDisplay; |
| 41 |
}; |
| 42 |
|
| 43 |
CVaapiProxy* VaapiProxyCreate() |
| 44 |
{ |
| 45 |
return new CVaapiProxy(); |
| 46 |
} |
| 47 |
|
| 48 |
void VaapiProxyDelete(CVaapiProxy* proxy) |
| 49 |
{ |
| 50 |
delete proxy; |
| 51 |
} |
| 52 |
|
| 53 |
void VaapiProxyConfig(CVaapiProxy* proxy, void* dpy, void* eglDpy) |
| 54 |
{ |
| 55 |
proxy->dpy = static_cast<wl_display*>(dpy); |
| 56 |
proxy->eglDisplay = eglDpy; |
| 57 |
} |
| 58 |
|
| 59 |
void VAAPIRegister(CVaapiProxy* winSystem, bool deepColor) |
| 60 |
{ |
| 61 |
VAAPI::CDecoder::Register(winSystem, deepColor); |
| 62 |
} |
| 63 |
|
| 64 |
#if defined(HAS_GL) |
| 65 |
void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor) |
| 66 |
{ |
| 67 |
EGLDisplay eglDpy = winSystem->eglDisplay; |
| 68 |
VADisplay vaDpy = vaGetDisplayWl(winSystem->dpy); |
| 69 |
CRendererVAAPIGL::Register(winSystem, vaDpy, eglDpy, general, deepColor); |
| 70 |
} |
| 71 |
#endif |
| 72 |
|
| 73 |
#if defined(HAS_GLES) |
| 74 |
void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor) |
| 75 |
{ |
| 76 |
EGLDisplay eglDpy = winSystem->eglDisplay; |
| 77 |
VADisplay vaDpy = vaGetDisplayWl(winSystem->dpy); |
| 78 |
CRendererVAAPIGLES::Register(winSystem, vaDpy, eglDpy, general, deepColor); |
| 79 |
} |
| 80 |
#endif |
| 81 |
|
| 82 |
} // namespace WAYLAND |
| 83 |
} // namespace WINDOWING |
| 84 |
} // namespace KODI |
| 85 |
|
| 86 |
#else |
| 87 |
|
| 88 |
namespace KODI |
| 89 |
{ |
| 90 |
namespace WINDOWING |
| 91 |
{ |
| 92 |
namespace WAYLAND |
| 93 |
{ |
| 94 |
|
| 95 |
class CVaapiProxy |
| 96 |
{ |
| 97 |
}; |
| 98 |
|
| 99 |
CVaapiProxy* VaapiProxyCreate() |
| 100 |
{ |
| 101 |
return nullptr; |
| 102 |
} |
| 103 |
|
| 104 |
void VaapiProxyDelete(CVaapiProxy* proxy) |
| 105 |
{ |
| 106 |
} |
| 107 |
|
| 108 |
void VaapiProxyConfig(CVaapiProxy* proxy, void* dpy, void* eglDpy) |
| 109 |
{ |
| 110 |
|
| 111 |
} |
| 112 |
|
| 113 |
void VAAPIRegister(CVaapiProxy* winSystem, bool deepColor) |
| 114 |
{ |
| 115 |
|
| 116 |
} |
| 117 |
|
| 118 |
#if defined(HAS_GL) |
| 119 |
void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor) |
| 120 |
{ |
| 121 |
|
| 122 |
} |
| 123 |
#endif |
| 124 |
|
| 125 |
#if defined(HAS_GLES) |
| 126 |
void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor) |
| 127 |
{ |
| 128 |
} |
| 129 |
#endif |
| 130 |
|
| 131 |
} // namespace WAYLAND |
| 132 |
} // namespace WINDOWING |
| 133 |
} // namespace KODI |
| 134 |
|
| 135 |
#endif |
| 136 |
|