Cover of flac file

Гриша Ваника grish.vanika at
Tue Oct 16 17:26:16 UTC 2012


I'm not sure the correct address I asked.

I need to extract album cover from audio file. But i have some problems
with flac.
As i understand, the best way to do it is (file is TagLib::FLAC::File*):

        founded = extractFlac(file);



            TagLib::ID3v2::Tag* tag = file->ID3v2Tag();


                founded = extractId3(tag);


*extractFlac *and *extractId3 *functions:

bool extractFlac(TagLib::FLAC::File* file)


    const TagLib::List<TagLib::FLAC::Picture*> picList = file->pictureList();



        TagLib::FLAC::Picture* pic = picList.front();

        return saveData(pic->data());


    return false;


 bool extractId3(TagLib::ID3v2::Tag* tag)


    const TagLib::ID3v2::FrameList& frameList = tag->frameList("APIC");



        TagLib::ID3v2::AttachedPictureFrame* frame =


        return saveData(frame->picture());


    return false;


But it doesn't work. Function *pictureList()* of
*TagLib::FLAC::File*always return empty list (file is valid and has
cover) and file does not
have ID3v2 tag.

I test it on Windows 32 bit and Ubuntu 12.04 32 bit ( *TagLib 1.8* ). Can
you help me?

And one another question. What about initializing *TagLib::FileRef* with
wchar_t* string on not Windows OS?
I mean *TagLib::**FileName *type

#ifdef _WIN32

  class TAGLIB_EXPORT FileName



    FileName(const wchar_t *name) : m_wname(name) {}

    FileName(const char *name) : m_name(name) {}

    operator const wchar_t *() const { return m_wname.c_str(); }

    operator const char *() const { return m_name.c_str(); }


    std::string m_name;

    std::wstring m_wname;



  typedef const char *FileName;


I can't work with *TagLib::FileRef* and wide characters string?

According to the implementation of FileName class it will work fine on not
Windows OS too...

Best regards,
Grigoriy Vanika        mailto : grish.vanika at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the taglib-devel mailing list