Bug 145298

Summary: RVA2 frames handled incorrectly
Product: [Frameworks and Libraries] taglib Reporter: Stephen F. Booth <me>
Component: generalAssignee: Scott Wheeler <wheeler>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Stephen F. Booth 2007-05-11 06:53:27 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.0.1 (Apple Computer, Inc. build 5367) 
OS:                OS X

The gain adjustment is handled incorrectly when set (it is currently divided by 512 and should be multiplied), and the tag is parsed incorrectly because the separator length is not accounted for.  The following patch fixes both issues:

Index: relativevolumeframe.cpp
===================================================================
--- relativevolumeframe.cpp     (revision 651409)
+++ relativevolumeframe.cpp     (working copy)
@@ -130,7 +130,7 @@
 
 void RelativeVolumeFrame::setVolumeAdjustment(float adjustment, ChannelType type)
 {
-  d->channels[type].volumeAdjustment = short(adjustment / float(512));
+  d->channels[type].volumeAdjustment = short(adjustment * float(512));
 }
 
 void RelativeVolumeFrame::setVolumeAdjustment(float adjustment)
@@ -164,8 +164,10 @@
 
 void RelativeVolumeFrame::parseFields(const ByteVector &data)
 {
-  uint pos = data.find(textDelimiter(String::Latin1));
+  ByteVector delimiter = textDelimiter(String::Latin1);
+  uint pos = data.find(delimiter);
   d->identification = String(data.mid(0, pos), String::Latin1);
+  pos += delimiter.size();
 
   // Each channel is at least 4 bytes.
Comment 1 Scott Wheeler 2007-07-18 13:33:11 UTC

*** This bug has been marked as a duplicate of 107025 ***