diff --git a/taglib/mpc/mpcproperties.cpp b/taglib/mpc/mpcproperties.cpp index 2d3f863c..4359281a 100644 --- a/taglib/mpc/mpcproperties.cpp +++ b/taglib/mpc/mpcproperties.cpp @@ -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)