aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe.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/pipe.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 'src/pipe.h')
-rw-r--r--src/pipe.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/pipe.h b/src/pipe.h
index 0d871d886..01214dc51 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -57,8 +57,6 @@ void music_pipe_free(void);
void music_pipe_clear(void);
-void music_pipe_flush(void);
-
/**
* When a chunk is decoded, we wake up the player thread to tell him
* about it. In "lazy" mode, we only wake him up when the buffer was
@@ -121,6 +119,32 @@ music_pipe_peek(void)
}
/**
+ * Allocates a chunk for writing. When you are finished, append it
+ * with music_pipe_push().
+ *
+ * @return an empty chunk
+ */
+struct music_chunk *
+music_pipe_allocate(void);
+
+/**
+ * Appends a chunk at the end of the music pipe.
+ *
+ * @param chunk a chunk allocated with music_pipe_allocate()
+ * @return true on success, false if there is no room
+ */
+bool
+music_pipe_push(struct music_chunk *chunk);
+
+/**
+ * Cancels a chunk that has been allocated with music_pipe_allocate().
+ *
+ * @param chunk a chunk allocated with music_pipe_allocate()
+ */
+void
+music_pipe_cancel(struct music_chunk *chunk);
+
+/**
* Prepares appending to the music pipe. Returns a buffer where you
* may write into. After you are finished, call music_pipe_expand().
*
@@ -138,12 +162,6 @@ music_pipe_write(const struct audio_format *audio_format,
void
music_pipe_expand(const struct audio_format *audio_format, size_t length);
-/**
- * Send a tag. This is usually called when a new song within a stream
- * begins.
- */
-bool music_pipe_tag(const struct tag *tag);
-
void music_pipe_skip(unsigned num);
/**