[alsa-devel] [PATCH TINYCOMPRESS 14/14] 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: 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);
On Sun, Feb 10, 2013 at 12:23:40AM +0000, Richard Fitzgerald wrote:
I tried applying rest, but looks like patches you have generated against is older one. Can you rebase all your patches on the tip and resend for those I didnt comment first.
Also would nice to use cover letter while sending a series, --cover-letter option is your friend
-- ~Vinod
looks like patches you have generated against is older one.
Yes this is true, which is how it should be. These patches and the ones from Charles Keepax are a single development line, and Charles's patches were based on top of this sequence. What's happened is that the patches from Charles have been upstreamed and applied out-of-order. These 14 should be applied, and then the set from Charles.
On Mon, Feb 11, 2013 at 09:58:45AM +0000, Richard Fitzgerald wrote:
looks like patches you have generated against is older one.
Yes this is true, which is how it should be. These patches and the ones from Charles Keepax are a single development line, and Charles's patches were based on top of this sequence. What's happened is that the patches from Charles have been upstreamed and applied out-of-order. These 14 should be applied, and then the set from Charles.
That is not how it works. Since Charles sent his patches first I applied those. Now these will _need_ to based on tip of the tree you are targetting not on some older rev.
If you have internal dependecies you should have internally sorted that out!
Now pls rebase these
-- ~Vinod
looks like patches you have generated against is older one.
This is the git log of our development repository:
cplay: support auto-configuration of fragment size and count <Richard Fitzgerald> compress: Prevent divide-by-zero faults in get_hpointer() <Richard Fitzgerald> compress: Do not put newlines on error messages <Charles Keepax> compress: Return error messages correctly from compress_open <Charles Keepax> compress: Return error when failing to allocate compress struct <Charles Keepax> compress: Extend limit on error messages <Charles Keepax> Add makefile for building under standard linux <Richard Fitzgerald> Add missing header includes <Richard Fitzgerald> Block if unable to write all data in single write() <Richard Fitzgerald> Allow client to pass "don't care" for fragment size/number <Richard Fitzgerald> Handle case of pause() during compress_write() <Richard Fitzgerald> Remove hardcoded limit on length of poll() wait <Richard Fitzgerald> Fix incorrect error message on compress_resume() <Richard Fitzgerald> Take local copy of compr_config structure <Richard Fitzgerald> Change running from bitfield to plain int <Richard Fitzgerald> Remove unused buffer_size member from struct compress <Richard Fitzgerald> Change compress_write() to take buffer as const void * <Richard Fitzgerald> Add function to get timestamp in samples <Richard Fitzgerald> compress: add compress_resume <Namarta Kohli> compress: write when we have a fragment to write <Vinod Koul> compress: fix the timestamp calculation <Vinod Koul> initial creation <Vinod Koul> Initial test commit... <Jaroslav Kysela>
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);
participants (2)
-
Richard Fitzgerald
-
Vinod Koul