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