diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-05-14 17:07:21 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-05-14 17:07:21 +0000 |
commit | a68ee34ebfbbc6e6bc653aadc284264e10694930 (patch) | |
tree | f092f59607e6bb2e543cd9ec28619fd4f60cf3e5 /bufferq.h | |
parent | c7940f68a29e90b5cdc7368ec62ffeaeeca8208e (diff) |
add bufferq structure
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@17 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'bufferq.h')
-rw-r--r-- | bufferq.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bufferq.h b/bufferq.h new file mode 100644 index 0000000..da4eac3 --- /dev/null +++ b/bufferq.h @@ -0,0 +1,35 @@ +#ifndef foosydneybufferqhfoo +#define foosydneybufferqhfoo + +#include <inttypes.h> + +#include "macro.h" +#include "llist.h" +#include "sydney.h" + +typedef struct bufferq_item { + int64_t idx; + size_t size; + SA_LLIST_ITEM(struct bufferq_item, bufferq); +} bufferq_item_t; + +#define BUFFERQ_ITEM_DATA(x) ((void*) (uint8_t*) (x) + ALIGN(sizeof(bufferq_item_t))) + +typedef struct bufferq { + SA_LLIST_HEAD(bufferq_item_t, *items); + bufferq_item_t **last; + int64_t read_index, write_index, end_index; + size_t sample_size; + unsigned nchannels; +} bufferq_t; + +int bufferq_init(bufferq_t *q, unsigned nchannels, size_t sample_size); + +void bufferq_done(bufferq_t *q); + +int bufferq_push(bufferq_t *q, unsigned channel, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence); + +int bufferq_get(bufferq_t *q, void *i[], size_t *bytes); +int bufferq_drop(bufferq_t *q, int64_t bytes); + +#endif |