spa: make a function to make a channel short name

Make a function that can generate and parse a short name for
the positions that are not in the type list, like the AUX channels.
This commit is contained in:
Wim Taymans 2025-10-22 13:04:53 +02:00
parent 7177f8269d
commit 11f1298f53
16 changed files with 74 additions and 38 deletions

View file

@ -188,7 +188,7 @@ static void pw_properties_from_avahi_string(const char *key, const char *value,
else if (spa_streq(key, "channel_map")) {
struct channel_map channel_map;
uint32_t i, pos[CHANNELS_MAX];
char *p, *s;
char *p, *s, buf[8];
spa_zero(channel_map);
channel_map_parse(value, &channel_map);
@ -198,7 +198,7 @@ static void pw_properties_from_avahi_string(const char *key, const char *value,
p += spa_scnprintf(p, 2, "[");
for (i = 0; i < channel_map.channels; i++)
p += spa_scnprintf(p, 8, "%s%s", i == 0 ? "" : ",",
channel_id2name(pos[i]));
channel_id2name(pos[i], buf, sizeof(buf)));
p += spa_scnprintf(p, 2, "]");
pw_properties_set(props, SPA_KEY_AUDIO_POSITION, s);
}