Detect whether or not an id3v1 tag exists

Joel Verhagen joel.verhagen at
Fri Dec 3 18:25:30 CET 2010

Is there a way in TagLib to detect whether or not an ID3v1 tag exists or not
in an MPEG file? The isEmpty function checks whether or not any specific
tags (album, year, etc.) exist, but not whether the id3v1 block itself is
there. See this entry in the TagLib documentation:

says it will return a NULL pointer if there is no id3v1 tag found. This
doesn't happen. For example, I ran an MP3 through the strip-id3v1 program in
the examples. I then ran this same mp3 through my own program that tells me
if the pointer id3v1 tag object is NULL. The pointer returned is not NULL.
Does TagLib have its own special definition for a NULL pointer? Is this a
bug? What could I be doing wrong?

Here is my code.

TagLib::MPEG::File file(filePath);
TagLib::ID3v1::Tag * id3v1 = file.ID3v1Tag();
if(id3v1 == NULL)
qDebug() << "null";

Joel Verhagen
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the taglib-devel mailing list