Cover of flac file

Lukáš Lalinský lalinsky at gmail.com
Tue Oct 23 20:41:28 UTC 2012


On Tue, Oct 23, 2012 at 9:25 PM, grisha <grish.vanika at gmail.com> wrote:
> I'm so sorry, but i can't understand what it means "base64-decode the field".
> Which field ? I found writing picture using base64 encoding
> https://gist.github.com/1468279, begin from line 131
> but i need to extract picture.

Well, it's exactly the reverse process.

You know that the image is in the Vorbis Comment under the name
"METADATA_BLOCK_PICTURE", so you need to get that field. The field is
encoded using base64, so you need to decide it to binary data. Once
you have the binary data, you pass it to the TagLib::FLAC::Picture
constructor.

TagLib::Ogg::XiphComment *tag = file.xiphComment();
if (tag->contains(""METADATA_BLOCK_PICTURE"")) {
  TagLib::String encodedData =
tag->fieldListMap()["METADATA_BLOCK_PICTURE"].front();
  TagLib::ByteVector data = someBase64DecodeFunction(encodedData);
  TagLib::FLAC::Picture *picture = new TagLib::FLAC::Picture(data);
  // do something with the picture
}

Lukas


More information about the taglib-devel mailing list