From 3158955198fbdc71319cd3418523d851e6d47106 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2014 22:43:36 +0200 Subject: TagHandler: pass SongTime to duration() --- src/decoder/plugins/DsfDecoderPlugin.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/decoder/plugins/DsfDecoderPlugin.cxx') diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx index b84eadf66..690616d15 100644 --- a/src/decoder/plugins/DsfDecoderPlugin.cxx +++ b/src/decoder/plugins/DsfDecoderPlugin.cxx @@ -42,7 +42,6 @@ #include static constexpr unsigned DSF_BLOCK_SIZE = 4096; -static constexpr unsigned DSF_BLOCK_BITS = DSF_BLOCK_SIZE * 8; struct DsfMetaData { unsigned sample_rate, channels; @@ -348,8 +347,9 @@ dsf_scan_stream(InputStream &is, return false; /* calculate song time and add as tag */ - unsigned songtime = (metadata.n_blocks * DSF_BLOCK_BITS) / - metadata.sample_rate; + const auto n_blocks = metadata.n_blocks; + auto songtime = SongTime::FromScale(n_blocks * DSF_BLOCK_SIZE, + audio_format.sample_rate); tag_handler_invoke_duration(handler, handler_ctx, songtime); #ifdef HAVE_ID3TAG -- cgit v1.2.3