From c74efea51e60d4430e69d7a955f33367885d84f8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 23 Feb 2023 10:34:07 +0100 Subject: [PATCH] pulse-server: pass format to the null-sink The effect is that the null-sink will report the given format in the Sample Specification, which is what some applications might expect when they pass a format parameter. --- .../module-protocol-pulse/modules/module-null-sink.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/module-protocol-pulse/modules/module-null-sink.c b/src/modules/module-protocol-pulse/modules/module-null-sink.c index 28ba86b06..96a27a248 100644 --- a/src/modules/module-protocol-pulse/modules/module-null-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-null-sink.c @@ -163,6 +163,15 @@ static int module_null_sink_prepare(struct module * const module) if (module_args_to_audioinfo(module->impl, props, &info) < 0) return -EINVAL; + info.format = module->impl->defs.sample_spec.format; + if ((str = pw_properties_get(props, "format")) != NULL) { + info.format = format_paname2id(str, strlen(str)); + pw_properties_set(props, "format", NULL); + } + + if (info.format) + pw_properties_setf(props, SPA_KEY_AUDIO_FORMAT, "%s", + format_id2name(info.format)); if (info.rate) pw_properties_setf(props, SPA_KEY_AUDIO_RATE, "%u", info.rate); if (info.channels) {