Commit 6fe06cad authored by Max Kellermann's avatar Max Kellermann

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.
parent 2335fdbb
...@@ -255,9 +255,9 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is, ...@@ -255,9 +255,9 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
const size_t block_size = channels * DSF_BLOCK_SIZE; const size_t block_size = channels * DSF_BLOCK_SIZE;
while (chunk_size >= block_size) { const offset_type n_blocks = chunk_size / block_size;
chunk_size -= block_size;
for (offset_type i = 0; i < n_blocks;) {
if (!decoder_read_full(&decoder, is, buffer, block_size)) if (!decoder_read_full(&decoder, is, buffer, block_size))
return false; return false;
...@@ -272,6 +272,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is, ...@@ -272,6 +272,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
sample_rate / 1000); sample_rate / 1000);
switch (cmd) { switch (cmd) {
case DecoderCommand::NONE: case DecoderCommand::NONE:
++i;
break; break;
case DecoderCommand::START: case DecoderCommand::START:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment