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

@ -298,9 +298,9 @@ uint32_t channel_pa2id(enum channel_position channel)
return audio_channels[channel].channel;
}
const char *channel_id2name(uint32_t channel)
const char *channel_id2name(uint32_t channel, char *buf, size_t size)
{
return spa_type_audio_channel_to_short_name(channel);
return spa_type_audio_channel_make_short_name(channel, buf, size, "UNK");
}
uint32_t channel_name2id(const char *name)