aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/flac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:15 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:15 +0200
commitf46de2c32f3ca1dc4c8496830aa7bf6c703838a6 (patch)
tree6c363b964bed517e7ad116c754a168ea4411997c /src/inputPlugins/flac_plugin.c
parente530181e233f315f90c31e0d4aae63449222f46c (diff)
downloadmpd-f46de2c32f3ca1dc4c8496830aa7bf6c703838a6.tar.gz
mpd-f46de2c32f3ca1dc4c8496830aa7bf6c703838a6.tar.xz
mpd-f46de2c32f3ca1dc4c8496830aa7bf6c703838a6.zip
mp3, flac: check for seek command after decoder_read()
When we introduced decoder_read(), we added code which aborts the read operation when a decoder command arrives. Several plugins however did not expect that when they were converted to decoder_read(). Add proper checks to the mp3 and flac decoder plugins.
Diffstat (limited to 'src/inputPlugins/flac_plugin.c')
-rw-r--r--src/inputPlugins/flac_plugin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 06994d3dd..c90ff21ca 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -42,6 +42,10 @@ static flac_read_status flacRead(mpd_unused const flac_decoder * flacDec,
else
return flac_read_status_abort;
}
+
+ if (r == 0 && decoder_get_command(data->decoder) == DECODE_COMMAND_SEEK)
+ return flac_read_status_eof;
+
return flac_read_status_continue;
}
@@ -413,8 +417,6 @@ static int flac_decode_internal(struct decoder * decoder,
while (1) {
if (!flac_process_single(flacDec))
break;
- if (flac_get_state(flacDec) == flac_decoder_eof)
- break;
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
FLAC__uint64 sampleToSeek = decoder_seek_where(decoder) *
data.audio_format.sampleRate + 0.5;
@@ -426,7 +428,8 @@ static int flac_decode_internal(struct decoder * decoder,
decoder_command_finished(decoder);
} else
decoder_seek_error(decoder);
- }
+ } else if (flac_get_state(flacDec) == flac_decoder_eof)
+ break;
}
if (decoder_get_command(decoder) != DECODE_COMMAND_STOP) {
flacPrintErroredState(flac_get_state(flacDec));