From 944143a91b9541040117926e927f902d699cab09 Mon Sep 17 00:00:00 2001 From: Duke Yin Date: Wed, 16 Oct 2013 18:48:49 -0400 Subject: [PATCH 1/2] Handle iTunes ID3v2.3 hacks iTunes writes the 2.4 frames TSOA, TSOT, TSOP to 2.3 files. (It additionally defines TSO2 and TSOC for both 2.3 and 2.4.) TagLib should not delete these frames. --- taglib/mpeg/id3v2/id3v2tag.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp index 57637a36..765086c8 100644 --- a/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/taglib/mpeg/id3v2/id3v2tag.cpp @@ -461,10 +461,18 @@ ByteVector ID3v2::Tag::render() const void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const { +#ifdef NO_ITUNES_HACKS const char *unsupportedFrames[] = { "ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG", "TMOO", "TPRO", "TSOA", "TSOT", "TSST", "TSOP", 0 }; +#else + // iTunes writes and reads TSOA, TSOT, TSOP to ID3v2.3. + const char *unsupportedFrames[] = { + "ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG", + "TMOO", "TPRO", "TSST", 0 + }; +#endif ID3v2::TextIdentificationFrame *frameTDOR = 0; ID3v2::TextIdentificationFrame *frameTDRC = 0; ID3v2::TextIdentificationFrame *frameTIPL = 0; From de17843d8c5e5d8ff1cee4741311ded5664a9a62 Mon Sep 17 00:00:00 2001 From: Duke Yin Date: Thu, 17 Oct 2013 15:14:29 -0400 Subject: [PATCH 2/2] Update tests --- tests/test_id3v2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 9f5ffe01..fb192450 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -575,10 +575,12 @@ public: CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TDTG")); CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TMOO")); CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TPRO")); +#ifdef NO_ITUNES_HACKS CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TSOA")); CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TSOT")); - CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TSST")); CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TSOP")); +#endif + CPPUNIT_ASSERT(!bar.ID3v2Tag()->frameListMap().contains("TSST")); } void testCompressedFrameWithBrokenLength()