All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: alsa-devel@alsa-project.org
Cc: "Alexander E. Patrakov" <patrakov@gmail.com>
Subject: [PATCH 3/4] pcm: multi: implement rewindable and forwardable callbacks
Date: Thu, 12 Jun 2014 16:34:23 +0600	[thread overview]
Message-ID: <1402569264-2789-4-git-send-email-patrakov@gmail.com> (raw)
In-Reply-To: <1402569264-2789-1-git-send-email-patrakov@gmail.com>

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
---
 src/pcm/pcm_multi.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
index f58852c..a84e0ce 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,
-- 
2.0.0

  parent reply	other threads:[~2014-06-12 10:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 10:34 pcm: Add missing callbacks that cannot be NULL Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 1/4] pcm:file: add the missing htimestamp callback Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 2/4] pcm: rate: add rewindable and forwardable callbacks Alexander E. Patrakov
2014-06-13  7:13   ` Jaroslav Kysela
2014-06-13  8:44     ` Alexander E. Patrakov
2014-06-13  9:19       ` Jaroslav Kysela
2014-06-13  9:46         ` Alexander E. Patrakov
2014-06-12 10:34 ` Alexander E. Patrakov [this message]
2014-06-12 10:34 ` [PATCH 4/4] pcm: null: " Alexander E. Patrakov
2014-06-13  7:14 ` pcm: Add missing callbacks that cannot be NULL Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402569264-2789-4-git-send-email-patrakov@gmail.com \
    --to=patrakov@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.