From 09b5290c7b3909a3086958986973740da44a42c2 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 14 Aug 2021 21:28:06 -0300 Subject: [PATCH] linux-capture: Load XSHM capture on EGL/X11 Unlike Xcomposite, the XSHM plugin does not use GLX code, and thus can be used on when EGL renderer is used. It still is X11-specific though, and shouldn't be used on Wayland. Rework the obs_module_load() function of linux-capture to use a switch statement, and load XSHM both on EGL/X11 and GLX/X11. Fixes https://github.com/obsproject/obs-studio/issues/5122 --- plugins/linux-capture/linux-capture.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/linux-capture/linux-capture.c b/plugins/linux-capture/linux-capture.c index 5c656d3e0..c1d38e359 100644 --- a/plugins/linux-capture/linux-capture.c +++ b/plugins/linux-capture/linux-capture.c @@ -40,12 +40,27 @@ extern void xcomposite_unload(void); bool obs_module_load(void) { - if (obs_get_nix_platform() == OBS_NIX_PLATFORM_X11_GLX) { + enum obs_nix_platform_type platform = obs_get_nix_platform(); + + switch (platform) { + case OBS_NIX_PLATFORM_X11_GLX: obs_register_source(&xshm_input); xcomposite_load(); + break; + + case OBS_NIX_PLATFORM_X11_EGL: + obs_register_source(&xshm_input); #ifdef ENABLE_PIPEWIRE - } else { pipewire_capture_load(); +#endif + break; + +#ifdef ENABLE_WAYLAND + case OBS_NIX_PLATFORM_WAYLAND: +#ifdef ENABLE_PIPEWIRE + pipewire_capture_load(); +#endif + break; #endif }