aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 21:53:50 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 21:53:50 +0200
commit6bf8d5b9363a99c2a7b90263b741123220f878ec (patch)
tree302d34dc17e911577360e69c933ac27204c095a9 /src/decoder/plugins
parent93858bf26247d395675a281baec2bf3e9c11ad85 (diff)
downloadmpd-6bf8d5b9363a99c2a7b90263b741123220f878ec.tar.gz
mpd-6bf8d5b9363a99c2a7b90263b741123220f878ec.tar.xz
mpd-6bf8d5b9363a99c2a7b90263b741123220f878ec.zip
decoder/dsdiff: use integer seek times
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/DsdiffDecoderPlugin.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
index 37dabc72d..112de8b90 100644
--- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
@@ -351,15 +351,9 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
}
static offset_type
-TimeToFrame(double t, unsigned sample_rate)
+FrameToOffset(uint64_t frame, unsigned channels)
{
- return offset_type(t * sample_rate / 8);
-}
-
-static offset_type
-TimeToOffset(double t, unsigned channels, unsigned sample_rate)
-{
- return TimeToFrame(t, sample_rate) * channels;
+ return frame * channels;
}
/**
@@ -383,9 +377,8 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
for (offset_type remaining_bytes = total_bytes;
remaining_bytes >= frame_size && cmd != DecoderCommand::STOP;) {
if (cmd == DecoderCommand::SEEK) {
- double t = decoder_seek_where(decoder);
- offset_type offset = TimeToOffset(t, channels,
- sample_rate);
+ uint64_t frame = decoder_seek_where_frame(decoder);
+ offset_type offset = FrameToOffset(frame, channels);
if (offset >= total_bytes) {
decoder_command_finished(decoder);
break;