diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-10-12 16:14:07 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-10-12 16:14:07 +0200 |
commit | 86e2a570d1bf5b6761f205fb16e4b43e6bdcd599 (patch) | |
tree | ce726617dc41c92400336aa8540375ccb86b91dd | |
parent | efe46f03f3871ac856c4c1e255123b0e5fed4789 (diff) | |
download | salsa-lib-86e2a570d1bf5b6761f205fb16e4b43e6bdcd599.tar.gz |
Define snd_pcm_forwardable() and snd_pcm_rewindable()
Those are aliases for snd_pcm_mmap_avail() and
snd_pcm_mmap_hw_avail().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | src/pcm.c | 10 | ||||
-rw-r--r-- | src/pcm_func.h | 3 |
2 files changed, 12 insertions, 1 deletions
@@ -969,9 +969,17 @@ static snd_pcm_uframes_t snd_pcm_mmap_avail(snd_pcm_t *pcm) return snd_pcm_mmap_capture_avail(pcm); } -snd_pcm_sframes_t snd_pcm_hw_forwardable(snd_pcm_t *pcm) +static snd_pcm_sframes_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm) +{ + return pcm->buffer_size - snd_pcm_mmap_avail(pcm); +} + +snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm) __attribute__ ((alias("snd_pcm_mmap_avail"))); +snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm) + __attribute__ ((alias("snd_pcm_mmap_hw_avail"))); + snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm) { snd_pcm_uframes_t avail; diff --git a/src/pcm_func.h b/src/pcm_func.h index 3224853..fb9a69b 100644 --- a/src/pcm_func.h +++ b/src/pcm_func.h @@ -148,6 +148,9 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format); +snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm); +snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm); + #if SALSA_HAS_ASYNC_SUPPORT int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, |