[alsa-devel] [PATCH TINYCOMPRESS 14/14] cplay: support auto-configuration of fragment size and count
Richard Fitzgerald
rf at opensource.wolfsonmicro.com
Sun Feb 10 01:23:40 CET 2013
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 at 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
More information about the Alsa-devel
mailing list