mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05: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
|
|
@ -1371,21 +1371,21 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
}
|
||||
|
||||
if ((str = pw_properties_get(impl->capture_props, SPA_KEY_AUDIO_POSITION)) != NULL) {
|
||||
spa_audio_parse_position(str, strlen(str),
|
||||
impl->capture_info.position, &impl->capture_info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), impl->capture_info.position,
|
||||
SPA_N_ELEMENTS(impl->capture_info.position), &impl->capture_info.channels);
|
||||
}
|
||||
if ((str = pw_properties_get(impl->source_props, SPA_KEY_AUDIO_POSITION)) != NULL) {
|
||||
spa_audio_parse_position(str, strlen(str),
|
||||
impl->source_info.position, &impl->source_info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), impl->source_info.position,
|
||||
SPA_N_ELEMENTS(impl->source_info.position), &impl->source_info.channels);
|
||||
}
|
||||
if ((str = pw_properties_get(impl->sink_props, SPA_KEY_AUDIO_POSITION)) != NULL) {
|
||||
spa_audio_parse_position(str, strlen(str),
|
||||
impl->sink_info.position, &impl->sink_info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), impl->sink_info.position,
|
||||
SPA_N_ELEMENTS(impl->sink_info.position), &impl->sink_info.channels);
|
||||
impl->playback_info = impl->sink_info;
|
||||
}
|
||||
if ((str = pw_properties_get(impl->playback_props, SPA_KEY_AUDIO_POSITION)) != NULL) {
|
||||
spa_audio_parse_position(str, strlen(str),
|
||||
impl->playback_info.position, &impl->playback_info.channels);
|
||||
spa_audio_parse_position_n(str, strlen(str), impl->playback_info.position,
|
||||
SPA_N_ELEMENTS(impl->playback_info.position), &impl->playback_info.channels);
|
||||
if (impl->playback_info.channels != impl->sink_info.channels)
|
||||
impl->playback_info = impl->sink_info;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue