From 8767e8ed97a14dd2d61bb18e99742cdd1abcefd1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 10 Jan 2023 16:22:39 +0100 Subject: [PATCH] pulse-server: handle .monitor master source --- .../modules/module-ladspa-source.c | 10 +++++++++- .../modules/module-remap-source.c | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c index c1d66fc2f..4124e34f9 100644 --- a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c +++ b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c @@ -219,7 +219,15 @@ static int module_ladspa_source_prepare(struct module * const module) if ((str = pw_properties_get(props, "master")) != NULL || (str = pw_properties_get(props, "source_master")) != NULL) { - pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str); + if (spa_strendswith(str, ".monitor")) { + pw_properties_setf(capture_props, PW_KEY_TARGET_OBJECT, + "%.*s", (int)strlen(str)-8, str); + pw_properties_set(capture_props, PW_KEY_STREAM_CAPTURE_SINK, + "true"); + } else { + pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str); + } + pw_properties_set(props, "source_master", NULL); pw_properties_set(props, "master", NULL); } diff --git a/src/modules/module-protocol-pulse/modules/module-remap-source.c b/src/modules/module-protocol-pulse/modules/module-remap-source.c index 655694152..5b8d47db7 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-source.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-source.c @@ -197,7 +197,14 @@ static int module_remap_source_prepare(struct module * const module) } } if ((str = pw_properties_get(props, "master")) != NULL) { - pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str); + if (spa_strendswith(str, ".monitor")) { + pw_properties_setf(capture_props, PW_KEY_TARGET_OBJECT, + "%.*s", (int)strlen(str)-8, str); + pw_properties_set(capture_props, PW_KEY_STREAM_CAPTURE_SINK, + "true"); + } else { + pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str); + } pw_properties_set(props, "master", NULL); }