Fix SV4 MPC file length. (Read the length at the correct offset.)

BUG:133959


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@689576 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler 2007-07-18 15:50:52 +00:00
parent db2bedd642
commit 838114d093

View File

@ -81,13 +81,6 @@ int MPC::Properties::sampleRate() const
return d->sampleRate;
}
/*
int MPC::Properties::sampleWidth() const
{
return d->sampleWidth;
}
*/
int MPC::Properties::channels() const
{
return d->channels;
@ -121,18 +114,21 @@ void MPC::Properties::read()
d->channels = 2;
}
else {
unsigned int headerData = d->data.mid(0, 4).toUInt(false);
uint headerData = d->data.mid(0, 4).toUInt(false);
d->bitrate = (headerData >> 23) & 0x01ff;
d->version = (headerData >> 11) & 0x03ff;
d->sampleRate = 44100;
d->channels = 2;
if(d->version >= 5)
frames = d->data.mid(4, 4).toUInt(false);
else
frames = d->data.mid(4, 2).toUInt(false);
frames = d->data.mid(6, 2).toUInt(false);
}
unsigned int samples = frames * 1152 - 576;
uint samples = frames * 1152 - 576;
d->length = d->sampleRate > 0 ? (samples + (d->sampleRate / 2)) / d->sampleRate : 0;
if(!d->bitrate)