From 000b2d4f3a9c4f761ab918aaff4705621bb8559f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Mar 2009 00:42:01 +0100 Subject: music_pipe: added music_pipe_push() Added music_pipe_allocate(), music_pipe_push() and music_pipe_cancel(). Those functions allow the caller (decoder thread in this case) to do its own chunk management. The functions music_pipe_flush() and music_pipe_tag() can now be removed. --- src/decoder_internal.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/decoder_internal.h') diff --git a/src/decoder_internal.h b/src/decoder_internal.h index 53b6b5cf3..ab52ab037 100644 --- a/src/decoder_internal.h +++ b/src/decoder_internal.h @@ -19,8 +19,11 @@ #ifndef MPD_DECODER_INTERNAL_H #define MPD_DECODER_INTERNAL_H +#include "decoder_command.h" #include "pcm_convert.h" +struct input_stream; + struct decoder { struct pcm_convert_state conv_state; @@ -31,6 +34,25 @@ struct decoder { /** the last tag received from the decoder plugin */ struct tag *decoder_tag; + + /** the chunk currently being written to */ + struct music_chunk *chunk; }; +/** + * Returns the current chunk the decoder writes to, or allocates a new + * chunk if there is none. + */ +struct music_chunk * +decoder_get_chunk(struct decoder *decoder); + +/** + * Flushes a chunk. Waits for room in the music pipe if required. + * + * @return DECODE_COMMAND_NONE on success, any other command if we + * have received a decoder command while waiting + */ +enum decoder_command +decoder_flush_chunk(struct decoder *decoder, struct input_stream *is); + #endif -- cgit v1.2.3