Creating iTunes compatible COMM frames

Thomas Post post at
Wed Jan 27 15:07:18 CET 2010

On 27.01.2010, at 14:55, patrick machielse wrote:

> Op 27 jan 2010, om 07:04 heeft Dudy Kohen het volgende geschreven:
>> On Tue, Jan 26, 2010 at 11:42 PM, patrick machielse <patrick at> wrote:
>>>> It turns out that new comment frames by default do not have a language set, and TagLib writes out 'XXX'
>>>> in place of the 3-character language code:
>>>> //  commentsframe.cpp
>>>> ByteVector CommentsFrame::renderFields() const
>>>> {
>>>>   //...
>>>>   v.append(d->language.size() == 3 ? d->language : "XXX");
>>>> The ID3V2.4 spec says it should be an ISO 639-2 code. "XXX" isn't valid.
>>> Is this a bug in TagLib? I can't find a response to my original message in the list archives.
>> This is the standard when the language is not defined or invalid.
>> It's not correct to set a default language in a library, so you should set the language before writing.
> Alright, 
> "  The three byte language field, present in several frames, is used to
>   describe the language of the frame's content, according to ISO-639-2
>   [ISO-639-2]. The language should be represented in lower case. If the
>   language is not known the string "XXX" should be used."
> This seems to me a contradictory part of the specification, since ISO-639-2 defines a code for "undetermined language" as well ('und') and using XXX is not complient with ISO-639-2.
> 'should be used' suggests that this requirement has the nature of a recommendation. TagLib possibly could write out zeroes for better interoperability without violating the v2.4 specification proper. If that is not appropriate, I want to suggest implementing a default value of zeroes (if that works) or 'eng' as part of the TagLib "iTunes Hacks".
> Thanks,
> patrick

I had the same problems with iTunes. I just changed the default language to eng. What I've seen this is what iTunes does.
But what did you do to filter out the iTunes specific comments? I just check them manually. I'm not so into C++ so is there an easier way to do the following?

	FrameList::ConstIterator it = comments.end();
	while (it != comments.end()){
		CommentsFrame *frame = dynamic_cast<CommentsFrame *>(*it);
		if (!(frame->description() == String("iTunNORM"))
			&& !(frame->description() == String("iTunSMPB"))
			&& !(frame->description() == String("iTunPGAP"))
			&& !(frame->description() == String("iTunes_CDDB_1"))
			&& !(frame->description() == String("iTunes_CDDB_IDs"))
			&& !(frame->description() == String("iTunes_CDDB_TrackNumber"))) {
			return (*it)->toString();
		--it; //revers enumerate
	return String::null;

Thomas Post

equinux Aktiengesellschaft
Kirschstraße 35
80999 München - Germany
Tel. +49-89-520465-339
Fax +49-89-520465-299
mailto:post at
Vorstand: Till Schadde  -  Aufsichtsrat: Stefan Neuenhahn
USt-IdNr.: DE206360115  -  Sitz München  -  HRB München 129700

equinux USA, Inc.
100 Produce Ave. Suite L, South San Francisco, CA 94080 
Toll free: 1-888-equinux (1-888-3784689)

Stay updated what's going on at equinux
equinux Blog | equinux @ Twitter | equinux @ Facebook
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the taglib-devel mailing list