meson: Enable gstreamer-gl-1.0 features in gtk4 plugin

Basically, if gstreamer-gl-1.0 is built with wayland / x11 / egl, use
those features in the gtk4 plugin.

MacOS always uses CGL, and it's always available. Windows version does
not use GL yet.

Requires https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3654

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1031>
This commit is contained in:
Nirbheek Chauhan 2022-12-29 03:50:34 +05:30
parent f94e422b61
commit 002e3fa171

View file

@ -41,6 +41,49 @@ else
ext_static = 'a' ext_static = 'a'
endif endif
# Extra env to pass to cargo
extra_env = {}
# Used to not lookup the same dependency multiple times which clutters logs
deps_cache = {}
# Need to depends on all gstreamer-rs deps to ensure they are built
# before gstreamer-rs when building with gst-build.
# Custom targets can't depend on dependency() objects so we have to depend
# on the library variable from the subproject instead.
glib_req = '>=2.62'
gst_req = '>=1.20.0'
depends = []
deps = [
# name, subproject name, subproject dep, library object
['gstreamer-1.0', 'gstreamer', 'gst_dep', 'libgst'],
['gstreamer-app-1.0', 'gst-plugins-base', 'app_dep', 'gstapp'],
['gstreamer-audio-1.0', 'gst-plugins-base', 'audio_dep', 'gstaudio'],
['gstreamer-base-1.0', 'gstreamer', 'gst_base_dep', 'gst_base'],
['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check'],
['gstreamer-gl-1.0', 'gst-plugins-base', 'gst_gl_dep', 'gstgl'],
['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net'],
['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp'],
['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'],
['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp'],
['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc'],
]
glib_dep = dependency('glib-2.0', version: glib_req)
deps_cache += {'glib-2.0': glib_dep}
foreach d: deps
dep = dependency(d[0], version: gst_req,
fallback : [d[1], d[2]])
set_variable(d[2], dep)
deps_cache += {d[0]: dep}
if dep.type_name() == 'internal'
lib = subproject(d[1]).get_variable(d[3])
depends += lib
endif
endforeach
# kept in the same order as the `members` list in Cargo.toml # kept in the same order as the `members` list in Cargo.toml
plugins = { plugins = {
'audiofx': { 'audiofx': {
@ -139,11 +182,7 @@ plugins = {
'library': 'libgstgif', 'library': 'libgstgif',
'examples': ['testvideosrc2gif'], 'examples': ['testvideosrc2gif'],
}, },
'gtk4': { # gtk4 is added below
'library': 'libgstgtk4',
'examples': ['gtksink'],
'extra-deps': {'gtk4': '>=4.6'},
},
'hsv': {'library': 'libgsthsv'}, 'hsv': {'library': 'libgsthsv'},
'png': { 'png': {
'library': 'libgstrspng', 'library': 'libgstrspng',
@ -169,8 +208,6 @@ if host_system not in ['windows', 'darwin']
}} }}
endif endif
extra_env = {}
sodium_opt = get_option('sodium') sodium_opt = get_option('sodium')
if sodium_opt.allowed() if sodium_opt.allowed()
sodium_plugin = {'sodium': { sodium_plugin = {'sodium': {
@ -210,45 +247,30 @@ if csound_option.allowed()
endif endif
endif endif
# Used to not lookup the same dependency multiple times which clutters logs if get_option('gtk4').allowed()
deps_cache = {} gtk4_features = []
gl_winsys = gst_gl_dep.get_variable('gl_winsys').split()
# Need to depends on all gstreamer-rs deps to ensure they are built gl_platforms = gst_gl_dep.get_variable('gl_platforms').split()
# before gstreamer-rs when building with gst-build. if host_system == 'linux'
# Custom targets can't depend on dependency() objects so we have to depend if 'wayland' in gl_winsys
# on the library variable from the subproject instead. gtk4_features += 'wayland'
glib_req = '>=2.62' endif
gst_req = '>=1.20.0' if 'x11' in gl_winsys
depends = [] if 'egl' in gl_platforms
gtk4_features += 'x11egl'
deps = [ endif
# name, subproject name, subproject dep, library object if 'glx' in gl_platforms
['gstreamer-1.0', 'gstreamer', 'gst_dep', 'libgst'], gtk4_features += 'x11glx'
['gstreamer-app-1.0', 'gst-plugins-base', 'app_dep', 'gstapp'], endif
['gstreamer-audio-1.0', 'gst-plugins-base', 'audio_dep', 'gstaudio'], endif
['gstreamer-base-1.0', 'gstreamer', 'gst_base_dep', 'gst_base'], endif
['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check'], plugins += {'gtk4': {
['gstreamer-gl-1.0', 'gst-plugins-base', 'gst_gl_dep', 'gstgl'], 'library': 'libgstgtk4',
['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net'], 'examples': ['gtksink'],
['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp'], 'extra-deps': {'gtk4': '>=4.6'},
['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'], 'features': gtk4_features,
['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp'], }}
['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc'],
]
glib_dep = dependency('glib-2.0', version: glib_req)
deps_cache += {'glib-2.0': glib_dep}
foreach d: deps
dep = dependency(d[0], version: gst_req,
fallback : [d[1], d[2]])
set_variable(d[2], dep)
deps_cache += {d[0]: dep}
if dep.type_name() == 'internal'
lib = subproject(d[1]).get_variable(d[3])
depends += lib
endif endif
endforeach
# Process plugins list # Process plugins list