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
This commit is contained in:
Lukáš Lalinský 2009-07-10 14:34:04 +00:00
parent bed793f703
commit b70e3b2304

View 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