mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -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
|
|
@ -6861,7 +6861,8 @@ static void parse_bap_locations(struct spa_bt_monitor *this, const struct spa_di
|
|||
if (spa_atou32(str, value, 0))
|
||||
return;
|
||||
|
||||
if (!spa_audio_parse_position(str, strlen(str), position, &n_channels)) {
|
||||
if (!spa_audio_parse_position_n(str, strlen(str), position,
|
||||
SPA_N_ELEMENTS(position), &n_channels)) {
|
||||
spa_log_error(this->log, "property %s '%s' is not valid position array", key, str);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2972,11 +2972,11 @@ static int apply_device_props(struct impl *this, struct node *node, struct spa_p
|
|||
break;
|
||||
case SPA_PROP_channelVolumes:
|
||||
n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||
volumes, SPA_AUDIO_MAX_CHANNELS);
|
||||
volumes, SPA_N_ELEMENTS(volumes));
|
||||
break;
|
||||
case SPA_PROP_channelMap:
|
||||
n_channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Id,
|
||||
channels, SPA_AUDIO_MAX_CHANNELS);
|
||||
channels, SPA_N_ELEMENTS(channels));
|
||||
break;
|
||||
case SPA_PROP_latencyOffsetNsec:
|
||||
if (spa_pod_get_long(&prop->value, &latency_offset) == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue