Accept both "ID3 " and "id3 " as valid ID3 chunk IDs in RIFF files

Patch by Stephen F. Booth


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1191982 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský 2010-11-01 16:32:37 +00:00
parent 306aee3e7d
commit 874d495b29
2 changed files with 14 additions and 6 deletions

View File

@ -36,7 +36,8 @@ class RIFF::AIFF::File::FilePrivate
public:
FilePrivate() :
properties(0),
tag(0)
tag(0),
tagChunkID("ID3 ")
{
}
@ -49,6 +50,7 @@ public:
Properties *properties;
ID3v2::Tag *tag;
ByteVector tagChunkID;
};
////////////////////////////////////////////////////////////////////////////////
@ -85,7 +87,7 @@ bool RIFF::AIFF::File::save()
return false;
}
setChunkData("ID3 ", d->tag->render());
setChunkData(d->tagChunkID, d->tag->render());
return true;
}
@ -97,8 +99,10 @@ bool RIFF::AIFF::File::save()
void RIFF::AIFF::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
{
for(uint i = 0; i < chunkCount(); i++) {
if(chunkName(i) == "ID3 ")
if(chunkName(i) == "ID3 " || chunkName(i) == "id3 ") {
d->tagChunkID = chunkName(i);
d->tag = new ID3v2::Tag(this, chunkOffset(i));
}
else if(chunkName(i) == "COMM" && readProperties)
d->properties = new Properties(chunkData(i), propertiesStyle);
}

View File

@ -36,7 +36,8 @@ class RIFF::WAV::File::FilePrivate
public:
FilePrivate() :
properties(0),
tag(0)
tag(0),
tagChunkID("ID3 ")
{
}
@ -49,6 +50,7 @@ public:
Properties *properties;
ID3v2::Tag *tag;
ByteVector tagChunkID;
};
////////////////////////////////////////////////////////////////////////////////
@ -85,7 +87,7 @@ bool RIFF::WAV::File::save()
return false;
}
setChunkData("ID3 ", d->tag->render());
setChunkData(d->tagChunkID, d->tag->render());
return true;
}
@ -99,8 +101,10 @@ void RIFF::WAV::File::read(bool readProperties, Properties::ReadStyle properties
ByteVector formatData;
uint streamLength = 0;
for(uint i = 0; i < chunkCount(); i++) {
if(chunkName(i) == "ID3 ")
if(chunkName(i) == "ID3 " || chunkName(i) == "id3 ") {
d->tagChunkID = chunkName(i);
d->tag = new ID3v2::Tag(this, chunkOffset(i));
}
else if(chunkName(i) == "fmt " && readProperties)
formatData = chunkData(i);
else if(chunkName(i) == "data" && readProperties)