aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-06-07 10:50:05 -0700
committerEric Laurent <elaurent@google.com>2013-06-07 10:58:58 -0700
commit79c370788bfeac8e2951cc35844fb96f15f28159 (patch)
tree1f8c00d27822fd968717d5108bf4d75aae2fe6e6 /include
parentf0c407825741bcb94952e4264efce66dee378411 (diff)
downloadtinycompress-79c370788bfeac8e2951cc35844fb96f15f28159.tar.gz
Update to tinycompress 2.0
0f25782 Tinycompress version 0.2.0 6b27cf7 compress: Add non-blocking I/O 0e0c39e compress: do not poll if enough space to write remaining data 78672ce compress: copy final version of config struct 5777ab6 cplay: use get_alsa_rate to convert sample rate 1bb4a13 add utils file with rate conversion helper 38145d7 fix error reporting in tinycompress aad6a2a compress: fix hpointer error when no sample rate 31d610d compress: check for config first Change-Id: I51037eacdab73dfd4f3b8e58cda79f536503f826
Diffstat (limited to 'include')
-rw-r--r--include/tinycompress/tinycompress.h25
-rw-r--r--include/tinycompress/version.h4
2 files changed, 26 insertions, 3 deletions
diff --git a/include/tinycompress/tinycompress.h b/include/tinycompress/tinycompress.h
index 9867afc..40de69a 100644
--- a/include/tinycompress/tinycompress.h
+++ b/include/tinycompress/tinycompress.h
@@ -130,7 +130,15 @@ int compress_get_tstamp(struct compress *compress,
/*
* compress_write: write data to the compress stream
* return bytes written on success, negative on error
- * this is a blocking call
+ * By default this is a blocking call and will not return
+ * until all bytes have been written or there was a
+ * write error.
+ * If non-blocking mode has been enabled with compress_nonblock(),
+ * this function will write all bytes that can be written without
+ * blocking and will then return the number of bytes successfully
+ * written. If the return value is not an error and is < size
+ * the caller can use compress_wait() to block until the driver
+ * is ready for more data.
*
* @compress: compress stream to be written to
* @buf: pointer to data
@@ -141,6 +149,13 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size
/*
* compress_read: read data from the compress stream
* return bytes read on success, negative on error
+ * By default this is a blocking call and will block until
+ * size bytes have been written or there was a read error.
+ * If non-blocking mode was enabled using compress_nonblock()
+ * the behaviour will change to read only as many bytes as
+ * are currently available (if no bytes are available it
+ * will return immediately). The caller can then use
+ * compress_wait() to block until more bytes are available.
*
* @compress: compress stream from where data is to be read
* @buf: pointer to data buffer
@@ -242,6 +257,12 @@ bool is_codec_supported(unsigned int card, unsigned int device,
*/
void compress_set_max_poll_wait(struct compress *compress, int milliseconds);
+/* Enable or disable non-blocking mode for write and read */
+void compress_nonblock(struct compress *compress, int nonblock);
+
+/* Wait for ring buffer to ready for next read or write */
+int compress_wait(struct compress *compress, int timeout_ms);
+
int is_compress_running(struct compress *compress);
int is_compress_ready(struct compress *compress);
@@ -267,4 +288,6 @@ const char *compress_get_error(struct compress *compress);
#define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */
#define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */
+/* utility functions */
+unsigned int compress_get_alsa_rate(unsigned int rate);
#endif
diff --git a/include/tinycompress/version.h b/include/tinycompress/version.h
index 795fe77..000f6a2 100644
--- a/include/tinycompress/version.h
+++ b/include/tinycompress/version.h
@@ -55,7 +55,7 @@
#define TINYCOMPRESS_LIB_MAJOR 0 /* major number of library version */
-#define TINYCOMPRESS_LIB_MINOR 1 /* minor number of library version */
+#define TINYCOMPRESS_LIB_MINOR 2 /* minor number of library version */
#define TINYCOMPRESS_LIB_SUBMINOR 0 /* subminor number of library version */
/** library version */
@@ -65,6 +65,6 @@
TINYCOMPRESS_LIB_SUBMINOR)
/** library version (string) */
-#define TINYCOMPRESS_LIB_VERSION_STR "0.1.0"
+#define TINYCOMPRESS_LIB_VERSION_STR "0.2.0"
#endif