From 53cd601869758aa7cd7d7ee4de7a94a2e34667df Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 25 Apr 2021 10:37:51 +0200 Subject: [PATCH] pulse-server: apply node.name to all streams Pass properties as global properties so that they are applied to both streams. Make sure node.name is set on both streams so that they look good in tools like carla. --- .../module-protocol-pulse/modules/module-remap-sink.c | 11 +++++------ .../modules/module-remap-source.c | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/modules/module-protocol-pulse/modules/module-remap-sink.c b/src/modules/module-protocol-pulse/modules/module-remap-sink.c index a0d0c908c..c0d9cb104 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-sink.c @@ -65,7 +65,6 @@ static const struct pw_impl_module_events module_events = { static void serialize_dict(FILE *f, const struct spa_dict *dict) { const struct spa_dict_item *it; - fprintf(f, "{"); spa_dict_for_each(it, dict) { size_t len = it->value ? strlen(it->value) : 0; fprintf(f, " \"%s\" = ", it->key); @@ -82,7 +81,6 @@ static void serialize_dict(FILE *f, const struct spa_dict *dict) fprintf(f, "%s", str); } } - fprintf(f, " }"); } static int module_remap_sink_load(struct client *client, struct module *module) @@ -97,11 +95,12 @@ static int module_remap_sink_load(struct client *client, struct module *module) f = open_memstream(&args, &size); fprintf(f, "{"); - fprintf(f, " capture.props = "); + serialize_dict(f, &module->props->dict); + fprintf(f, " capture.props = {"); serialize_dict(f, &data->capture_props->dict); - fprintf(f, " playback.props = "); + fprintf(f, " } playback.props = {"); serialize_dict(f, &data->playback_props->dict); - fprintf(f, " }"); + fprintf(f, " } }"); fclose(f); data->mod = pw_context_load_module(module->impl->context, @@ -192,7 +191,7 @@ struct module *create_module_remap_sink(struct impl *impl, const char *argument) module_args_add_props(props, argument); if ((str = pw_properties_get(props, "sink_name")) != NULL) { - pw_properties_set(capture_props, PW_KEY_NODE_NAME, str); + pw_properties_set(props, PW_KEY_NODE_NAME, str); pw_properties_set(props, "sink_name", NULL); } else { pw_properties_set(props, PW_KEY_NODE_NAME, "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 2b42efdfb..4f1e41e45 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-source.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-source.c @@ -65,7 +65,6 @@ static const struct pw_impl_module_events module_events = { static void serialize_dict(FILE *f, const struct spa_dict *dict) { const struct spa_dict_item *it; - fprintf(f, "{"); spa_dict_for_each(it, dict) { size_t len = it->value ? strlen(it->value) : 0; fprintf(f, " \"%s\" = ", it->key); @@ -82,7 +81,6 @@ static void serialize_dict(FILE *f, const struct spa_dict *dict) fprintf(f, "%s", str); } } - fprintf(f, " }"); } static int module_remap_source_load(struct client *client, struct module *module) @@ -97,11 +95,12 @@ static int module_remap_source_load(struct client *client, struct module *module f = open_memstream(&args, &size); fprintf(f, "{"); - fprintf(f, " capture.props = "); + serialize_dict(f, &module->props->dict); + fprintf(f, " capture.props = { "); serialize_dict(f, &data->capture_props->dict); - fprintf(f, " playback.props = "); + fprintf(f, " } playback.props = { "); serialize_dict(f, &data->playback_props->dict); - fprintf(f, " }"); + fprintf(f, " } }"); fclose(f); data->mod = pw_context_load_module(module->impl->context, @@ -192,7 +191,7 @@ struct module *create_module_remap_source(struct impl *impl, const char *argumen module_args_add_props(props, argument); if ((str = pw_properties_get(props, "source_name")) != NULL) { - pw_properties_set(playback_props, PW_KEY_NODE_NAME, str); + pw_properties_set(props, PW_KEY_NODE_NAME, str); pw_properties_set(props, "source_name", NULL); } else { pw_properties_set(props, PW_KEY_NODE_NAME, "null");