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.
This commit is contained in:
Max Kellermann
2009-03-06 00:42:01 +01:00
parent 10be8a8714
commit 000b2d4f3a
7 changed files with 197 additions and 128 deletions

View File

@@ -98,6 +98,7 @@ static void decoder_run_song(const struct song *song, const char *uri)
decoder.seeking = false;
decoder.stream_tag = NULL;
decoder.decoder_tag = NULL;
decoder.chunk = NULL;
dc.state = DECODE_STATE_START;
dc.command = DECODE_COMMAND_NONE;
@@ -194,7 +195,10 @@ static void decoder_run_song(const struct song *song, const char *uri)
pcm_convert_deinit(&decoder.conv_state);
music_pipe_flush();
/* flush the last chunk */
if (decoder.chunk != NULL &&
decoder_flush_chunk(&decoder, NULL) != DECODE_COMMAND_NONE)
music_pipe_cancel(decoder.chunk);
if (close_instream)
input_stream_close(&input_stream);