pipewire: Raise minimum build version to 0.3.44
parent
566d142938
commit
fb4c15319e
|
@ -134,7 +134,7 @@ endmacro()
|
||||||
# - HAVE_SDL_LOADSO opt
|
# - HAVE_SDL_LOADSO opt
|
||||||
macro(CheckPipewire)
|
macro(CheckPipewire)
|
||||||
if(SDL_PIPEWIRE)
|
if(SDL_PIPEWIRE)
|
||||||
set(PipeWire_PKG_CONFIG_SPEC libpipewire-0.3>=0.3.20)
|
set(PipeWire_PKG_CONFIG_SPEC libpipewire-0.3>=0.3.44)
|
||||||
pkg_check_modules(PC_PIPEWIRE IMPORTED_TARGET ${PipeWire_PKG_CONFIG_SPEC})
|
pkg_check_modules(PC_PIPEWIRE IMPORTED_TARGET ${PipeWire_PKG_CONFIG_SPEC})
|
||||||
if(PC_PIPEWIRE_FOUND)
|
if(PC_PIPEWIRE_FOUND)
|
||||||
set(HAVE_PIPEWIRE TRUE)
|
set(HAVE_PIPEWIRE TRUE)
|
||||||
|
|
|
@ -29,38 +29,6 @@
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/utils/json.h>
|
#include <spa/utils/json.h>
|
||||||
|
|
||||||
#include "../../core/linux/SDL_dbus.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following keys are defined for compatibility when building against older versions of Pipewire
|
|
||||||
* prior to their introduction and can be removed if the minimum required Pipewire build version is
|
|
||||||
* increased to or beyond their point of introduction.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Introduced in 0.3.22
|
|
||||||
* Taken from /src/pipewire/keys.h
|
|
||||||
*/
|
|
||||||
#ifndef PW_KEY_CONFIG_NAME
|
|
||||||
#define PW_KEY_CONFIG_NAME "config.name"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Introduced in 0.3.33
|
|
||||||
* Taken from src/pipewire/keys.h
|
|
||||||
*/
|
|
||||||
#ifndef PW_KEY_NODE_RATE
|
|
||||||
#define PW_KEY_NODE_RATE "node.rate"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Introduced in 0.3.44
|
|
||||||
* Taken from src/pipewire/keys.h
|
|
||||||
*/
|
|
||||||
#ifndef PW_KEY_TARGET_OBJECT
|
|
||||||
#define PW_KEY_TARGET_OBJECT "target.object"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This seems to be a sane lower limit as Pipewire
|
* This seems to be a sane lower limit as Pipewire
|
||||||
* uses it in several of it's own modules.
|
* uses it in several of it's own modules.
|
||||||
|
@ -121,10 +89,6 @@ static struct pw_properties *(*PIPEWIRE_pw_properties_new)(const char *, ...)SPA
|
||||||
static int (*PIPEWIRE_pw_properties_set)(struct pw_properties *, const char *, const char *);
|
static int (*PIPEWIRE_pw_properties_set)(struct pw_properties *, const char *, const char *);
|
||||||
static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *, const char *, ...) SPA_PRINTF_FUNC(3, 4);
|
static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *, const char *, ...) SPA_PRINTF_FUNC(3, 4);
|
||||||
|
|
||||||
static int pipewire_library_version_major;
|
|
||||||
static int pipewire_library_version_minor;
|
|
||||||
static int pipewire_library_version_patch;
|
|
||||||
|
|
||||||
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
||||||
|
|
||||||
static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC;
|
static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC;
|
||||||
|
@ -215,13 +179,6 @@ static int load_pipewire_syms(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool pipewire_library_version_at_least(int major, int minor, int patch)
|
|
||||||
{
|
|
||||||
return (pipewire_library_version_major >= major) &&
|
|
||||||
(pipewire_library_version_major > major || pipewire_library_version_minor >= minor) &&
|
|
||||||
(pipewire_library_version_major > major || pipewire_library_version_minor > minor || pipewire_library_version_patch >= patch);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* When in a container, the library version can differ from the underlying core version,
|
/* When in a container, the library version can differ from the underlying core version,
|
||||||
* so make sure the underlying Pipewire implementation meets the version requirement.
|
* so make sure the underlying Pipewire implementation meets the version requirement.
|
||||||
*/
|
*/
|
||||||
|
@ -310,20 +267,10 @@ static int init_pipewire_library(SDL_bool check_preferred_version)
|
||||||
{
|
{
|
||||||
if (!load_pipewire_library()) {
|
if (!load_pipewire_library()) {
|
||||||
if (!load_pipewire_syms()) {
|
if (!load_pipewire_syms()) {
|
||||||
int nargs;
|
PIPEWIRE_pw_init(NULL, NULL);
|
||||||
const char *version = PIPEWIRE_pw_get_library_version();
|
|
||||||
nargs = SDL_sscanf(version, "%d.%d.%d", &pipewire_library_version_major, &pipewire_library_version_minor, &pipewire_library_version_patch);
|
|
||||||
if (nargs < 3) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SDL can build against 0.3.20, but requires 0.3.24 at minimum
|
if (!check_preferred_version || pipewire_core_version_at_least(1, 0, 0)) {
|
||||||
if (pipewire_library_version_at_least(0, 3, 24)) {
|
return 0;
|
||||||
PIPEWIRE_pw_init(NULL, NULL);
|
|
||||||
|
|
||||||
if (!check_preferred_version || pipewire_core_version_at_least(1, 0, 0)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1253,25 +1200,13 @@ static int PIPEWIRE_OpenDevice(SDL_AudioDevice *device)
|
||||||
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true");
|
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true");
|
||||||
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_DONT_RECONNECT, "true"); // Requesting a specific device, don't migrate to new default hardware.
|
PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_DONT_RECONNECT, "true"); // Requesting a specific device, don't migrate to new default hardware.
|
||||||
|
|
||||||
/*
|
if (node_id != PW_ID_ANY) {
|
||||||
* Pipewire 0.3.44 introduced PW_KEY_TARGET_OBJECT that takes either a path
|
PIPEWIRE_pw_thread_loop_lock(hotplug_loop);
|
||||||
* (PW_KEY_NODE_NAME) or node serial number (PE_KEY_OBJECT_SERIAL) to connect
|
const struct io_node *node = io_list_get_by_id(node_id);
|
||||||
* the stream to its target. The target_id parameter in pw_stream_connect() is
|
if (node) {
|
||||||
* now deprecated and should always be PW_ID_ANY.
|
PIPEWIRE_pw_properties_set(props, PW_KEY_TARGET_OBJECT, node->path);
|
||||||
*/
|
|
||||||
if (pipewire_library_version_at_least(0, 3, 44)) {
|
|
||||||
if (node_id != PW_ID_ANY) {
|
|
||||||
const struct io_node *node;
|
|
||||||
|
|
||||||
PIPEWIRE_pw_thread_loop_lock(hotplug_loop);
|
|
||||||
node = io_list_get_by_id(node_id);
|
|
||||||
if (node) {
|
|
||||||
PIPEWIRE_pw_properties_set(props, PW_KEY_TARGET_OBJECT, node->path);
|
|
||||||
}
|
|
||||||
PIPEWIRE_pw_thread_loop_unlock(hotplug_loop);
|
|
||||||
|
|
||||||
node_id = PW_ID_ANY;
|
|
||||||
}
|
}
|
||||||
|
PIPEWIRE_pw_thread_loop_unlock(hotplug_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the new stream
|
// Create the new stream
|
||||||
|
@ -1281,7 +1216,8 @@ static int PIPEWIRE_OpenDevice(SDL_AudioDevice *device)
|
||||||
return SDL_SetError("Pipewire: Failed to create stream (%i)", errno);
|
return SDL_SetError("Pipewire: Failed to create stream (%i)", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = PIPEWIRE_pw_stream_connect(priv->stream, iscapture ? PW_DIRECTION_INPUT : PW_DIRECTION_OUTPUT, node_id, STREAM_FLAGS,
|
// The target node is passed via PW_KEY_TARGET_OBJECT; target_id is a legacy parameter and must be PW_ID_ANY.
|
||||||
|
res = PIPEWIRE_pw_stream_connect(priv->stream, iscapture ? PW_DIRECTION_INPUT : PW_DIRECTION_OUTPUT, PW_ID_ANY, STREAM_FLAGS,
|
||||||
¶ms, 1);
|
¶ms, 1);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
return SDL_SetError("Pipewire: Failed to connect stream");
|
return SDL_SetError("Pipewire: Failed to connect stream");
|
||||||
|
|
Loading…
Reference in New Issue