From 8f18a69a10e43b4b747d483b0ad1e1788c6ca69b Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Fri, 22 Feb 2013 16:11:25 +0000 Subject: [PATCH] cplay: support auto-configuration of fragment size and count 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 --- cplay.c | 14 ++++++++++---- 1 file 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); -- 2.47.3