aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/DsfDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-23 13:44:53 +0200
committerMax Kellermann <max@duempel.org>2014-08-23 13:44:53 +0200
commit6fe06cad98360e872f06a6027f038d1949574e94 (patch)
treee4208d7c118dd3fc9bdf58ce29897956851b207b /src/decoder/plugins/DsfDecoderPlugin.cxx
parent2335fdbb5ad98ef28df16a14e2fde53291bce8e4 (diff)
downloadmpd-6fe06cad98360e872f06a6027f038d1949574e94.tar.gz
mpd-6fe06cad98360e872f06a6027f038d1949574e94.tar.xz
mpd-6fe06cad98360e872f06a6027f038d1949574e94.zip
decoder/dsf: count the blocks, not the remaining bytes
Prepare refactoring the whole plugin to use blocks instead of bytes. A block is the smallest addressable unit, and it will simplify the seeking code.
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/DsfDecoderPlugin.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx
index 9791c4fda..81ed07315 100644
--- a/src/decoder/plugins/DsfDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsfDecoderPlugin.cxx
@@ -255,9 +255,9 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
const size_t block_size = channels * DSF_BLOCK_SIZE;
- while (chunk_size >= block_size) {
- chunk_size -= block_size;
+ const offset_type n_blocks = chunk_size / block_size;
+ for (offset_type i = 0; i < n_blocks;) {
if (!decoder_read_full(&decoder, is, buffer, block_size))
return false;
@@ -272,6 +272,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
sample_rate / 1000);
switch (cmd) {
case DecoderCommand::NONE:
+ ++i;
break;
case DecoderCommand::START: