mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-19 07:00:10 -05:00
treewide: access the position information using helpers
Make sure we don't access out of bounds and that we use the helpers wherever we can to access the position information.
This commit is contained in:
parent
8bbca3b8f3
commit
818d1435ce
25 changed files with 155 additions and 114 deletions
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
SPA_API_AUDIO_RAW_UTILS uint32_t
|
||||
spa_format_audio_get_position(struct spa_audio_info_raw *info, uint32_t idx)
|
||||
spa_format_audio_raw_get_position(const struct spa_audio_info_raw *info, uint32_t idx)
|
||||
{
|
||||
uint32_t pos;
|
||||
if (idx < SPA_AUDIO_MAX_CHANNELS) {
|
||||
|
|
@ -41,6 +41,21 @@ spa_format_audio_get_position(struct spa_audio_info_raw *info, uint32_t idx)
|
|||
}
|
||||
return pos;
|
||||
}
|
||||
SPA_API_AUDIO_RAW_UTILS void
|
||||
spa_format_audio_raw_set_position(struct spa_audio_info_raw *info, uint32_t idx, uint32_t position)
|
||||
{
|
||||
if (idx < SPA_AUDIO_MAX_CHANNELS)
|
||||
info->position[idx] = position;
|
||||
}
|
||||
|
||||
SPA_API_AUDIO_RAW_UTILS uint32_t
|
||||
spa_format_audio_raw_copy_positions(const struct spa_audio_info_raw *info, uint32_t *position, uint32_t max_position)
|
||||
{
|
||||
uint32_t i, n_pos = SPA_MIN(info->channels, max_position);
|
||||
for (i = 0; i < n_pos; i++)
|
||||
position[i] = spa_format_audio_raw_get_position(info, i);
|
||||
return n_pos;
|
||||
}
|
||||
|
||||
SPA_API_AUDIO_RAW_UTILS int
|
||||
spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_raw *info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue