aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_internal.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-06 00:42:01 +0100
committerMax Kellermann <max@duempel.org>2009-03-06 00:42:01 +0100
commit000b2d4f3a9c4f761ab918aaff4705621bb8559f (patch)
tree5009a5548c99155e00b4b14d52f50728a337960f /src/decoder_internal.h
parent10be8a8714b49bec5e6f869975962cbc26cebe61 (diff)
downloadmpd-000b2d4f3a9c4f761ab918aaff4705621bb8559f.tar.gz
mpd-000b2d4f3a9c4f761ab918aaff4705621bb8559f.tar.xz
mpd-000b2d4f3a9c4f761ab918aaff4705621bb8559f.zip
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.
Diffstat (limited to '')
-rw-r--r--src/decoder_internal.h22
1 files changed, 22 insertions, 0 deletions
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