Fix from Felix Berger to get RVA2 frames a little closer

to working.  The more complicated fix for #107025 will
follow shortly.

BUG:95545


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@437091 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler 2005-07-20 22:23:34 +00:00
parent 19a0504dfd
commit e321ae7774

View File

@ -19,6 +19,8 @@
* USA *
***************************************************************************/
#include <tdebug.h>
#include "relativevolumeframe.h"
using namespace TagLib;
@ -101,9 +103,17 @@ void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak)
void RelativeVolumeFrame::parseFields(const ByteVector &data)
{
if(data.size() < 6) {
debug("A relative volume frame must contain at least 6 bytes.");
return;
}
int pos = data.find(textDelimiter(String::Latin1));
d->identification = String(data.mid(0, pos), String::Latin1);
d->channelType = ChannelType(data[pos]);
pos += 1;
d->volumeAdjustment = data.mid(pos, 2).toShort();
pos += 2;
@ -119,6 +129,7 @@ ByteVector RelativeVolumeFrame::renderFields() const
data.append(d->identification.data(String::Latin1));
data.append(textDelimiter(String::Latin1));
data.append(char(d->channelType));
data.append(ByteVector::fromShort(d->volumeAdjustment));
data.append(char(d->peakVolume.bitsRepresentingPeak));
data.append(d->peakVolume.peakVolume);