Adding a TXXX frame to an ID3v2 tag
Fred Gleason
fredg at paravelsystems.com
Wed Nov 14 18:35:07 GMT 2018
Greetings Tag Masters!
I am in process of writing some code that adds a custom user text frame to an ID3v2 tag. The approach I’m taking looks like:
*** snip snip ***
TagLib::MPEG::File *file=new TabLib::MPEG::File(“my_file.mp3”,false);
TagLib::ID3v2::Tag *tag=(TagLib::ID3v2::Tag *)file->tag();
TagLib::ID3v2::UserTextIdentificationFrame *frame=new TagLib::ID3v2::UserTextIdentificationFrame(TagLib::String::UTF8);
frame->setDescription(“foo”);
frame->setText(“some structured text”);
tag->addFrame(frame);
*** snip snip ***
This blows up with a SIGSEGV at the addFrame() invocation. I suspect that my problem may be with the simplistic cast from TagLib::Tag * to TabLib::ID3v2::Tag *, but I’ve not been able to find any other way to get access to the TagLib::ID3v2::addFrame() method. I’ve also experimented with using the PropertyMap mechanism —e.g. inserting a key of “TXXX:foo” —, but this seems to be ignored by TagLib::PropertyMap::insert().
Perusal of the API docs as well as Google searches have brought up a fair amount of information about *reading* TXXX frames (mostly through use of the PropertyMap interface), but precious little about how to *write* such using TagLib. What’s the correct way of going about this? Any help greatly appreciated!
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/a7542093/attachment.html>
More information about the taglib-devel
mailing list