Adding a TXXX frame to an ID3v2 tag [SOLVED]

Fred Gleason fredg at
Wed Nov 14 19:05:19 GMT 2018

On Nov 14, 2018, at 13:44, Scott Wheeler <scott at> wrote:

> The problem is that the result of file->tag() *isn't* an ID3v2::Tag, so casting it to that fails.  (It's a special class that's a union of the available tag types for that file.)  To get the ID3v2 tag, you have to use the ID3v2Tag() method:

Ah, a union. I somehow had the idea that the relationship was a virtual inheritance.

So, the corrected code block now reads:

*** snip snip ***
TagLib::MPEG::File *file=new TabLib::MPEG::File(“my_file.mp3”,false);
TagLib::ID3v2::Tag *tag=file->ID3v2Tag();

TagLib::ID3v2::UserTextIdentificationFrame *frame=new TagLib::ID3v2::UserTextIdentificationFrame(TagLib::String::UTF8);
frame->setText(“some structured text”);
*** snip snip ***

Thank you.


| Frederick F. Gleason, Jr. |              Chief Developer             |
|                           |              Paravel Systems             |
|          A room without books is like a body without a soul.         |
|                                         -- Cicero                    |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the taglib-devel mailing list