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
This commit is contained in:
Pierre Ossman 2006-02-17 15:42:47 +00:00
parent 6f9a367abc
commit 45700da4eb
6 changed files with 98 additions and 11 deletions

View file

@ -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);