mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Remove duplicate tags when saving AIFF files.
Just the same way as WAV already does.
This commit is contained in:
parent
2b7d6fef47
commit
e44de9f37f
3
NEWS
3
NEWS
@ -5,7 +5,8 @@
|
||||
* Added String::clear().
|
||||
* Added alternative functions to XiphComment::removeField().
|
||||
* Better handling of duplicate ID3v2 tags in all kinds of files.
|
||||
* Better handling of duplicate tags in WAV files.
|
||||
* Better handling of duplicate tag chunks in WAV files.
|
||||
* Better handling of duplicate tag chunks in AIFF files.
|
||||
* Fixed crash when calling File::properties() after strip().
|
||||
* Fixed possible file corruptions when saving ASF files.
|
||||
* Fixed updating the comment field of Vorbis comments.
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
FilePrivate() :
|
||||
properties(0),
|
||||
tag(0),
|
||||
tagChunkID("ID3 "),
|
||||
hasID3v2(false) {}
|
||||
|
||||
~FilePrivate()
|
||||
@ -50,7 +49,6 @@ public:
|
||||
|
||||
Properties *properties;
|
||||
ID3v2::Tag *tag;
|
||||
ByteVector tagChunkID;
|
||||
|
||||
bool hasID3v2;
|
||||
};
|
||||
@ -117,7 +115,10 @@ bool RIFF::AIFF::File::save()
|
||||
return false;
|
||||
}
|
||||
|
||||
setChunkData(d->tagChunkID, d->tag->render());
|
||||
removeChunk("ID3 ");
|
||||
removeChunk("id3 ");
|
||||
|
||||
setChunkData("ID3 ", d->tag->render());
|
||||
d->hasID3v2 = true;
|
||||
|
||||
return true;
|
||||
@ -139,7 +140,6 @@ void RIFF::AIFF::File::read(bool readProperties)
|
||||
if(name == "ID3 " || name == "id3 ") {
|
||||
if(!d->tag) {
|
||||
d->tag = new ID3v2::Tag(this, chunkOffset(i));
|
||||
d->tagChunkID = name;
|
||||
d->hasID3v2 = true;
|
||||
}
|
||||
else {
|
||||
|
@ -77,13 +77,18 @@ public:
|
||||
|
||||
void testDuplicateID3v2()
|
||||
{
|
||||
RIFF::AIFF::File f(TEST_FILE_PATH_C("duplicate_id3v2.aiff"));
|
||||
ScopedFileCopy copy("duplicate_id3v2", ".aiff");
|
||||
|
||||
// duplicate_id3v2.aiff has duplicate ID3v2 tags.
|
||||
// duplicate_id3v2.aiff has duplicate ID3v2 tag chunks.
|
||||
// title() returns "Title2" if can't skip the second tag.
|
||||
|
||||
RIFF::AIFF::File f(copy.fileName().c_str());
|
||||
CPPUNIT_ASSERT(f.hasID3v2Tag());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Title1"), f.tag()->title());
|
||||
|
||||
f.save();
|
||||
CPPUNIT_ASSERT_EQUAL(7030L, f.length());
|
||||
CPPUNIT_ASSERT_EQUAL(-1L, f.find("Title2"));
|
||||
}
|
||||
|
||||
void testFuzzedFile1()
|
||||
|
Loading…
x
Reference in New Issue
Block a user