diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:07 +0200 |
commit | 78c55e24324c881541a87cd0003c60f378a43d68 (patch) | |
tree | 58c98af2f47721e12b195e40b89f6986711083d4 /src/decoder_api.c | |
parent | 817a68b2b27dc65fb5fc550c83117832e8048c6f (diff) | |
download | mpd-78c55e24324c881541a87cd0003c60f378a43d68.tar.gz mpd-78c55e24324c881541a87cd0003c60f378a43d68.tar.xz mpd-78c55e24324c881541a87cd0003c60f378a43d68.zip |
added decoder_command_finished() to decoder_api.h
Some decoder commands are implemented in the decoder plugins, thus
they need to have an API call to signal that their current command has
been finished. Let them use the new decoder_command_finished()
instead of the internal dc_command_finished().
Diffstat (limited to 'src/decoder_api.c')
-rw-r--r-- | src/decoder_api.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index 639278cb9..9d9b1b903 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -50,11 +50,20 @@ enum decoder_command decoder_get_command(mpd_unused struct decoder * decoder) return dc.command; } +void decoder_command_finished(mpd_unused struct decoder * decoder) +{ + assert(dc.command != DECODE_COMMAND_NONE); + + dc.command = DECODE_COMMAND_NONE; + notify_signal(&pc.notify); +} + /** * All chunks are full of decoded data; wait for the player to free * one. */ -static int need_chunks(InputStream * inStream, int seekable) +static int need_chunks(struct decoder *decoder, InputStream * inStream, + int seekable) { if (dc.command == DECODE_COMMAND_STOP) return OUTPUT_BUFFER_DC_STOP; @@ -64,7 +73,7 @@ static int need_chunks(InputStream * inStream, int seekable) return OUTPUT_BUFFER_DC_SEEK; } else { dc.seekError = 1; - dc_command_finished(); + decoder_command_finished(decoder); } } @@ -119,7 +128,7 @@ int decoder_data(struct decoder *decoder, InputStream * inStream, data += nbytes; if (datalen > 0) { - ret = need_chunks(inStream, seekable); + ret = need_chunks(decoder, inStream, seekable); if (ret != 0) return ret; } |