aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-07-20 12:30:56 +0200
committerMax Kellermann <max@duempel.org>2011-07-20 12:54:30 +0200
commit2e28ed8f81630cdadf9e3a22d0cd460f6afffe1a (patch)
tree6926c31e4d0427678f0569f2252a12f30c708ff3
parent4c4f8bf02a6315ce988fcacab9cfd890c67ca5d0 (diff)
downloadmpd-2e28ed8f81630cdadf9e3a22d0cd460f6afffe1a.tar.gz
mpd-2e28ed8f81630cdadf9e3a22d0cd460f6afffe1a.tar.xz
mpd-2e28ed8f81630cdadf9e3a22d0cd460f6afffe1a.zip
wavpack: obey all decoder commands, stop at CUE track border
It used to ignore the decoder_data() return value.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/wavpack_decoder_plugin.c15
2 files changed, 7 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 26a4c1134..e6580c5f0 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ ver 0.16.4 (2011/??/??)
* decoder:
- ffmpeg: workaround for semantic API change in recent ffmpeg versions
- flac: validate the sample rate when scanning the tag
+ - wavpack: obey all decoder commands, stop at CUE track border
* output:
- alsa: fix SIGFPE when alsa announces a period size of 0
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c
index c8f0b7152..24d0c1703 100644
--- a/src/decoder/wavpack_decoder_plugin.c
+++ b/src/decoder/wavpack_decoder_plugin.c
@@ -194,8 +194,9 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
decoder_initialized(decoder, &audio_format, can_seek, total_time);
- while (true) {
- if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
+ enum decoder_command cmd = decoder_get_command(decoder);
+ while (cmd != DECODE_COMMAND_STOP) {
+ if (cmd == DECODE_COMMAND_SEEK) {
if (can_seek) {
unsigned where = decoder_seek_where(decoder) *
audio_format.sample_rate;
@@ -210,10 +211,6 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
}
}
- if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) {
- break;
- }
-
uint32_t samples_got = WavpackUnpackSamples(wpc, chunk,
samples_requested);
if (samples_got == 0)
@@ -224,9 +221,9 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
format_samples(bytes_per_sample, chunk,
samples_got * audio_format.channels);
- decoder_data(decoder, NULL, chunk,
- samples_got * output_sample_size,
- bitrate);
+ cmd = decoder_data(decoder, NULL, chunk,
+ samples_got * output_sample_size,
+ bitrate);
}
}