tinycompress.git
7 days agocplay: Always write whole buffer requested by user master
Daniel Baluta [Mon, 5 Nov 2018 14:02:43 +0000 (16:02 +0200)]
cplay: Always write whole buffer requested by user

cplay first writes frag * fragment_size and then
it only writes one fragment at a time.

This means for example than if the user supplied a buffer_size
it will only be used for the first write.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>

7 days agotinycompress: Fix missing '}' around extern C
Piotr Stankiewicz [Thu, 6 Dec 2018 10:04:27 +0000 (10:04 +0000)]
tinycompress: Fix missing '}' around extern C

Signed-off-by: Piotr Stankiewicz <piotrs@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>

4 weeks agotinycompress: Update headers to include AUDIOCODEC_BESPOKE
Charles Keepax [Thu, 8 Nov 2018 17:12:32 +0000 (17:12 +0000)]
tinycompress: Update headers to include AUDIOCODEC_BESPOKE

commit dbb6b94339e8 ("ALSA: compress: Add SND_AUDIOCODEC_BESPOKE") added
an additional CODEC type for bespoke CODECs. Update the local headers to
include this.

Reported-by: Andrew Ford <andrew.ford@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>

4 weeks agocplay: fix typo
Vinod Koul [Tue, 13 Nov 2018 14:54:07 +0000 (20:24 +0530)]
cplay: fix typo

Signed-off-by: Vinod Koul <vkoul@kernel.org>

4 weeks agoREADME: fix trailing spaces
Vinod Koul [Tue, 13 Nov 2018 14:07:10 +0000 (19:37 +0530)]
README: fix trailing spaces

Signed-off-by: Vinod Koul <vkoul@kernel.org>

4 weeks agoREADME: Update project github location
Vinod Koul [Tue, 13 Nov 2018 13:43:16 +0000 (19:13 +0530)]
README: Update project github location

alsa userspace is now moved to github, so update it in README

Signed-off-by: Vinod Koul <vkoul@kernel.org>

4 weeks agoREADME: update Vinod's email
Vinod Koul [Tue, 13 Nov 2018 13:38:16 +0000 (19:08 +0530)]
README: update Vinod's email

Update email address in README from old invalid id

Signed-off-by: Vinod Koul <vkoul@kernel.org>

8 weeks agoRelease v1.1.7 v1.1.7
Jaroslav Kysela [Tue, 16 Oct 2018 08:08:37 +0000 (10:08 +0200)]
Release v1.1.7

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

7 months agotinycompress: Update email address for Vinod
Vinod Koul [Thu, 26 Apr 2018 06:46:40 +0000 (12:16 +0530)]
tinycompress: Update email address for Vinod

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocrecord: fix incorrect print specifier warning
Vinod Koul [Thu, 19 Apr 2018 06:11:31 +0000 (11:41 +0530)]
crecord: fix incorrect print specifier warning

We get a warning in crecord for incorrect print specifier, fix it by using
right one %u for unsigned int

crecord.c:380:17: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘unsigned int’ [-Wformat=]
  fprintf(finfo, "Recording file %s On Card %u device %u, with buffer of %lu bytes\n",

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocplay: fix incorrect print specifier warning
Vinod Koul [Thu, 19 Apr 2018 06:11:31 +0000 (11:41 +0530)]
cplay: fix incorrect print specifier warning

We get a warning in cplay for incorrect print specifier, fix it by using
right one %ld for long unsigned int.

cplay.c:327:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
   fprintf(stderr, "codec ID %d is not supported\n", codec_id);

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocplay: remove dead code check_codec_format_supported()
Vinod Koul [Thu, 19 Apr 2018 06:11:31 +0000 (11:41 +0530)]
cplay: remove dead code check_codec_format_supported()

The check_codec_format_supported() was added but never used so remove
it and eliminate unused function warning

cplay.c:103:20: warning: ‘codec_name_from_id’ defined but not used [-Wunused-function]

We can take from git if user appears

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocplay: remove dead code codec_name_from_id()
Vinod Koul [Thu, 19 Apr 2018 06:11:31 +0000 (11:41 +0530)]
cplay: remove dead code codec_name_from_id()

The codec_name_from_id() was added but never used so remove it and
eliminate unused function warning

cplay.c:103:20: warning: ‘codec_name_from_id’ defined but not used [-Wunused-function]

We can take from git if user appears

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocompress: remove dead code _is_codec_supported()
Vinod Koul [Thu, 19 Apr 2018 06:11:31 +0000 (11:41 +0530)]
compress: remove dead code _is_codec_supported()

The _is_codec_supported() was dead and none using it, so remove this and
eliminate unused function warning

compress.c:145:13: warning: ‘_is_codec_supported’ defined but not used [-Wunused-function]

We can take from git if user appears

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

7 months agocrecord: Use whole buffer requested by user
Charles Keepax [Fri, 13 Apr 2018 11:58:59 +0000 (12:58 +0100)]
crecord: Use whole buffer requested by user

Currently, crecord will only actually use 1 fragment worth of its
internal buffer no matter what the user requests. Correct this so that
the whole buffer requested by the user is used for copying data.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

8 months agoRelease v1.1.6 v1.1.6
Jaroslav Kysela [Tue, 3 Apr 2018 07:01:39 +0000 (09:01 +0200)]
Release v1.1.6

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

10 months agocplay: make get_codec_iec return void
Vinod Koul [Fri, 2 Feb 2018 17:34:46 +0000 (23:04 +0530)]
cplay: make get_codec_iec return void

get_codec_iec() doesn't return anything, so make return type as void

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

10 months agocplay: support IEC61937 format
Katsuhiro Suzuki [Fri, 2 Feb 2018 04:32:46 +0000 (13:32 +0900)]
cplay: support IEC61937 format

This patch adds very simple supports for IEC61937 S/PDIF format.

The cplay just specifies the format ID and sends audio data to ALSA.
There is no check the audio data is valid or invalid as IEC61937
specifications.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

10 months agocplay: move around MP3 header parsing method
Katsuhiro Suzuki [Fri, 2 Feb 2018 04:32:45 +0000 (13:32 +0900)]
cplay: move around MP3 header parsing method

This patch moves MP3 parsing method for -I option, this is for
adding other codec ID in the future.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

10 months agocplay: add option to specify codec ID
Katsuhiro Suzuki [Fri, 2 Feb 2018 04:32:44 +0000 (13:32 +0900)]
cplay: add option to specify codec ID

This patch adds a -I command line option to set the codec ID,
same as crecord.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

10 months agocplay: fix size and nmemb of mp3 header of fread
Katsuhiro Suzuki [Tue, 23 Jan 2018 02:33:11 +0000 (11:33 +0900)]
cplay: fix size and nmemb of mp3 header of fread

This patch swaps 'size' and 'nmemb' arguments of fread.
The fread returns always 1 (because 'nmemb' is 1) so checking
the return value is always failure.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

13 months agoRelease v1.1.5 v1.1.5
Jaroslav Kysela [Tue, 14 Nov 2017 07:52:11 +0000 (08:52 +0100)]
Release v1.1.5

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

13 months agotinycompress: clarify dual-license wording
Pierre-Louis Bossart [Wed, 18 Oct 2017 18:11:25 +0000 (13:11 -0500)]
tinycompress: clarify dual-license wording

There were reports of confusion in legal circles introduced by the wording
"tinycompress is provided under LGPL and BSD dual license" in the README.

Clarify with the addition of the wording traditionally used for dual licenses:

"This file is provided under a dual BSD/LGPLv2.1 license.  When using or
redistributing this file, you may do so under either license"

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

19 months agoRelease v1.1.4 v1.1.4
Jaroslav Kysela [Fri, 12 May 2017 08:01:46 +0000 (10:01 +0200)]
Release v1.1.4

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

22 months agocrecord: Add option to specify codec ID
Richard Fitzgerald [Wed, 18 Jan 2017 16:29:54 +0000 (16:29 +0000)]
crecord: Add option to specify codec ID

This patch adds a -I command line option to set the codec ID,
either from a defined set of string values or as a number.

After discussion with Vinod it was agreed that we should only
allow writing to a file if we support creating the correct container
file format for that data. As we currently only have support for
creating WAV files only PCM data can be written to a file. Other
formats can be sent raw to stdout.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

22 months agocrecord: Fix some minor coding style problems
Richard Fitzgerald [Wed, 18 Jan 2017 16:29:53 +0000 (16:29 +0000)]
crecord: Fix some minor coding style problems

- Incorrect indenting of arguments to capture_samples()
- Wrap long line in capture_samples()
- Added a blank line in main() for readability
- Deleted extra trailing blank line at end of file

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

23 months agoRelease v1.1.3 v1.1.3
Jaroslav Kysela [Tue, 20 Dec 2016 09:12:30 +0000 (10:12 +0100)]
Release v1.1.3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

23 months agotinycompress: rename crec usages
Vinod Koul [Fri, 16 Dec 2016 07:36:51 +0000 (13:06 +0530)]
tinycompress: rename crec usages

The creord utility help listed crec as the utility name, change that to
crecord and also update the program explanation text.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

23 months agotinycompress: rename crec.c
Vinod Koul [Fri, 16 Dec 2016 07:24:02 +0000 (12:54 +0530)]
tinycompress: rename crec.c

Since the compress recorder utility is called crecord, it makes it apt to
have src file named crecord.c.

Reported-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

2 years agoRelease v1.1.1 v1.1.1
Jaroslav Kysela [Thu, 31 Mar 2016 13:12:42 +0000 (15:12 +0200)]
Release v1.1.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

2 years agotinycompress: INSTALL: Update the instructions
Vinod Koul [Thu, 10 Mar 2016 08:10:19 +0000 (13:40 +0530)]
tinycompress: INSTALL: Update the instructions

Reported-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

2 years agotinycompress: crec: make functions static
Vinod Koul [Sat, 9 Jan 2016 08:12:46 +0000 (13:42 +0530)]
tinycompress: crec: make functions static

Sparse rightly complains some functions should be static so make them static

crec.c:113:26: warning: symbol 'blank_wave_header' was not declared. Should it be static?
crec.c:239:6: warning: symbol 'capture_samples' was not declared. Should it be static?

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

2 years agotinycompress: crec: fix function declaration
Vinod Koul [Sat, 9 Jan 2016 08:12:46 +0000 (13:42 +0530)]
tinycompress: crec: fix function declaration

finish_record was not following ANSI standard for declaration as warned by
sparse

crec.c:193:26: warning: non-ANSI function declaration of function 'finish_record'

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

2 years agotinycompress: cplay: make functions static
Vinod Koul [Sat, 9 Jan 2016 08:12:46 +0000 (13:42 +0530)]
tinycompress: cplay: make functions static

Sparse rightly complains some functions should be static so make them static

cplay.c:100:5: warning: symbol 'parse_mp3_header' was not declared. Should it be static?
cplay.c:129:5: warning: symbol 'check_codec_format_supported' was not declared. Should it be static?
../../include/tinycompress/tinymp3.h:66:11: warning: symbol 'mp3_sample_rates' was not declared. Should it be static?
../../include/tinycompress/tinymp3.h:72:11: warning: symbol 'mp3_bit_rates' was not declared. Should it be static?

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agocrec: Always read whole number of fragments when length limit specified
Richard Fitzgerald [Thu, 3 Dec 2015 11:25:35 +0000 (11:25 +0000)]
crec: Always read whole number of fragments when length limit specified

This patch removes the lines that adjusted the read size to exactly
read to the end of the calculated length in bytes. Doing this could
lead to invalid fragment sizes being requested which may then cause
a read error on some codecs.

Instead we keep reading whole fragments until we have >= length bytes
of data captured.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoRelease v1.1.0 v1.1.0
Jaroslav Kysela [Tue, 27 Oct 2015 13:34:07 +0000 (14:34 +0100)]
Release v1.1.0

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

3 years agoadd gitcompile
Jaroslav Kysela [Tue, 27 Oct 2015 11:02:09 +0000 (12:02 +0100)]
add gitcompile

3 years agobuild: Fix make distcheck
Arun Raghavan [Thu, 8 Oct 2015 10:41:28 +0000 (11:41 +0100)]
build: Fix make distcheck

srcdir may not be the same as builddir, so use the correct variable for
the include path.

Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agocplay: check the values of fread
Vinod Koul [Fri, 8 May 2015 10:30:02 +0000 (16:00 +0530)]
cplay: check the values of fread

This fixes the following warning:
cplay.c: In function ‘play_samples’:
cplay.c:219:7: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
  fread(&header, sizeof(header), 1, file);

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoAuthors: add information about how to find authors
Vinod Koul [Fri, 8 May 2015 10:23:06 +0000 (15:53 +0530)]
Authors: add information about how to find authors

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoChangelog: update to git log
Vinod Koul [Fri, 8 May 2015 10:19:05 +0000 (15:49 +0530)]
Changelog: update to git log

we dont use changelog file as git is a very good log of what we are
changing, so point to git log

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoautotool: update the INSTALL file
Vinod Koul [Fri, 8 May 2015 10:18:06 +0000 (15:48 +0530)]
autotool: update the INSTALL file

toolchains are updating the INSTALL file so take the updated changes

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agotinycompress.h: explicitly include required headers
Qais Yousef [Tue, 5 May 2015 10:21:11 +0000 (11:21 +0100)]
tinycompress.h: explicitly include required headers

tinycompress.h was relying on other files to include linux/types.h and stdbool.h
which are required by it. Explicitly include it to fix compile errors when external
program tries to include this header.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agosrc/lib/utils.c: remove this empty file
Qais Yousef [Tue, 5 May 2015 10:21:10 +0000 (11:21 +0100)]
src/lib/utils.c: remove this empty file

utils.c isn't implementing anything so delete it

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agocompress.c: fix check for errors from poll(), read() and write()
Qais Yousef [Tue, 5 May 2015 10:21:09 +0000 (11:21 +0100)]
compress.c: fix check for errors from poll(), read() and write()

When these functions fail they return -1 and set errno. Fix error checks
accordingly.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoAndroid.mk: Update to use the new location of source files
Qais Yousef [Tue, 5 May 2015 10:21:08 +0000 (11:21 +0100)]
Android.mk: Update to use the new location of source files

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agomakefile.linux: delete as no longer necessary/used
Qais Yousef [Tue, 5 May 2015 10:21:07 +0000 (11:21 +0100)]
makefile.linux: delete as no longer necessary/used

Now autotools takes care of generating Makefiles.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoadd .gitignore file
Qais Yousef [Tue, 5 May 2015 10:21:06 +0000 (11:21 +0100)]
add .gitignore file

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agoConvert the build system to autotools
Qais Yousef [Tue, 5 May 2015 10:21:05 +0000 (11:21 +0100)]
Convert the build system to autotools

Hopefully this should make tinycompress a more robust package.
This change splits the source into utils and lib.
No functional changes was introduced.

use autogen.sh to generate configure then run ./configure as with other
packages.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agocrec: support streaming output to stdout
Ammar Zahid Ali Syed [Thu, 19 Feb 2015 14:55:40 +0000 (14:55 +0000)]
crec: support streaming output to stdout

It's useful for testing to be able to stream the captured
audio to stdout instead of having to go via a file.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Ammar Ali <aali@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

3 years agomakefile.linux: allow env to override CROSS_COMPILE and CC
Qais Yousef [Tue, 20 Jan 2015 15:34:37 +0000 (15:34 +0000)]
makefile.linux: allow env to override CROSS_COMPILE and CC

allow env variables to override them without having to modify the makefile.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agocrec: Fix error with opening file using O_CREAT
Ammar Zahid Ali Syed [Mon, 18 Aug 2014 08:41:58 +0000 (09:41 +0100)]
crec: Fix error with opening file using O_CREAT

The code was not compiling when mode was not passed to open()
while using O_CREAT offset. Passed mode to the open() alongwith
O_CREAT to specify the attributes of file and fix compile issue.

Signed-off-by: Ammar Zahid Ali Syed <ammar.zhd@googlemail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agotinycompress: update headers for packed, aligned
Vinod Koul [Thu, 19 Jun 2014 09:33:17 +0000 (15:03 +0530)]
tinycompress: update headers for packed, aligned

commit "6b24a8dd: ALSA: compress: fix the struct alignment to 4 bytes" updated
compress struct to force packed and aligned to 4 bytes. Update here a s well

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agotinycompress: update compress headers for sample rate field
Vinod Koul [Thu, 19 Jun 2014 09:27:59 +0000 (14:57 +0530)]
tinycompress: update compress headers for sample rate field

commit "929559b: ALSA: compress: add num_sample_rates in snd_codec_desc" adds
array for passing sample rate instead of bit map. Update the local header as
well

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agocompress: use int for samples in compress_get_tstamp
Vinod Koul [Mon, 17 Feb 2014 17:25:24 +0000 (22:55 +0530)]
compress: use int for samples in compress_get_tstamp

in 64bit updates we made the sample rate as 32bit explicitly, so update the
library API as well

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agocrec: Add primitive exception handling
Charles Keepax [Fri, 24 Jan 2014 11:37:35 +0000 (11:37 +0000)]
crec: Add primitive exception handling

Add very primitive signal handling, we will not attempt to drain any
remaining data etc. simply save out what we have to a file.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agocrec: Initial version of a compressed capture utility
Charles Keepax [Fri, 24 Jan 2014 11:37:34 +0000 (11:37 +0000)]
crec: Initial version of a compressed capture utility

This version only supports capture of PCM streams over a compressed
device and saves these as WAV files.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agotinycompress: remove usage of SNDRV_RATE_xxx
Vinod Koul [Mon, 16 Dec 2013 15:07:24 +0000 (20:37 +0530)]
tinycompress: remove usage of SNDRV_RATE_xxx

as now it is not to be used for passing the sampling rate

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agotinycompress: cplay: use the numeric sample rate
Vinod Koul [Mon, 16 Dec 2013 15:03:03 +0000 (20:33 +0530)]
tinycompress: cplay: use the numeric sample rate

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

4 years agotinycompress: update the header to kernel API v0.1.2
Vinod Koul [Mon, 16 Dec 2013 14:57:26 +0000 (20:27 +0530)]
tinycompress: update the header to kernel API v0.1.2

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: compress_wait() must return error if timed out
Richard Fitzgerald [Tue, 22 Oct 2013 10:51:58 +0000 (11:51 +0100)]
compress: compress_wait() must return error if timed out

The caller must be certain that a return of 0 really means
that compress is ready for more data, so when poll() returns
0 for a timeout we must report that as an error.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Must check for POLLERR before POLLOUT/POLLIN
Richard Fitzgerald [Thu, 29 Aug 2013 08:32:02 +0000 (09:32 +0100)]
compress: Must check for POLLERR before POLLOUT/POLLIN

In the case of error the ALSA compressed driver sets revents as
(POLLOUT | POLLWRNORM | POLLERR) or (POLLIN | POLLWRNORM | POLLERR).
So we can't assume that POLLOUT or POLLIN indicate success, we must
check for POLLERR first.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agofix error returned by compress_wait()
Eric Laurent [Wed, 24 Jul 2013 17:37:16 +0000 (10:37 -0700)]
fix error returned by compress_wait()

oops() expects positive error codes.

Signed-off-by: Eric Laurent <elaurent@google.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: fix the typo in compress_get_alsa_rate()
Vinod Koul [Sat, 20 Jul 2013 06:30:38 +0000 (12:00 +0530)]
compress: fix the typo in compress_get_alsa_rate()

Reported-by: Ravi <ralama@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agoTinycompress version 0.2.0 v0.2.0
Vinod Koul [Fri, 7 Jun 2013 15:13:55 +0000 (20:43 +0530)]
Tinycompress version 0.2.0

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Add non-blocking I/O
Richard Fitzgerald [Wed, 5 Jun 2013 12:31:00 +0000 (13:31 +0100)]
compress: Add non-blocking I/O

Support for non-blocking I/O, based on API of main alsalib.
In non-blocking mode a compress_write() will return without
blocking after it has written all bytes that will fit in the
buffer and compress_read() will return after it has read all
bytes available from the buffer. Use compress_wait() to wait
for free write space or available read bytes.

Non-blocking mode is enabled and disabled using compress_nonblock().

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: do not poll if enough space to write remaining data
Richard Fitzgerald [Wed, 5 Jun 2013 12:11:44 +0000 (13:11 +0100)]
compress: do not poll if enough space to write remaining data

Changes the poll logic in compress_write() to prevent
it polling if there is enough available space to write
all remaining data. Previously the logic always polled for
an entire fragment to become available before starting the
first write.

This change allows short writes of < frag_size, which is likely
at the end of a stream.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: copy final version of config struct
Richard Fitzgerald [Wed, 5 Jun 2013 12:10:41 +0000 (13:10 +0100)]
compress: copy final version of config struct

compress_open() should delay taking a copy of the
config struct until we've finished modifying it.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocplay: use get_alsa_rate to convert sample rate
Vinod Koul [Thu, 23 May 2013 08:09:12 +0000 (13:39 +0530)]
cplay: use get_alsa_rate to convert sample rate

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agoadd utils file with rate conversion helper
Vinod Koul [Thu, 23 May 2013 08:08:29 +0000 (13:38 +0530)]
add utils file with rate conversion helper

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agofix error reporting in tinycompress
Lakshmi N Vinnakota [Thu, 23 May 2013 07:37:57 +0000 (13:07 +0530)]
fix error reporting in tinycompress

The compress API are expected to return a negative value on an error
with errno indicating the type of error. But in some cases, this is
not happening.

The fix is the oops function always returns -1 and the actual
error number is determined by the global variable errno.

Signed-off-by: Lakshmi N Vinnakota <lakshmi.n.vinnakota@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: fix hpointer error when no sample rate
Richard Fitzgerald [Thu, 2 May 2013 13:58:53 +0000 (14:58 +0100)]
compress: fix hpointer error when no sample rate

Fixes the oops() in compress_get_hpointer() to return
-ENODATA instead of errno if the sample rate is zero.
The value in errno here is not related to the reason
we are returning an error.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: check for config first
Vinod Koul [Fri, 26 Apr 2013 16:50:00 +0000 (22:20 +0530)]
compress: check for config first

if invalid config is passed, then we return error for memory

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Add support for capture streams
Richard Fitzgerald [Fri, 26 Apr 2013 15:14:22 +0000 (16:14 +0100)]
compress: Add support for capture streams

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agotinycompress: cplay: Correct a couple of small message typos
Richard Fitzgerald [Mon, 15 Apr 2013 16:39:39 +0000 (17:39 +0100)]
tinycompress: cplay: Correct a couple of small message typos

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agotinycompress: version 0.1.0 v0.1.0
Vinod Koul [Sun, 24 Feb 2013 14:22:21 +0000 (19:52 +0530)]
tinycompress: version 0.1.0

First version release of tinycompress library

dc06a66 tinycompress: version 0.1.0
10fef72 tinycompres: remove unused variable
e0810c0 tinycompress: add gapless meta data APIs
8f18a69 cplay: support auto-configuration of fragment size and count
495e5b4 compress: Add makefile for building under standard linux
d815993 compress: Add missing header includes
bb2650a compress: Block if unable to write all data in single write()
acc0960 compress: Allow client to pass "don't care" for fragment size/number
e24adce compress: Handle case of pause() during compress_write()
83f0278 compress: Remove hardcoded limit on length of poll() wait
f9f3d07 compress: Fix incorrect error message on compress_resume()
14af3b0 compress: Change running from bitfield to plain int
eb63cc9 compress: Remove unused buffer_size member from struct compress
21663cc compress: Change compress_write() to take buffer as const void *
0d20d8b compress: Add function to get timestamp in samples
0931870 compress: fix arithmetic exception in compress_get_hpointer
00732dc compress: cache the config values passed
2a455ef compress: remove unused variables
7191a18 compress: make variable 'running' as unsigned
dca2963 compress: Do not put newlines on error messages
24a91e3 compress: Return error messages correctly from compress_open
590afad compress: Return error when failing to allocate compress struct
30b28ff compress: Extend limit on error messages
bbb37bb compress: add compress_resume
cf2e8d4 compress: write when we have a fragment to write
5d5a573 compress: fix the timestamp calculation
55b29e9 initial creation

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agotinycompres: remove unused variable
Vinod Koul [Fri, 22 Feb 2013 08:45:56 +0000 (14:15 +0530)]
tinycompres: remove unused variable

cplay.c:210: warning: unused variable i

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agotinycompress: add gapless meta data APIs
Vinod Koul [Fri, 22 Feb 2013 09:49:02 +0000 (15:19 +0530)]
tinycompress: add gapless meta data APIs

Based on newly introduced kernel API, we add gapless metatdata to the library.
Since kernel can recieve only key/value pairs for metadata we add a structure for
gapless_metdata and handle this in library

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocplay: support auto-configuration of fragment size and count
Richard Fitzgerald [Fri, 22 Feb 2013 16:11:25 +0000 (16:11 +0000)]
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 <vinod.koul@intel.com>

5 years agocompress: Add makefile for building under standard linux
Richard Fitzgerald [Fri, 22 Feb 2013 16:09:07 +0000 (16:09 +0000)]
compress: Add makefile for building under standard linux

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Add missing header includes
Richard Fitzgerald [Fri, 22 Feb 2013 16:08:01 +0000 (16:08 +0000)]
compress: Add missing header includes

This fixes build problems caused by dependencies that were
not explicitly included.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Block if unable to write all data in single write()
Richard Fitzgerald [Fri, 22 Feb 2013 16:06:48 +0000 (16:06 +0000)]
compress: Block if unable to write all data in single write()

Previously compress_write() would only block on poll() if the
available space < fragment_size. If the device has a small fragment
size this could lead to it never blocking and instead looping around
doing many small writes. This is bad for power saving.

If we were unable to write all the remaining data in a single write
we want to block until the device reaches a buffer high water mark,
to allow the CPU to sleep.

This change will always attempt to issue the first write providing
avail >= fragment_size. All subsequent loops will block on poll()
before attempting another write() unless there is enough buffer space
to write all remaining data.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Allow client to pass "don't care" for fragment size/number
Richard Fitzgerald [Fri, 22 Feb 2013 16:05:32 +0000 (16:05 +0000)]
compress: Allow client to pass "don't care" for fragment size/number

Client cannot know what is a sensible fragment size and count
for the device unless it has prior knowledge of the precise
hardware. To allow for generic clients not hardcoded for particular
hardware, this change allows fragment_size and fragments to be
passed as 0, meaning "don't care" and tinycompress will choose
default values read from the driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Handle case of pause() during compress_write()
Richard Fitzgerald [Fri, 22 Feb 2013 16:04:22 +0000 (16:04 +0000)]
compress: Handle case of pause() during compress_write()

If stream is paused() during a compress_write() the poll()
will return 0 or -EBADFD, or the write() will return -EBADFD.
This is not an error so compress_write() should not pass an
error code to the caller. It should abort the write and then
return the number of bytes it had written up to that point.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Remove hardcoded limit on length of poll() wait
Richard Fitzgerald [Fri, 22 Feb 2013 16:03:25 +0000 (16:03 +0000)]
compress: Remove hardcoded limit on length of poll() wait

For best power-saving we want to sleep on poll() for as long as
possible, we don't want to wake unnecessarily for arbitrary time
limits. Adds function compress_set_max_poll_wait() so that
client can configure the poll() timeout.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Fix incorrect error message on compress_resume()
Richard Fitzgerald [Fri, 22 Feb 2013 16:02:17 +0000 (16:02 +0000)]
compress: Fix incorrect error message on compress_resume()

Was reporting compress_resume() errors as "cannot pause"

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Change running from bitfield to plain int
Richard Fitzgerald [Fri, 22 Feb 2013 15:59:54 +0000 (15:59 +0000)]
compress: Change running from bitfield to plain int

Declaring running as a single-bit bitfield does not save any space
or give any coding advantages, but does leave potential opportunities
for the compiler to be inefficient in how it handles bitfields compared
to how it would handle a machine int.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Remove unused buffer_size member from struct compress
Richard Fitzgerald [Fri, 22 Feb 2013 15:58:32 +0000 (15:58 +0000)]
compress: Remove unused buffer_size member from struct compress

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Change compress_write() to take buffer as const void *
Richard Fitzgerald [Fri, 22 Feb 2013 15:57:35 +0000 (15:57 +0000)]
compress: Change compress_write() to take buffer as const void *

The input buffer to compress_write() should be const, and is
better defined as void * so the caller doesn't have to cast.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Add function to get timestamp in samples
Richard Fitzgerald [Fri, 22 Feb 2013 15:56:18 +0000 (15:56 +0000)]
compress: Add function to get timestamp in samples

The compress_get_hpointer() converts the timestamp into actual
time. But Android needs it in samples. To avoid the inefficiency
of using compress_get_hpointer() and converting into time and then
back into samples, this change adds compress_get_tstamp() which
returns the raw sample count.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: fix arithmetic exception in compress_get_hpointer
Xuemin Su [Tue, 30 Oct 2012 05:09:00 +0000 (13:09 +0800)]
compress: fix arithmetic exception in compress_get_hpointer

In compress_get_hpointer, check for invalid sample
rate to prevent devide-by-zero exceptions

Signed-off-by: Xuemin Su <xuemin.su@intel.com>
Signed-off-by: He Bo <bo.he@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: cache the config values passed
Vinod Koul [Mon, 18 Feb 2013 13:41:43 +0000 (19:11 +0530)]
compress: cache the config values passed

The library should not rely on users pointer for config data, so cache it for
use afterwards

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: remove unused variables
Vinod Koul [Mon, 18 Feb 2013 11:13:03 +0000 (16:43 +0530)]
compress: remove unused variables

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: make variable 'running' as unsigned
Vinod Koul [Mon, 18 Feb 2013 11:09:04 +0000 (16:39 +0530)]
compress: make variable 'running' as unsigned

as we never expect this to be negative

Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Do not put newlines on error messages
Charles Keepax [Fri, 25 Jan 2013 10:43:14 +0000 (10:43 +0000)]
compress: Do not put newlines on error messages

In the oops function text is appended onto the end of the supplied error
message, so newlines appear in the middle of error messages. This patch
removes all newlines from supplied error messages.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Return error messages correctly from compress_open
Charles Keepax [Fri, 25 Jan 2013 10:43:13 +0000 (10:43 +0000)]
compress: Return error messages correctly from compress_open

The allocated compress object will be freed and bad_compress will be
returned, so error messages written to the allocated compress struct
will be lost. This patch writes error messages to bad_compress for error
paths in compress_open, ensuring that error messages are returned
correctly.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Return error when failing to allocate compress struct
Charles Keepax [Fri, 25 Jan 2013 10:43:12 +0000 (10:43 +0000)]
compress: Return error when failing to allocate compress struct

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

5 years agocompress: Extend limit on error messages
Charles Keepax [Fri, 25 Jan 2013 10:43:11 +0000 (10:43 +0000)]
compress: Extend limit on error messages

32 characters is a very short size for the error message, extend this
to 128 characters to prevent clipping on the majority of messages.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

6 years agocompress: add compress_resume
Namarta Kohli [Tue, 12 Jun 2012 17:15:32 +0000 (22:45 +0530)]
compress: add compress_resume

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>

6 years agocompress: write when we have a fragment to write
Vinod Koul [Tue, 12 Jun 2012 17:14:33 +0000 (22:44 +0530)]
compress: write when we have a fragment to write

this needs fix when we do the drain, while draining we should write anyway
whatever we have

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>