alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH TINYCOMPRESS 14/14] cplay: support auto-configuration of fragment size and count
@ 2013-02-10  0:23 Richard Fitzgerald
  2013-02-11  8:53 ` Vinod Koul
  2013-02-22 16:11 ` [PATCH TINYCOMPRESS 14/14 v2] " Richard Fitzgerald
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Fitzgerald @ 2013-02-10  0:23 UTC (permalink / raw)
  To: vinod.koul; +Cc: alsa-devel

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.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-22 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH TINYCOMPRESS 14/14 v2] " Richard Fitzgerald

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).