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/DsdiffDecoderPlugin.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/decoder/plugins/DsdiffDecoderPlugin.cxx') diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx index 617d34ae4..b6c79e11e 100644 --- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx +++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx @@ -474,8 +474,9 @@ dsdiff_scan_stream(InputStream &is, return false; /* calculate song time and add as tag */ - unsigned songtime = ((metadata.chunk_size / metadata.channels) * 8) / - metadata.sample_rate; + uint64_t n_frames = metadata.chunk_size / audio_format.channels; + auto songtime = SongTime::FromScale(n_frames, + audio_format.sample_rate); tag_handler_invoke_duration(handler, handler_ctx, songtime); /* Read additional metadata and created tags if available */ -- cgit v1.2.3