[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    [PATCH] Fix handling of ID3v2.3 text frames
From:       "Xavier Duret" <xaviour.maillists () gmail ! com>
Date:       2007-01-17 14:31:06
Message-ID: d3ef58310701170631v5d727da0m61e4c4def0f89000 () mail ! gmail ! com
[Download RAW message or body]

ID3v2.3 specifies that text information frames can be NULL terminated
(see section 4.2). The encoding of the strings themselves are
specified in section 3.3. This means that a frame like "54 52 43 4b 00
00 00 03 00 00 00 31 00 TRCK.......1." actually contains a single NULL
terminated string.
This patch makes ID3v2.3 text information frames behave like ID3v2.4
which in turn ensures that the parsing of "TRCK" tag works properly
(in the example, return 1 instead of 0).

diff -ruN taglib/mpeg/id3v2/frames/textidentificationframe.cpp.old
taglib/mpeg/id3v2/frames/textidentificationframe.cpp
--- taglib/mpeg/id3v2/frames/textidentificationframe.cpp.old
2007-01-17 14:51:25.000000000 +0100
+++ taglib/mpeg/id3v2/frames/textidentificationframe.cpp
2007-01-17 14:52:29.000000000 +0100
@@ -103,7 +103,13 @@

   int byteAlign = d->textEncoding == String::Latin1 ||
d->textEncoding == String::UTF8 ? 1 : 2;

-  ByteVectorList l = ByteVectorList::split(data.mid(1),
textDelimiter(d->textEncoding), byteAlign);
+  ByteVector fixedData;
+  if (data.mid(data.size() - byteAlign, byteAlign) ==
textDelimiter(d->textEncoding))
+    fixedData = data.mid(0, data.size() - byteAlign);
+  else
+    fixedData = data;
+
+  ByteVectorList l = ByteVectorList::split(fixedData.mid(1),
textDelimiter(d->textEncoding), byteAlign);

   d->fieldList.clear();
_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic