pulse-server: improve remap sink/source properties

Make the same MEDIA_NAME and NODE_DESCRIPTION for both streams.
Make a better NODE_NAME for the other stream with a prefix.
This commit is contained in:
Wim Taymans 2022-01-31 12:07:49 +01:00
parent a2a5012cb2
commit 7ec920b0af
2 changed files with 19 additions and 8 deletions

View file

@ -170,6 +170,7 @@ struct module *create_module_remap_sink(struct impl *impl, const char *argument)
if ((str = pw_properties_get(props, "sink_name")) != NULL) { if ((str = pw_properties_get(props, "sink_name")) != NULL) {
pw_properties_set(capture_props, PW_KEY_NODE_NAME, str); pw_properties_set(capture_props, PW_KEY_NODE_NAME, str);
pw_properties_setf(playback_props, PW_KEY_NODE_NAME, "output.%s", str);
pw_properties_set(props, "sink_name", NULL); pw_properties_set(props, "sink_name", NULL);
} }
if ((str = pw_properties_get(props, "sink_properties")) != NULL) { if ((str = pw_properties_get(props, "sink_properties")) != NULL) {
@ -181,10 +182,15 @@ struct module *create_module_remap_sink(struct impl *impl, const char *argument)
if (pw_properties_get(capture_props, PW_KEY_DEVICE_CLASS) == NULL) if (pw_properties_get(capture_props, PW_KEY_DEVICE_CLASS) == NULL)
pw_properties_set(capture_props, PW_KEY_DEVICE_CLASS, "filter"); pw_properties_set(capture_props, PW_KEY_DEVICE_CLASS, "filter");
if (pw_properties_get(capture_props, PW_KEY_NODE_DESCRIPTION) == NULL) { if ((str = pw_properties_get(capture_props, PW_KEY_MEDIA_NAME)) != NULL)
str = pw_properties_get(props, "master"); pw_properties_set(props, PW_KEY_MEDIA_NAME, str);
pw_properties_setf(capture_props, if ((str = pw_properties_get(capture_props, PW_KEY_NODE_DESCRIPTION)) != NULL) {
PW_KEY_NODE_DESCRIPTION, "Remapped %s sink", pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, str);
} else {
if ((str = pw_properties_get(props, "master")) == NULL)
str = pw_properties_get(capture_props, PW_KEY_NODE_NAME);
pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION, "Remapped %s sink",
str ? str : "default"); str ? str : "default");
} }
if ((str = pw_properties_get(props, "master")) != NULL) { if ((str = pw_properties_get(props, "master")) != NULL) {

View file

@ -170,6 +170,7 @@ struct module *create_module_remap_source(struct impl *impl, const char *argumen
if ((str = pw_properties_get(props, "source_name")) != NULL) { if ((str = pw_properties_get(props, "source_name")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_NAME, str); pw_properties_set(playback_props, PW_KEY_NODE_NAME, str);
pw_properties_setf(capture_props, PW_KEY_NODE_NAME, "input.%s", str);
pw_properties_set(props, "source_name", NULL); pw_properties_set(props, "source_name", NULL);
} }
if ((str = pw_properties_get(props, "source_properties")) != NULL) { if ((str = pw_properties_get(props, "source_properties")) != NULL) {
@ -181,10 +182,14 @@ struct module *create_module_remap_source(struct impl *impl, const char *argumen
if (pw_properties_get(playback_props, PW_KEY_DEVICE_CLASS) == NULL) if (pw_properties_get(playback_props, PW_KEY_DEVICE_CLASS) == NULL)
pw_properties_set(playback_props, PW_KEY_DEVICE_CLASS, "filter"); pw_properties_set(playback_props, PW_KEY_DEVICE_CLASS, "filter");
if (pw_properties_get(playback_props, PW_KEY_NODE_DESCRIPTION) == NULL) { if ((str = pw_properties_get(playback_props, PW_KEY_MEDIA_NAME)) != NULL)
str = pw_properties_get(props, "master"); pw_properties_set(props, PW_KEY_MEDIA_NAME, str);
pw_properties_setf(playback_props, if ((str = pw_properties_get(playback_props, PW_KEY_NODE_DESCRIPTION)) != NULL) {
PW_KEY_NODE_DESCRIPTION, "Remapped %s source", pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, str);
} else {
if ((str = pw_properties_get(props, "master")) == NULL)
str = pw_properties_get(playback_props, PW_KEY_NODE_NAME);
pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION, "Remapped %s source",
str ? str : "default"); str ? str : "default");
} }
if ((str = pw_properties_get(props, "master")) != NULL) { if ((str = pw_properties_get(props, "master")) != NULL) {