diff options
Diffstat (limited to 'src/DecoderBuffer.hxx')
-rw-r--r-- | src/DecoderBuffer.hxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/DecoderBuffer.hxx b/src/DecoderBuffer.hxx index 92cc31aa4..f298d4429 100644 --- a/src/DecoderBuffer.hxx +++ b/src/DecoderBuffer.hxx @@ -20,6 +20,8 @@ #ifndef MPD_DECODER_BUFFER_HXX #define MPD_DECODER_BUFFER_HXX +#include "Compiler.h" + #include <stddef.h> /** @@ -32,6 +34,8 @@ struct DecoderBuffer; struct Decoder; struct InputStream; +template<typename T> struct ConstBuffer; + /** * Creates a new buffer. * @@ -50,12 +54,17 @@ decoder_buffer_new(Decoder *decoder, InputStream &is, void decoder_buffer_free(DecoderBuffer *buffer); +gcc_pure bool decoder_buffer_is_empty(const DecoderBuffer *buffer); +gcc_pure bool decoder_buffer_is_full(const DecoderBuffer *buffer); +void +decoder_buffer_clear(DecoderBuffer *buffer); + /** * Read data from the input_stream and append it to the buffer. * @@ -73,13 +82,10 @@ decoder_buffer_fill(DecoderBuffer *buffer); * decoder_buffer_consume() call. * * @param buffer the decoder_buffer object - * @param length_r pointer to a size_t where you will receive the - * number of bytes available - * @return a pointer to the read buffer, or nullptr if there is no data - * available */ -const void * -decoder_buffer_read(const DecoderBuffer *buffer, size_t *length_r); +gcc_pure +ConstBuffer<void> +decoder_buffer_read(const DecoderBuffer *buffer); /** * Consume (delete, invalidate) a part of the buffer. The "nbytes" |