]> granicus.if.org Git - taglib/commitdiff
MusePak: A bit more accurate calculation of the stream length.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Fri, 12 Jun 2015 08:53:17 +0000 (17:53 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 18 Jun 2015 08:05:58 +0000 (17:05 +0900)
taglib/mpc/mpcfile.cpp

index 8c3532446e209a216ac21a5bb81c7b12c1793618..fcf8d1b81feca9fc3da35849025fc41c0462b936 100644 (file)
@@ -315,7 +315,19 @@ void MPC::File::read(bool readProperties, Properties::ReadStyle /* propertiesSty
   // Look for MPC metadata
 
   if(readProperties) {
-    d->properties = new Properties(this, length() - d->ID3v2Size - d->APESize);
+    long streamLength;
+
+    if(d->hasAPE)
+      streamLength = d->APELocation;
+    else if(d->hasID3v1)
+      streamLength = d->ID3v1Location;
+    else
+      streamLength = length();
+
+    if(d->hasID3v2)
+      streamLength -= (d->ID3v2Location + d->ID3v2Size);
+
+    d->properties = new Properties(this, streamLength);
   }
 }