From 3a1c784eec47baa010db2233a1a6de4031761eb5 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Fri, 12 Jun 2015 17:53:17 +0900 Subject: [PATCH] MusePak: A bit more accurate calculation of the stream length. --- taglib/mpc/mpcfile.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/taglib/mpc/mpcfile.cpp b/taglib/mpc/mpcfile.cpp index 8c353244..fcf8d1b8 100644 --- a/taglib/mpc/mpcfile.cpp +++ b/taglib/mpc/mpcfile.cpp @@ -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); } }