Skip duplicate chunks when reading AIFF/WAV files.

Similar to #492.
There is no good reason to use the last chunk rather than the first one.
This commit is contained in:
Tsuda Kageyu 2015-05-25 00:40:13 +09:00
parent 4129b919c1
commit 9da20a8a52
2 changed files with 24 additions and 6 deletions

View File

@ -150,8 +150,14 @@ void RIFF::AIFF::File::read(bool readProperties, Properties::ReadStyle propertie
debug("RIFF::AIFF::File::read() - Duplicate ID3v2 tag found.");
}
}
else if(name == "COMM" && readProperties)
formatData = chunkData(i);
else if(name == "COMM" && readProperties) {
if(formatData.isEmpty()) {
formatData = chunkData(i);
}
else {
debug("RIFF::AIFF::File::read() - Duplicate 'COMM' chunk found.");
}
}
}
if(!d->tag)

View File

@ -217,10 +217,22 @@ void RIFF::WAV::File::read(bool readProperties, Properties::ReadStyle properties
}
}
}
else if(name == "fmt " && readProperties)
formatData = chunkData(i);
else if(name == "data" && readProperties)
streamLength = chunkDataSize(i);
else if(name == "fmt " && readProperties) {
if(formatData.isEmpty()) {
formatData = chunkData(i);
}
else {
debug("RIFF::WAV::File::read() - Duplicate 'fmt ' chunk found.");
}
}
else if(name == "data" && readProperties) {
if(streamLength == 0) {
streamLength = chunkDataSize(i);
}
else {
debug("RIFF::WAV::File::read() - Duplicate 'data' chunk found.");
}
}
}
if(!d->tag[ID3v2Index])