aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-10 08:35:24 +0200
committerMax Kellermann <max@duempel.org>2014-07-10 08:35:24 +0200
commit1d214b4aed84384e91400a9a83b3f39bc3ba24aa (patch)
tree4635374af90671889a48452a05030d866d1894ae /src/decoder
parent2e1347aba4c51060b937751c2a76a5254e89a702 (diff)
downloadmpd-1d214b4aed84384e91400a9a83b3f39bc3ba24aa.tar.gz
mpd-1d214b4aed84384e91400a9a83b3f39bc3ba24aa.tar.xz
mpd-1d214b4aed84384e91400a9a83b3f39bc3ba24aa.zip
decoder/audiofile: use audiofile_get_duration() in _stream_decode()
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
index e78c156f9..f0bc03ed1 100644
--- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx
+++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
@@ -186,10 +186,9 @@ static void
audiofile_stream_decode(Decoder &decoder, InputStream &is)
{
AFvirtualfile *vf;
- int fs, frame_count;
+ int fs;
AFfilehandle af_fp;
AudioFormat audio_format;
- float total_time;
uint16_t bit_rate;
int ret;
char chunk[CHUNK_SIZE];
@@ -219,9 +218,7 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
return;
}
- frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK);
-
- total_time = ((float)frame_count / (float)audio_format.sample_rate);
+ const double total_time = audiofile_get_duration(af_fp);
bit_rate = (uint16_t)(is.GetSize() * 8.0 / total_time / 1000.0 + 0.5);