Disagreement between MPEG::File::ID3v1Tag docs and behavior

Jim jmartin_92 at verizon.net
Thu Jul 3 13:15:11 CEST 2008


Hi Tom.

I'm not sure of the reason for the tag creation when reading an MPEG file.  I've 
noticed a couple other places where I think it might cause problems.  However, a 
better way to check if a tag exists might be to check if you get a valid pointer 
and if you do, check to make sure the tag returned isn't empty.  Something like:

if ( ID3v1Tag() && !ID3v1Tag()->isEmpty() )

should tell you if a valid tag exists.

Hope this helps.

Jim


Tom Kleinpeter wrote:
> Hello,
> 
> The ID3v1Tag and ID3v2Tag functions have notes like these in the docs:
> 
> "If create is false (the default) this will return a null pointer if
> there is no valid ID3v1 tag. If create is true it will create an ID3v1
> tag if one does not exist."
> 
> But, I'm not seeing that behavior in practice -- I'm always getting a
> valid pointer even if there isn't a tag on the file.  Looking at the
> read() function in mpegfile.cpp in the current release, I see these
> lines which seem to contradict what the docs say:
> 
> // Make sure that we have our default tag types available.
>   ID3v2Tag(true);
>   ID3v1Tag(true);
> 
> Going through the logs, those were added at revision 768978 along with
> a bunch of other changes.
> 
> Is this a bug?  If this is the correct behavior and the docs are just
> out of date, what is the correct way to check if a file has tags?
> 
> Thanks,
> Tom
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel


More information about the taglib-devel mailing list