Detect whether or not an id3v1 tag exists

Joel Verhagen joel.verhagen at gmail.com
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:

http://developer.kde.org/~wheeler/taglib/api/classTagLib_1_1MPEG_1_1File.html#7ae340bcd74f74289fc4f0cdba8c2bd5

<http://developer.kde.org/~wheeler/taglib/api/classTagLib_1_1MPEG_1_1File.html#7ae340bcd74f74289fc4f0cdba8c2bd5>This
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...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20101203/7e1c1821/attachment.htm 


More information about the taglib-devel mailing list