aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/SndfileDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 11:36:20 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 11:36:20 +0200
commitc6aafff701ef26a3f87c09d5cadfa93b33eeb3e8 (patch)
tree952a461ab823f5565491cb3cad46aa45dccd9859 /src/decoder/plugins/SndfileDecoderPlugin.cxx
parent26f0f92210b04d58768a9bf100449f05a7c50c09 (diff)
downloadmpd-c6aafff701ef26a3f87c09d5cadfa93b33eeb3e8.tar.gz
mpd-c6aafff701ef26a3f87c09d5cadfa93b33eeb3e8.tar.xz
mpd-c6aafff701ef26a3f87c09d5cadfa93b33eeb3e8.zip
decoder/sndfile: use integer seek times
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/SndfileDecoderPlugin.cxx13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx
index 1e84d8be5..96e61d088 100644
--- a/src/decoder/plugins/SndfileDecoderPlugin.cxx
+++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx
@@ -146,15 +146,6 @@ frame_to_time(sf_count_t frame, const AudioFormat *audio_format)
return (float)frame / (float)audio_format->sample_rate;
}
-/**
- * Converts a timestamp (in seconds) to a frame number.
- */
-static sf_count_t
-time_to_frame(float t, const AudioFormat *audio_format)
-{
- return (sf_count_t)(t * audio_format->sample_rate);
-}
-
static void
sndfile_stream_decode(Decoder &decoder, InputStream &is)
{
@@ -199,9 +190,7 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
buffer, num_frames * frame_size,
0);
if (cmd == DecoderCommand::SEEK) {
- sf_count_t c =
- time_to_frame(decoder_seek_where(decoder),
- &audio_format);
+ sf_count_t c = decoder_seek_where_frame(decoder);
c = sf_seek(sf, c, SEEK_SET);
if (c < 0)
decoder_seek_error(decoder);