]> git.alsa-project.org Git - tinycompress.git/log
tinycompress.git
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
13 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>
13 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>
13 years agocompress: fix the timestamp calculation
Vinod Koul [Tue, 12 Jun 2012 17:12:17 +0000 (22:42 +0530)]
compress: fix the timestamp calculation

use u64 for extended range and also ensure that seconds and nano seconds are
claculated seprately

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
13 years agoinitial creation
Vinod Koul [Thu, 15 Mar 2012 10:50:30 +0000 (16:20 +0530)]
initial creation

Add the initial files of tinycompress and utility player cplay

Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
13 years agoInitial test commit...
Jaroslav Kysela [Mon, 5 Mar 2012 09:17:58 +0000 (10:17 +0100)]
Initial test commit...