TagLib::ID3v2::AttachedPictureFrame
Scott Wheeler
wheeler at kde.org
Fri Jul 30 16:12:56 CEST 2004
On Friday 30 July 2004 14:57, Cyril Bosselut wrote:
There are a number of errors here:
> TagLib::ID3v2::AttachedPictureFrame *p = new
> TagLib::ID3v2::AttachedPictureFrame;
> KMimeMagicResult *result = KMimeMagic::self()->findFileType(mPictureFile);
> p->setMimeType(QStringToTString(result->mimeType()));
> p->setType(TagLib::ID3v2::AttachedPictureFrame::Type(0x03));
It's better here to use the enum value:
p->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
> p->picture().setData(c, sizeof(c));
You can't set the data on a return value and have it update the source. That
basically makes a copy of the data, overwrites it and then throws it
away. ;-)
You need to do setPicture() in there.
> f.ID3v2Tag()->addFrame(p);
Also don't forget to save when you're done.
I wrote another example that works fine here and started organizing the few
other little tools and whatnot that I have setting around in the same
directory:
http://ktown.kde.org/~wheeler/files/more-taglib-examples/taglib-set-picture.cpp
-Scott
More information about the taglib-devel
mailing list