TagLib::ID3v2::AttachedPictureFrame
Cyril Bosselut
bosselut at b1project.com
Fri Jul 30 14:57:41 CEST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
ok now i know how to read picture in tags using AttachedPictureFrame. Here's
an example:
if(f.ID3v2Tag()){
TagLib::ID3v2::FrameList l= f.ID3v2Tag()->frameListMap()["APIC"];
if (!l.isEmpty()){
QImage cover;
TagLib::ID3v2::AttachedPictureFrame *p =
static_cast<TagLib::ID3v2::AttachedPictureFrame *>(l.front());
kdDebug() << "id3 have picture " << endl;
size_t size = p->picture().size();
kdDebug() << TStringToQString(p->mimeType()) << endl;
kdDebug() << p->type() << endl;
kdDebug() << size << endl;
cover.loadFromData((const uchar*)p->picture().data(), size);
}
}
So, now i'm looking on howt to add a picture. Scott, do you have an exemple?
For the moment i try with something like this, but not successfully (c
contains raw binary from mPictureFile) :( :
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));
p->picture().setData(c, sizeof(c));
f.ID3v2Tag()->addFrame(p);
Any help would be appreciate ;)
Bye,
Cyril.
- --
Un artiste qui plait a tout le monde,
ca deplait a certains. Paradoxal, non ?
-- P. Geluck
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBCkXG9J4lbJfupC0RAm6fAJ9CRYONh4tvvKI0r1bulmwW7ATOGQCgrT8D
Q2WBzlxI6X1J+WYxIMq0dmc=
=5RE9
-----END PGP SIGNATURE-----
More information about the taglib-devel
mailing list