From e8233117dedb968306db6962af1a1713a546f4a7 Mon Sep 17 00:00:00 2001 From: Gard Kylling Date: Fri, 29 Mar 2024 13:04:47 +0100 Subject: [PATCH] fix source being ignored when using pipewire --- input/pipewire.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/input/pipewire.c b/input/pipewire.c index 7933367..d10eaa0 100644 --- a/input/pipewire.c +++ b/input/pipewire.c @@ -85,8 +85,12 @@ void *input_pipewire(void *audiodata) { props = pw_properties_new(PW_KEY_MEDIA_TYPE, "Audio", PW_KEY_MEDIA_CATEGORY, "Capture", PW_KEY_MEDIA_ROLE, "Music", NULL); - pw_properties_set(props, PW_KEY_TARGET_OBJECT, data.cava_audio->source); - pw_properties_set(props, PW_KEY_STREAM_CAPTURE_SINK, "true"); + const char *source = data.cava_audio->source; + if (strcmp(source, "auto") == 0) { + pw_properties_set(props, PW_KEY_STREAM_CAPTURE_SINK, "true"); + } else { + pw_properties_set(props, PW_KEY_TARGET_OBJECT, source); + } pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%u", nom, data.cava_audio->rate); data.stream = pw_stream_new_simple(pw_main_loop_get_loop(data.loop), "cava", props, @@ -124,4 +128,4 @@ void *input_pipewire(void *audiodata) { pw_main_loop_destroy(data.loop); pw_deinit(); return 0; -} \ No newline at end of file +}