20 #ifndef MPD_DECODER_BUFFER_HXX 21 #define MPD_DECODER_BUFFER_HXX 55 :client(_client), is(_is), buffer(_size) {}
88 auto r = buffer.
Read();
89 return { r.
data, r.size };
115 bool Skip(
size_t nbytes);
bool Fill()
Read data from the InputStream and append it to the buffer.
ConstBuffer< void > Need(size_t min_size)
Wait until this number of bytes are available.
An interface between the decoder plugin and the MPD core.
constexpr Range Read() const
Return a buffer range which may be read.
void Consume(size_type n)
Marks a chunk as consumed.
ConstBuffer< void > Read() const noexcept
Reads data from the buffer.
This objects handles buffered reads in decoder plugins easily.
void Consume(size_t nbytes) noexcept
Consume (delete, invalidate) a part of the buffer.
const InputStream & GetStream() const noexcept
bool Skip(size_t nbytes)
Skips the specified number of bytes, discarding its data.
constexpr size_type GetAvailable() const
DecoderBuffer(DecoderClient *_client, InputStream &_is, size_t _size)
Creates a new buffer.
gcc_pure size_t GetAvailable() const noexcept
How many bytes are stored in the buffer?