aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/decode.c2
-rw-r--r--src/decoder_api.c9
-rw-r--r--src/decoder_internal.h2
3 files changed, 12 insertions, 1 deletions
diff --git a/src/decode.c b/src/decode.c
index 97896f67d..33f01701a 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -50,6 +50,8 @@ static void decodeStart(void)
goto stop_no_close;
}
+ decoder.seeking = 0;
+
dc.state = DECODE_STATE_START;
dc.command = DECODE_COMMAND_NONE;
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 9a8b803d9..360df2820 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -69,6 +69,8 @@ enum decoder_command decoder_get_command(mpd_unused struct decoder * decoder)
void decoder_command_finished(mpd_unused struct decoder * decoder)
{
assert(dc.command != DECODE_COMMAND_NONE);
+ assert(dc.command != DECODE_COMMAND_SEEK ||
+ dc.seekError || decoder->seeking);
dc.command = DECODE_COMMAND_NONE;
notify_signal(&pc.notify);
@@ -78,6 +80,8 @@ double decoder_seek_where(mpd_unused struct decoder * decoder)
{
assert(dc.command == DECODE_COMMAND_SEEK);
+ decoder->seeking = 1;
+
return dc.seekWhere;
}
@@ -100,7 +104,10 @@ size_t decoder_read(struct decoder *decoder,
while (1) {
/* XXX don't allow decoder==NULL */
- if (decoder != NULL && dc.command != DECODE_COMMAND_NONE)
+ if (decoder != NULL &&
+ (dc.command != DECODE_COMMAND_SEEK ||
+ !decoder->seeking) &&
+ dc.command != DECODE_COMMAND_NONE)
return 0;
nbytes = readFromInputStream(inStream, buffer, 1, length);
diff --git a/src/decoder_internal.h b/src/decoder_internal.h
index 37b7b65fa..6d8bc7a87 100644
--- a/src/decoder_internal.h
+++ b/src/decoder_internal.h
@@ -26,6 +26,8 @@ struct decoder {
struct decoder_plugin *plugin;
ConvState conv_state;
+
+ int seeking;
};
#endif