From fd948571f884e6354883e2ecfc24bab799fc0805 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 17 Jan 2009 13:09:29 +0100 Subject: music_pipe: added functions music_pipe_write() and music_pipe_expand() This new API gives the caller a writable buffer to the music pipe chunk. This may allow the caller to eliminate several buffer copies, because it may manipulate the returned buffer, until it calls music_pipe_expand(). --- src/pipe.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/pipe.h') diff --git a/src/pipe.h b/src/pipe.h index 7d82c1693..526bedb26 100644 --- a/src/pipe.h +++ b/src/pipe.h @@ -147,6 +147,24 @@ music_pipe_peek(void) return music_pipe_get_chunk(music_pipe.begin); } +/** + * Prepares appending to the music pipe. Returns a buffer where you + * may write into. After you are finished, call music_pipe_expand(). + * + * @return a writable buffer + */ +void * +music_pipe_write(const struct audio_format *audio_format, + float data_time, uint16_t bit_rate, + size_t *max_length_r); + +/** + * Tells the music pipe to move the end pointer, after you have + * written to the buffer returned by music_pipe_write(). + */ +void +music_pipe_expand(const struct audio_format *audio_format, size_t length); + /** * Append a data block to the buffer. * -- cgit v1.2.3