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

@ -601,12 +601,12 @@ static void make_stream_ports(struct stream *s)
}
if (i < s->info.channels) {
str = spa_debug_type_find_short_name(spa_type_audio_channel,
spa_format_audio_raw_get_position(&s->info, i));
str = spa_type_audio_channel_make_short_name(
spa_format_audio_raw_get_position(&s->info, i),
name, sizeof(name), "UNK");
props = pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit float mono audio",
PW_KEY_AUDIO_CHANNEL, str ? str : "UNK",
PW_KEY_AUDIO_CHANNEL, str,
PW_KEY_PORT_PHYSICAL, "true",
NULL);