logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

gst-plugins-vaapi-1.18.4.ebuild (4064B)


  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit gstreamer-meson
  5. MY_PN="gstreamer-vaapi"
  6. DESCRIPTION="Hardware accelerated video decoding through VA-API plugin for GStreamer"
  7. HOMEPAGE="https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi"
  8. SRC_URI="https://gstreamer.freedesktop.org/src/${MY_PN}/${MY_PN}-${PV}.tar.xz"
  9. LICENSE="LGPL-2.1+"
  10. SLOT="1.0"
  11. KEYWORDS="~amd64 ~arm64 ~x86"
  12. IUSE="+drm +egl gles2 +opengl wayland +X" # Keep default enabled IUSE in sync with gst-plugins-base and libva
  13. # gst-vaapi configure is based around GL platform mainly, unlike gst-plugins-bad that goes by GL API mainly; for less surprises,
  14. # we design gst-vaapi ebuild in terms of GL API as main choice as well, meaning that USE opengl and/or gles2 is required to
  15. # enable opengl support at all and choices get chained from there.
  16. # One or multiple video output are required: drm, x11, glx, egl and/or wayland;
  17. # but GL API is our main trigger, thus USE=egl should be ineffective if neither gles2 or opengl is enabled;
  18. # So "|| ( drm egl opengl wayland X )" would be wrong, because egl isn't built with USE="egl -opengl -gles2", ending up with no video outputs.
  19. # As we ensure at least one working GL output with other REQUIRED_USE, we can put gles2/opengl in REQUIRED_USE instead of egl, solving the issue.
  20. # gles2 API only supported windowing system (on linux) is EGL, so require it
  21. # opengl API only supported windowing systems (on linux) are EGL and GLX, so require one of them (glx is enabled with USE="opengl X")
  22. REQUIRED_USE="
  23. || ( drm gles2 opengl wayland X )
  24. gles2? ( egl )
  25. opengl? ( || ( egl X ) )
  26. "
  27. # glx doesn't require libva-glx (libva[opengl]) afaics, only by tests/test-display.c
  28. # USE flag behavior:
  29. # 'drm' enables vaapi drm support
  30. # 'egl' enables EGL platform support (but only if also 'opengl||gles2')
  31. # - 'egl' is exposed as a USE flag mainly to get EGL support instead of or in addition to GLX support with desktop GL while keeping it optional for pure GLX cases;
  32. # it's always required with USE=gles2, thus USE="gles2 opengl X" will require and build desktop GL EGL platform support as well on top of GLX, which doesn't add extra deps at that point.
  33. # 'gles2' enables GLESv2 or GLESv3 based GL API support
  34. # 'opengl' enables desktop OpenGL based GL API support
  35. # 'wayland' enables non-GL Wayland support; wayland EGL support when combined with 'egl' (but only if also 'opengl||gles2')
  36. # 'X' enables non-GL X support; GLX support when combined with 'opengl'
  37. # gst-plugins-bad still needed for codecparsers (GL libraries moved to -base); checked for 1.14 (recheck for 1.16)
  38. GST_REQ="${PV}"
  39. GL_DEPS="
  40. >=media-libs/gst-plugins-base-${GST_REQ}:${SLOT}[egl?,gles2?,opengl?,wayland?,X?]
  41. media-libs/mesa[gles2?,egl?,X?,${MULTILIB_USEDEP}]
  42. "
  43. RDEPEND="
  44. >=dev-libs/glib-2.40:2[${MULTILIB_USEDEP}]
  45. >=media-libs/gst-plugins-base-${GST_REQ}:${SLOT}[${MULTILIB_USEDEP}]
  46. >=media-libs/gst-plugins-bad-${GST_REQ}:${SLOT}[${MULTILIB_USEDEP}]
  47. >=x11-libs/libva-1.4.0:=[drm?,wayland?,X?,${MULTILIB_USEDEP}]
  48. drm? (
  49. >=virtual/libudev-208:=[${MULTILIB_USEDEP}]
  50. >=x11-libs/libdrm-2.4.46[${MULTILIB_USEDEP}]
  51. )
  52. gles2? ( ${GL_DEPS} )
  53. opengl? ( ${GL_DEPS} )
  54. wayland? ( >=dev-libs/wayland-1.11.0[${MULTILIB_USEDEP}] )
  55. X? (
  56. >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
  57. >=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
  58. x11-libs/libXrender[${MULTILIB_USEDEP}] )
  59. "
  60. DEPEND="${RDEPEND}
  61. >=dev-util/gtk-doc-am-1.12
  62. "
  63. S="${WORKDIR}/${MY_PN}-${PV}"
  64. multilib_src_configure() {
  65. local emesonargs=(
  66. -Dwith_encoders=yes
  67. -Ddrm=$(usex drm yes no)
  68. -Dwith_x11=$(usex X yes no)
  69. -Dwith_wayland=$(usex wayland yes no)
  70. )
  71. if use opengl || use gles2; then
  72. emesonargs+=( -Dwith_egl=$(usex egl yes no) )
  73. else
  74. emesonargs+=( -Dwith_egl=no )
  75. fi
  76. if use opengl && use X; then
  77. emesonargs+=( -Dwith_glx=yes )
  78. else
  79. emesonargs+=( -Dwith_glx=no )
  80. fi
  81. # Workaround EGL/eglplatform.h being built with X11 present
  82. use X || export CFLAGS="${CFLAGS} -DEGL_NO_X11"
  83. gstreamer_multilib_src_configure
  84. }