aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-17 13:09:29 +0100
committerMax Kellermann <max@duempel.org>2009-01-17 13:09:29 +0100
commitfd948571f884e6354883e2ecfc24bab799fc0805 (patch)
tree5433efa559ffcd87c30ebe97899cdeac262ff5a2 /src/pipe.h
parentd83eff80a51d7111f3df28dcc65fab9ebdf61632 (diff)
downloadmpd-fd948571f884e6354883e2ecfc24bab799fc0805.tar.gz
mpd-fd948571f884e6354883e2ecfc24bab799fc0805.tar.xz
mpd-fd948571f884e6354883e2ecfc24bab799fc0805.zip
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().
Diffstat (limited to '')
-rw-r--r--src/pipe.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pipe.h b/src/pipe.h
index 7d82c1693..526bedb26 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -148,6 +148,24 @@ music_pipe_peek(void)
}
/**
+ * 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.
*
* @return the number of bytes actually written