From d57aa6f7afe2ecf0f8dec9e985e40f3dfb012000 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Mon, 3 Mar 2025 12:24:07 +0000
Subject: [PATCH] pipewire: Don't require pw_check_library_version() with
Pipewire < 0.3.75
The Debian 12 'bookworm' stable release only has 0.3.65, which is earlier
than the introduction of that symbol. Similarly, Steam Runtime 3 'sniper'
and Steam Runtime 2 'soldier' have a backport of 0.3.65 from Debian 12,
so they have the same limitation.
steamrt/tasks#686
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
src/camera/pipewire/SDL_camera_pipewire.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/camera/pipewire/SDL_camera_pipewire.c b/src/camera/pipewire/SDL_camera_pipewire.c
index 5059a9b1e50b8..255ea39ac4284 100644
--- a/src/camera/pipewire/SDL_camera_pipewire.c
+++ b/src/camera/pipewire/SDL_camera_pipewire.c
@@ -62,7 +62,9 @@ static bool pipewire_initialized = false;
// Pipewire entry points
static const char *(*PIPEWIRE_pw_get_library_version)(void);
+#if PW_CHECK_VERSION(0, 3, 75)
static bool (*PIPEWIRE_pw_check_library_version)(int major, int minor, int micro);
+#endif
static void (*PIPEWIRE_pw_init)(int *, char ***);
static void (*PIPEWIRE_pw_deinit)(void);
static struct pw_main_loop *(*PIPEWIRE_pw_main_loop_new)(const struct spa_dict *loop);
@@ -158,7 +160,9 @@ static void unload_pipewire_library(void)
static bool load_pipewire_syms(void)
{
SDL_PIPEWIRE_SYM(pw_get_library_version);
+#if PW_CHECK_VERSION(0, 3, 75)
SDL_PIPEWIRE_SYM(pw_check_library_version);
+#endif
SDL_PIPEWIRE_SYM(pw_init);
SDL_PIPEWIRE_SYM(pw_deinit);
SDL_PIPEWIRE_SYM(pw_main_loop_new);
@@ -1041,7 +1045,11 @@ static bool hotplug_loop_init(void)
spa_list_init(&hotplug.global_list);
+#if PW_CHECK_VERSION(0, 3, 75)
hotplug.have_1_0_5 = PIPEWIRE_pw_check_library_version(1,0,5);
+#else
+ hotplug.have_1_0_5 = false;
+#endif
hotplug.loop = PIPEWIRE_pw_thread_loop_new("SDLPwCameraPlug", NULL);
if (!hotplug.loop) {