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.
This commit is contained in:
Wim Taymans 2023-02-23 10:34:07 +01:00
parent a9756def46
commit c74efea51e

View file

@ -163,6 +163,15 @@ static int module_null_sink_prepare(struct module * const module)
if (module_args_to_audioinfo(module->impl, props, &info) < 0) if (module_args_to_audioinfo(module->impl, props, &info) < 0)
return -EINVAL; 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) if (info.rate)
pw_properties_setf(props, SPA_KEY_AUDIO_RATE, "%u", info.rate); pw_properties_setf(props, SPA_KEY_AUDIO_RATE, "%u", info.rate);
if (info.channels) { if (info.channels) {