pcm: Move snd_pcm_channel_area_addr() and _step() to public header

Used in the rate plugins commonly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2021-06-21 14:21:26 +02:00
parent dd609ef968
commit a5e11f9a81
2 changed files with 23 additions and 13 deletions

View file

@ -1173,6 +1173,29 @@ int snd_pcm_areas_copy_wrap(const snd_pcm_channel_area_t *dst_channels,
snd_pcm_uframes_t frames,
const snd_pcm_format_t format);
/**
* \brief get the address of the given PCM channel area
* \param area PCM channel area
* \param offset Offset in frames
*
* Returns the pointer corresponding to the given offset on the channel area.
*/
static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset)
{
return (char *)area->addr + (area->first + area->step * offset) / 8;
}
/**
* \brief get the step size of the given PCM channel area in bytes
* \param area PCM channel area
*
* Returns the step size in bytes from the given channel area.
*/
static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area)
{
return area->step / 8;
}
/** \} */
/**