mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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:
parent
9e7cae13df
commit
8bbca3b8f3
27 changed files with 84 additions and 63 deletions
|
|
@ -866,13 +866,15 @@ static int create_stream(struct stream_info *info)
|
|||
|
||||
s->info = impl->info;
|
||||
if ((str = pw_properties_get(info->stream_props, SPA_KEY_AUDIO_POSITION)) != NULL)
|
||||
spa_audio_parse_position(str, strlen(str), s->info.position, &s->info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), s->info.position,
|
||||
SPA_N_ELEMENTS(s->info.position), &s->info.channels);
|
||||
if (s->info.channels == 0)
|
||||
s->info = impl->info;
|
||||
|
||||
spa_zero(remap_info);
|
||||
if ((str = pw_properties_get(info->stream_props, "combine.audio.position")) != NULL)
|
||||
spa_audio_parse_position(str, strlen(str), remap_info.position, &remap_info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), remap_info.position,
|
||||
SPA_N_ELEMENTS(remap_info.position), &remap_info.channels);
|
||||
if (remap_info.channels == 0)
|
||||
remap_info = s->info;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue