From: Lukáš Lalinský Date: Fri, 10 Jul 2009 14:34:04 +0000 (+0000) Subject: Use floting point length to calculate bitrate from the Xing header information X-Git-Tag: v1.6rc1~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b70e3b2304ec3735c3eab07e592c54a7a0b6c12b;p=taglib Use floting point length to calculate bitrate from the Xing header information Patch by Mook BUG:172556 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994337 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- diff --git a/taglib/mpeg/mpegproperties.cpp b/taglib/mpeg/mpegproperties.cpp index 518de61c..1c40b964 100644 --- a/taglib/mpeg/mpegproperties.cpp +++ b/taglib/mpeg/mpegproperties.cpp @@ -218,8 +218,10 @@ void MPEG::Properties::read() double timePerFrame = double(firstHeader.samplesPerFrame()) / firstHeader.sampleRate(); - d->length = int(timePerFrame * d->xingHeader->totalFrames()); - d->bitrate = d->length > 0 ? d->xingHeader->totalSize() * 8 / d->length / 1000 : 0; + double length = timePerFrame * d->xingHeader->totalFrames(); + + d->length = int(length); + d->bitrate = d->length > 0 ? d->xingHeader->totalSize() * 8 / length / 1000 : 0; } else { // Since there was no valid Xing header found, we hope that we're in a constant