alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: vinod.koul@intel.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH TINYCOMPRESS 14/14 v2] cplay: support	auto-configuration of fragment size and count
Date: Fri, 22 Feb 2013 16:11:25 +0000	[thread overview]
Message-ID: <20130222161125.GN21174@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20130210002340.GN31139@opensource.wolfsonmicro.com>

Default the fragment size and count to zero to take advantage
of the auto-configuration support that was added to tinycompress.
If user doesn't override these by specifying -f and -b values
on the command line, they will be passed to tinycompress as zero
and tinycompress will query the driver for size and count.

---
 cplay.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/cplay.c b/cplay.c
index 3af6d13..60995a4 100644
--- a/cplay.c
+++ b/cplay.c
@@ -152,9 +152,9 @@ static int print_time(struct compress *compress)
 int main(int argc, char **argv)
 {
 	char *file;
-	unsigned long buffer_size = 100*1024;
+	unsigned long buffer_size = 0;
 	int c;
-	unsigned int card = 0, device = 0, frag = 4;
+	unsigned int card = 0, device = 0, frag = 0;
 
 
 	if (argc < 2)
@@ -276,8 +276,14 @@ void play_samples(char *name, unsigned int card, unsigned int device,
 	codec.level = 0;
 	codec.ch_mode = 0;
 	codec.format = 0;
-	config.fragment_size = buffer_size/frag;
-	config.fragments = frag;
+	if ((buffer_size != 0) && (frag != 0)) {
+		config.fragment_size = buffer_size/frag;
+		config.fragments = frag;
+	} else {
+		/* use driver defaults */
+		config.fragment_size = 0;
+		config.fragments = 0;
+	}
 	config.codec = &codec;
 
 	compress = compress_open(card, device, COMPRESS_IN, &config);
-- 
1.7.2.5

      parent reply	other threads:[~2013-02-22 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10  0:23 [PATCH TINYCOMPRESS 14/14] cplay: support auto-configuration of fragment size and count Richard Fitzgerald
2013-02-11  8:53 ` Vinod Koul
2013-02-11  9:58   ` Richard Fitzgerald
2013-02-11 10:43     ` Vinod Koul
2013-02-11 10:10   ` Richard Fitzgerald
2013-02-22 16:11 ` Richard Fitzgerald [this message]

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=20130222161125.GN21174@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=vinod.koul@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).