diff options
author | Pierre Ossman <ossman@cendio.se> | 2006-02-17 15:42:47 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2006-02-17 15:42:47 +0000 |
commit | 45700da4ebf2986126d7a4d6889c028599fd3085 (patch) | |
tree | 8929a905c9e837eb2b5651df2df65e9e90243ba6 /src/polyp/stream.h | |
parent | 6f9a367abc8d8949e980d30645420fb31f8eb6af (diff) |
Have a memblock queue on the client side during recording. This makes the
record callback optional in stead of mandatory.
For applications that wish to retain the old behaviour, simply call
pa_stream_peek() followed by pa_stream_drop() in the callback.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@507 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/polyp/stream.h')
-rw-r--r-- | src/polyp/stream.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/polyp/stream.h b/src/polyp/stream.h index e20cfdd4..9bbda436 100644 --- a/src/polyp/stream.h +++ b/src/polyp/stream.h @@ -106,9 +106,25 @@ void pa_stream_write(pa_stream *p /**< The stream to use */, value is ignored on upload streams. */); +/** Read the next fragment from the buffer (for capture sources). + * data will point to the actual data and length will contain the size + * of the data in bytes (which can be less than a complete framgnet). + * Use pa_stream_drop() to actually remove the data from the buffer. + * \since 0.8 */ +void pa_stream_peek(pa_stream *p /**< The stream to use */, + void **data /**< Pointer to pointer that will point to data */, + size_t *length /**< The length of the data read */); + +/** Remove the current fragment. It is invalid to do this without first + * calling pa_stream_peek(). \since 0.8 */ +void pa_stream_drop(pa_stream *p); + /** Return the amount of bytes that may be written using pa_stream_write() */ size_t pa_stream_writable_size(pa_stream *p); +/** Return the ammount of bytes that may be read using pa_stream_read() \since 0.8 */ +size_t pa_stream_readable_size(pa_stream *p); + /** Drain a playback stream */ pa_operation* pa_stream_drain(pa_stream *s, void (*cb) (pa_stream*s, int success, void *userdata), void *userdata); @@ -122,8 +138,10 @@ void pa_stream_set_state_callback(pa_stream *s, void (*cb)(pa_stream *s, void *u * written to the stream. */ void pa_stream_set_write_callback(pa_stream *p, void (*cb)(pa_stream *p, size_t length, void *userdata), void *userdata); -/** Set the callback function that is called when new data is available from the stream */ -void pa_stream_set_read_callback(pa_stream *p, void (*cb)(pa_stream *p, const void*data, size_t length, void *userdata), void *userdata); +/** Set the callback function that is called when new data is available from the stream. + * Return the number of bytes read. \since 0.8 + */ +void pa_stream_set_read_callback(pa_stream *p, void (*cb)(pa_stream *p, size_t length, void *userdata), void *userdata); /** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. \since 0.3 */ pa_operation* pa_stream_cork(pa_stream *s, int b, void (*cb) (pa_stream*s, int success, void *userdata), void *userdata); |