]> granicus.if.org Git - taglib/commitdiff
Use floting point length to calculate bitrate from the Xing header information
authorLukáš Lalinský <lalinsky@gmail.com>
Fri, 10 Jul 2009 14:34:04 +0000 (14:34 +0000)
committerLukáš Lalinský <lalinsky@gmail.com>
Fri, 10 Jul 2009 14:34:04 +0000 (14:34 +0000)
Patch by Mook
BUG:172556

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994337 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

taglib/mpeg/mpegproperties.cpp

index 518de61c71cd85024f9a11378671da4a5d824e87..1c40b96497d1e01f6275953dfb6df790ef7f2235 100644 (file)
@@ -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