Version: svn (using KDE Devel) Installed from: Compiled sources Compiler: gcc version 4.0.1 (Apple Computer, Inc. build 5367) OS: OS X The calculation of timePerFrame in mepegproperties.cpp almost always results in zero because the result of integer division is being cast to a double. This leads to the length() method of MPEGFile return 0. It is necessary to promote one of the ints before dividing to get an accurate result. Here is a patch with one way to fix the problem: svn diff mpegproperties.cpp Index: mpegproperties.cpp =================================================================== --- mpegproperties.cpp (revision 651409) +++ mpegproperties.cpp (working copy) @@ -213,7 +213,7 @@ { static const int blockSize[] = { 0, 384, 1152, 1152 }; - double timePerFrame = blockSize[firstHeader.layer()] / firstHeader.sampleRate(); + double timePerFrame = (double)blockSize[firstHeader.layer()] / firstHeader.sampleRate(); d->length = int(timePerFrame * d->xingHeader->totalFrames()); d->bitrate = d->length > 0 ? d->xingHeader->totalSize() * 8 / d->length / 1000 : 0; }
SVN commit 689510 by wheeler: Promote the int to a float so that the calcualtion works properly. Patch from Stephen Booth. BUG:143938 M +1 -1 mpegproperties.cpp --- trunk/kdesupport/taglib/taglib/mpeg/mpegproperties.cpp #689509:689510 @@ -213,7 +213,7 @@ { static const int blockSize[] = { 0, 384, 1152, 1152 }; - double timePerFrame = blockSize[firstHeader.layer()] / firstHeader.sampleRate(); + double timePerFrame = double(blockSize[firstHeader.layer()]) / firstHeader.sampleRate(); d->length = int(timePerFrame * d->xingHeader->totalFrames()); d->bitrate = d->length > 0 ? d->xingHeader->totalSize() * 8 / d->length / 1000 : 0; }