covert art data and size issue
Audric Ackermann
audric.bilb at gmail.com
Mon Apr 28 08:47:27 UTC 2014
Hi,
I need to get metadata from audio files and found taglib. It works fine
with artist, album, title,... but I have some problems with covert art.
Here is my code to extract it:
Music* gettags(QString mediafile){
Music * music = new Music();
TagLib::FileRef file(mediafile.toUtf8());
//get covert art
TagLib::ID3v2::Tag Tag(file.file(),0);
TagLib::ID3v2::FrameList list = Tag.frameListMap()["APIC"];
if(!list.isEmpty()) {
TagLib::ID3v2::AttachedPictureFrame *Pic =
static_cast<TagLib::ID3v2::AttachedPictureFrame *>(list.front());
if(Pic != NULL) {
std::string artwork_s(Pic->picture().data());
qDebug() << "size: " << Pic->picture().size();
music->musicData.artwork = artwork_s;
}
}
return music;
}
I have checked with easytag and a front covert art is present in the file.
the qDebug() writes: size: 33537
but when I try to show it in my qt app, I got an error message
Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
JPEG datastream contains no image
I don't know in which part of my code I've made a mystake.
Thanks for your help,
Audric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20140428/00cb0def/attachment.html>
More information about the taglib-devel
mailing list