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
master
Georges Basile Stavracas Neto 2021-08-14 21:28:06 -03:00 committed by Jim
parent 976d76dfbd
commit 09b5290c7b
1 changed files with 17 additions and 2 deletions

View File

@ -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
}