aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggflac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 22:03:58 +0100
committerMax Kellermann <max@duempel.org>2009-11-10 22:03:58 +0100
commitc1a999c4927181d5b9621af7a7808266e17f64e2 (patch)
treec9268ba8554e9bc04a87d6977a209b91857b3e1e /src/decoder/oggflac_plugin.c
parente51d9fc6a9902c2ef448abf8f1151964a441d788 (diff)
downloadmpd-c1a999c4927181d5b9621af7a7808266e17f64e2.tar.gz
mpd-c1a999c4927181d5b9621af7a7808266e17f64e2.tar.xz
mpd-c1a999c4927181d5b9621af7a7808266e17f64e2.zip
decoder/flac: don't use float to calculate song duration
Simple (up-rounding) integer division is good enough. We're casting the result back to an integer anyway.
Diffstat (limited to 'src/decoder/oggflac_plugin.c')
-rw-r--r--src/decoder/oggflac_plugin.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index 0f5e774c3..a4912f8ac 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -172,9 +172,7 @@ static void of_metadata_dup_cb(G_GNUC_UNUSED const OggFLAC__SeekableStreamDecode
switch (block->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
- data->tag->time = ((float)block->data.stream_info.
- total_samples) /
- block->data.stream_info.sample_rate + 0.5;
+ data->tag->time = flac_duration(&block->data.stream_info);
return;
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
flac_vorbis_comments_to_tag(data->tag, NULL,