Load embedded album art from id3v2 tags

This commit is contained in:
David Sansome 2010-07-19 11:40:30 +00:00
parent c43d695d8b
commit 2f11ee5d2b
1 changed files with 8 additions and 0 deletions

View File

@ -39,6 +39,7 @@
#include <taglib/trueaudiofile.h>
#include <taglib/textidentificationframe.h>
#include <taglib/xiphcomment.h>
#include <taglib/attachedpictureframe.h>
#include "radio/fixlastfm.h"
#include <lastfm/Track>
@ -368,6 +369,13 @@ void Song::InitFromFile(const QString& filename, int directory_id) {
if (!file->ID3v2Tag()->frameListMap()["TCMP"].isEmpty())
compilation = TStringToQString(file->ID3v2Tag()->frameListMap()["TCMP"].front()->toString()).trimmed();
if (!file->ID3v2Tag()->frameListMap()["APIC"].isEmpty()) {
TagLib::ID3v2::AttachedPictureFrame* pic =
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(
file->ID3v2Tag()->frameListMap()["APIC"].front());
d->image_.loadFromData((const uchar*) pic->picture().data(), pic->picture().size());
}
}
}
else if (TagLib::Ogg::Vorbis::File* file = dynamic_cast<TagLib::Ogg::Vorbis::File*>(fileref->file())) {