Support for METABLOCK_DATA_PICTURE in xiphcomments?
Stephen F. Booth
me at sbooth.org
Fri Dec 13 22:00:16 UTC 2013
I’ve also entered this into the issue tracker (https://github.com/taglib/taglib/issues/336) because I think it would be worth adding this functionality to TagLib’s core.
On Friday, December 13, 2013 at 4:57 PM, Tim De Baets wrote:
> Hi Martin,
> It's already possible to add a METABLOCK_DATA_PICTURE to Vorbis comments
> using current versions of TagLib. Create a vanilla FLAC::Picture object,
> set its picture data and optionally other fields (type, mime type,
> description...), and render() the object to a ByteVector.
> You will then have to Base64-encode the ByteVector's data yourself, or
> use a library. In my WMP Tag Plus plug-in, I use libb64
> <http://libb64.sourceforge.net> for this.
> Here's a code excerpt from WMP Tag Plus:
> void WritePicture(TagLib::Ogg::XiphComment* comments, WM_PICTURE* picture,
> bool* modified)
> if (picture && (!picture->pbData || picture->dwDataLen == 0))
> TagLib::StringList pictureBlocks =
> for (unsigned int i = 0; i < pictureBlocks.size(); i++)
> unsigned int size;
> std::string block;
> if (GetFrontCoverPictureBlock(pictureBlocks, i, &size, &block))
> comments->removeField(COVERART_TAGNAME, pictureBlocks[i]);
> *modified = true;
> if (picture)
> TagLib::FLAC::Picture flacPicture;
> SetFLACPictureFromWMPicture(picture, &flacPicture);
> TagLib::ByteVector block = flacPicture.render();
> unsigned int size = block.size();
> base64::Encoder encoder;
> char* encodedBlock = new char[size * 2 + 1];
> unsigned int encodedSize = encoder.encode(block.data(), size,
> encodedSize += encoder.encode_end(encodedBlock + encodedSize);
> encodedBlock[encodedSize] = '\0';
> comments->addField(COVERART_TAGNAME, encodedBlock, false);
> *modified = true;
> Kind regards,
> Tim De Baets
> Martin Brodbeck wrote:
> > Hello,
> > I recently learned that the recommended way of adding cover art to ogg files
> > (vorbis comments) is to use METABLOCK_DATA_PICTURE instead of the unofficial
> > COVERART field, just likeit is done in FLAC files (see ).
> > By the way, if you encode an opus file from flac (with a flac picture) using
> > opusenc (from opus-tools >= 0.1.7), it uses METABLOCK_DATA_PICTURE.
> > AFAIK, taglib supports FLAC pictures very well. Since the recommended
> > xiphcomment way is exactly the same as in FLAC, it would be nice to have the
> > same support here, I think.
> > Are there any plans to add this?
> > Thanks,
> > Martin
> > http://wiki.xiph.org/VorbisComment#Cover_art
> > _______________________________________________
> > taglib-devel mailing list
> > taglib-devel at kde.org (mailto:taglib-devel at kde.org)
> > https://mail.kde.org/mailman/listinfo/taglib-devel
> taglib-devel mailing list
> taglib-devel at kde.org (mailto:taglib-devel at kde.org)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the taglib-devel