]> granicus.if.org Git - taglib/commitdiff
Fix from Felix Berger to get RVA2 frames a little closer
authorScott Wheeler <wheeler@kde.org>
Wed, 20 Jul 2005 22:23:34 +0000 (22:23 +0000)
committerScott Wheeler <wheeler@kde.org>
Wed, 20 Jul 2005 22:23:34 +0000 (22:23 +0000)
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

mpeg/id3v2/frames/relativevolumeframe.cpp

index 171ba91dc2d12c9c92f57762d2ea09331d6f9add..3042a2da79e70da3fd519fcf8c4df08d437afba8 100644 (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);