aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 22:00:16 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 22:00:16 +0200
commit07dc26269000819451962ff952701291b4ff365e (patch)
tree592ceca4a7c32e6af1d4c40bcddaed50b82e4dcf /src/decoder/plugins
parent6bf8d5b9363a99c2a7b90263b741123220f878ec (diff)
downloadmpd-07dc26269000819451962ff952701291b4ff365e.tar.gz
mpd-07dc26269000819451962ff952701291b4ff365e.tar.xz
mpd-07dc26269000819451962ff952701291b4ff365e.zip
decoder/dsf: use integer seek times
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/DsfDecoderPlugin.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx
index b85f7ce4f..c92c276fc 100644
--- a/src/decoder/plugins/DsfDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsfDecoderPlugin.cxx
@@ -244,9 +244,9 @@ InterleaveDsfBlock(uint8_t *gcc_restrict dest, const uint8_t *gcc_restrict src,
}
static offset_type
-TimeToBlock(double t, unsigned sample_rate)
+FrameToBlock(uint64_t frame)
{
- return offset_type(t * sample_rate / DSF_BLOCK_BITS);
+ return frame / DSF_BLOCK_SIZE;
}
/**
@@ -264,8 +264,8 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
auto cmd = decoder_get_command(decoder);
for (offset_type i = 0; i < n_blocks && cmd != DecoderCommand::STOP;) {
if (cmd == DecoderCommand::SEEK) {
- double t = decoder_seek_where(decoder);
- offset_type block = TimeToBlock(t, sample_rate);
+ uint64_t frame = decoder_seek_where_frame(decoder);
+ offset_type block = FrameToBlock(frame);
if (block >= n_blocks) {
decoder_command_finished(decoder);
break;