]> git.alsa-project.org Git - tinycompress.git/commitdiff
cplay: support auto-configuration of fragment size and count
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Fri, 22 Feb 2013 16:11:25 +0000 (16:11 +0000)
committerVinod Koul <vinod.koul@intel.com>
Fri, 22 Feb 2013 18:08:12 +0000 (23:38 +0530)
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: Vinod Koul <vinod.koul@intel.com>
cplay.c

diff --git a/cplay.c b/cplay.c
index 3af6d1375f099baa758d75d0297494bb580144ac..60995a4ca3644c0202b5bc1cd15169e69b197371 100644 (file)
--- 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);