pulse-server: convert channel_map channels

channel_map contains pulseaudio channel names, convert them to
pipewire channel ids and then into pipewire channel names for the
null sink.
This commit is contained in:
Wim Taymans 2020-12-07 20:29:22 +01:00
parent 1e89e7559b
commit 157d6de607
2 changed files with 24 additions and 1 deletions

View file

@ -180,7 +180,17 @@ static int load_module(struct client *client, const char *name, const char *argu
pw_properties_set(props, "rate", NULL);
}
if ((str = pw_properties_get(props, "channel_map")) != NULL) {
pw_properties_set(props, "audio.position", str);
struct channel_map map = CHANNEL_MAP_INIT;
uint32_t i;
char *s, *p;
channel_map_parse(str, &map);
p = s = alloca(map.channels * 6);
for (i = 0; i < map.channels; i++)
p += snprintf(p, 6, "%s%s", i == 0 ? "" : ",",
channel_id2name(map.map[i]));
pw_properties_set(props, "audio.position", s);
pw_properties_set(props, "channel_map", NULL);
}
if ((str = pw_properties_get(props, "device.description")) != NULL) {