diff options
author | Max Kellermann <max@duempel.org> | 2014-08-23 13:44:53 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-23 13:44:53 +0200 |
commit | 6fe06cad98360e872f06a6027f038d1949574e94 (patch) | |
tree | e4208d7c118dd3fc9bdf58ce29897956851b207b /src | |
parent | 2335fdbb5ad98ef28df16a14e2fde53291bce8e4 (diff) | |
download | mpd-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 'src')
-rw-r--r-- | src/decoder/plugins/DsfDecoderPlugin.cxx | 5 |
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: |