TagLib Problems
Manfred Schwind
lists at mani.de
Fri Jan 6 12:52:45 UTC 2012
Hi,
I finally found out the real cause of the problem.
Unfortunately I don't have the mp4 specification, so I'm not sure how and if this can be fixed in TagLib.
The problem:
I have some files where a free form atom ("----") gets lost when the file is opened and saved with TagLib. In my specific example the free form atom is used by iTunes to store information about the encoding parameters like bitrate mode "VBR" of the song, and whatever other information, I don't know.
The Atom is "----:com.apple.iTunes:Encoding Params".
What I found out:
TagLib tries to parse the atom. The atom's "mean" and "name" is correctly parsed ("com.apple.iTunes" and "Encoding Params"). After that, the data block is following. But TagLib ignores this data block, because the "flags" of this block is set to 0 and TagLib is expecting 1. I don't know what these flags are all about. Maybe it's some encoding parameter? I thought maybe I can just remove this check for the expected flag, but then I saw that the data is parsed as UTF8 by TagLib. But the data is clearly not UTF-8; it seems to be some binary data (see below).
So, TagLib just finds (parses) "mean" and "name" of the atom, but not the data, and therefore the complete atom is simply ignored.
This is in MP4::Tag::parseFreeForm(). The check "if(data.size() > 2)" fails, because data.size() is 2 in this case (the ByteVectorList just has data blocks for "mean" and "name", but not for "data").
So the flag is not "1" and the data looks binary, but TagLib seems to support UTF-8 data only. Does that mean, TagLib does not support binary data in "free form atoms", or is Apple storing it's information in a non-standards-conform way?
Here the hex of the complete atom:
00 00 00 6F length (111)
2D 2D 2D 2D "----"
00 00 00 1C length (28)
6D 65 61 6E "mean"
00 00 00 00 flags (0)
63 6F 6D 2E 61 70 70 6C 65 2E 69 54 75 6E 65 73 "com.apple.iTunes"
00 00 00 1B length (27)
6E 61 6D 65 "name"
00 00 00 00 flags (0)
45 6E 63 6F 64 69 6E 67 20 50 61 72 61 6D 73 "Encoding Params"
00 00 00 30 length (48)
64 61 74 61 "data"
00 00 00 00 flags (0) <--- TagLib expects 1 here!
00 00 00 00 not sure about these bytes, they're ignored by TagLib
76 65 72 73 "vers"
00 00 00 01 ... binary (TagLib expects UTF-8) ...
61 63 62 66 "acbf"
00 00 00 03 ... binary again ...
62 72 61 74 "brat"
00 03 94 D6 ... binary again ...
63 64 63 76 "cdcv"
00 01 07 01 ... binary again ...
Any chance for supporting this in TagLib?!? Any ideas?
Regards,
Mani
More information about the taglib-devel
mailing list