spa: parse the audio.position completetly

Parse the audio.position spec completely so that we have the right
number of channels but only store the first max_position channels.

Also rename some field to make it clear that this is about the max
number of channel positions.
This commit is contained in:
Wim Taymans 2025-10-22 12:47:00 +02:00
parent ae50bb5dc0
commit 6465a63bf6
4 changed files with 13 additions and 11 deletions

View file

@ -72,7 +72,7 @@ struct buffer {
#define BW_PERIOD (3 * SPA_NSEC_PER_SEC)
struct channel_map {
uint32_t channels;
uint32_t n_pos;
uint32_t pos[MAX_CHANNELS];
};
@ -315,7 +315,7 @@ void spa_alsa_emit_port_info(struct state *state, bool full);
static inline void spa_alsa_parse_position(struct channel_map *map, const char *val, size_t len)
{
spa_audio_parse_position_n(val, len, map->pos, SPA_N_ELEMENTS(map->pos), &map->channels);
spa_audio_parse_position_n(val, len, map->pos, SPA_N_ELEMENTS(map->pos), &map->n_pos);
}
static inline uint32_t spa_alsa_parse_rates(uint32_t *rates, uint32_t max, const char *val, size_t len)