Adding a TXXX frame to an ID3v2 tag [SOLVED]

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


On Nov 14, 2018, at 13:44, Scott Wheeler <scott at taglib.org> 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->setDescription(“foo”);
frame->setText(“some structured text”);
tag->addFrame(frame);
*** snip snip ***

Thank you.

Cheers!


|----------------------------------------------------------------------|
| 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: <http://mail.kde.org/pipermail/taglib-devel/attachments/20181114/b340f747/attachment.html>


More information about the taglib-devel mailing list