summaryrefslogtreecommitdiff
path: root/src/pcm
diff options
context:
space:
mode:
authorAlexander E. Patrakov <patrakov@gmail.com>2014-06-12 16:34:23 +0600
committerJaroslav Kysela <perex@perex.cz>2014-06-13 09:04:29 +0200
commitfb73f310f8e62e04c4b420a2316c2dfd30651b62 (patch)
tree337c5151aacf76f1168f36f3f09614a6054070ae /src/pcm
parent68ae0c72a53704d416fe77d4c612d1f88d791e02 (diff)
pcm: multi: implement rewindable and forwardable callbacks
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'src/pcm')
-rw-r--r--src/pcm/pcm_multi.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
index f58852ca..a84e0ce4 100644
--- a/src/pcm/pcm_multi.c
+++ b/src/pcm/pcm_multi.c
@@ -555,6 +555,42 @@ static int snd_pcm_multi_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *in
return err;
}
+static snd_pcm_sframes_t snd_pcm_multi_rewindable(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ snd_pcm_sframes_t frames = LONG_MAX;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_sframes_t f = snd_pcm_rewindable(multi->slaves[i].pcm);
+ if (f <= 0)
+ return f;
+ if (f < frames)
+ frames = f;
+ }
+
+ return frames;
+
+}
+
+static snd_pcm_sframes_t snd_pcm_multi_forwardable(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ snd_pcm_sframes_t frames = LONG_MAX;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_sframes_t f = snd_pcm_forwardable(multi->slaves[i].pcm);
+ if (f <= 0)
+ return f;
+ if (f < frames)
+ frames = f;
+ }
+
+ return frames;
+
+}
+
static snd_pcm_sframes_t snd_pcm_multi_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
{
snd_pcm_multi_t *multi = pcm->private_data;
@@ -932,7 +968,9 @@ static const snd_pcm_fast_ops_t snd_pcm_multi_fast_ops = {
.writen = snd_pcm_mmap_writen,
.readi = snd_pcm_mmap_readi,
.readn = snd_pcm_mmap_readn,
+ .rewindable = snd_pcm_multi_rewindable,
.rewind = snd_pcm_multi_rewind,
+ .forwardable = snd_pcm_multi_forwardable,
.forward = snd_pcm_multi_forward,
.resume = snd_pcm_multi_resume,
.link = snd_pcm_multi_link,