diff options
author | Max Kellermann <max@duempel.org> | 2008-11-02 17:01:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-02 17:01:51 +0100 |
commit | c9e15bc418d4a27305b39ccc63e631ac5e329c8b (patch) | |
tree | 0e97c8b6c829f464374d3b2cbcbc3fb01e4bebe4 /src/decoder_api.c | |
parent | c7a374bdcbe85a794b047c638e57b9358d2d095b (diff) | |
download | mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.tar.gz mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.tar.xz mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.zip |
decoder_api: pass "seekable" flag to decoder_initialized()
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
Diffstat (limited to '')
-rw-r--r-- | src/decoder_api.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index 73b5d23f6..e2879808d 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -32,7 +32,7 @@ void decoder_initialized(struct decoder * decoder, const struct audio_format *audio_format, - float total_time) + bool seekable, float total_time) { assert(dc.state == DECODE_STATE_START); assert(audio_format != NULL); @@ -42,6 +42,7 @@ void decoder_initialized(struct decoder * decoder, dc.in_audio_format = *audio_format; getOutputAudioFormat(audio_format, &dc.out_audio_format); + dc.seekable = seekable; dc.totalTime = total_time; dc.state = DECODE_STATE_DECODE; @@ -121,19 +122,11 @@ size_t decoder_read(struct decoder *decoder, * one. */ static enum decoder_command -need_chunks(struct decoder *decoder, - struct input_stream *inStream, int seekable) +need_chunks(struct input_stream *inStream) { - if (dc.command == DECODE_COMMAND_STOP) - return DECODE_COMMAND_STOP; - - if (dc.command == DECODE_COMMAND_SEEK) { - if (seekable) { - return DECODE_COMMAND_SEEK; - } else { - decoder_seek_error(decoder); - } - } + if (dc.command == DECODE_COMMAND_STOP || + dc.command == DECODE_COMMAND_SEEK) + return dc.command; if (!inStream || input_stream_buffer(inStream) <= 0) { @@ -146,7 +139,7 @@ need_chunks(struct decoder *decoder, enum decoder_command decoder_data(struct decoder *decoder, - struct input_stream *inStream, int seekable, + struct input_stream *inStream, void *dataIn, size_t dataInLen, float data_time, uint16_t bitRate, ReplayGainInfo * replayGainInfo) @@ -189,8 +182,7 @@ decoder_data(struct decoder *decoder, data += nbytes; if (datalen > 0) { - enum decoder_command cmd = - need_chunks(decoder, inStream, seekable); + enum decoder_command cmd = need_chunks(inStream); if (cmd != DECODE_COMMAND_NONE) return cmd; } |