mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
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:
parent
db2bedd642
commit
838114d093
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user