spa: add spa_audio_parse_position_n

Add a function that accepts the size of the position array when reading
the audio positions. This makes it possible to decouple the position
array size from SPA_AUDIO_MAX_CHANNELS.

Also use SPA_N_ELEMENTS to pass the number of array elements to
functions instead of a fixed constant. This makes it easier to change
the array size later to a different constant without having to patch up
all the places where the size is used.
This commit is contained in:
Wim Taymans 2025-10-20 15:16:54 +02:00
parent 9e7cae13df
commit 8bbca3b8f3
27 changed files with 84 additions and 63 deletions

View file

@ -856,7 +856,7 @@ static void parse_props(struct global *g, const struct spa_pod *param, bool devi
uint32_t n_volumes, i;
n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
volumes, SPA_AUDIO_MAX_CHANNELS);
volumes, SPA_N_ELEMENTS(volumes));
g->node.channel_volume.channels = n_volumes;
for (i = 0; i < n_volumes; i++)