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_thread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/decoder_thread.c') diff --git a/src/decoder_thread.c b/src/decoder_thread.c index b35683e6e..97e92d295 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -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); -- cgit v1.2.3