Writing byte data to tags
Lukáš Lalinský
lalinsky at gmail.com
Tue Aug 10 08:43:15 CEST 2010
On Tue, Aug 10, 2010 at 8:33 AM, Glenn McCord <glenn.mccord at gmail.com> wrote:
> I'm trying to write an array of bytes to a xiphcomment tag. Something like:
>
> TagLib::FLAC::File f(path);
> TagLib::Ogg::XiphComment *tag = f.xiphComment();
>
> TagLib::String s( TagLib::ByteVector( (char*)data, length ) );
> tag->addField("CUSTOM_TAG", s);
>
> f->save();
>
> but the problem is that my array of bytes makes use of multiple null
> bytes in a row. It seems that taglib will always interpret this as the
> end of the string, meaning that only a fraction of my array gets
> written to the file.
>
> With my (admittedly quick) look around the header files, it seems that
> there is no way around this as there is a wide use of the String
> class. Even FieldListMap seems to be using String.
>
> Is there a way to write raw bytes to a tag, or am I going to have to
> modify some taglib code?
Vorbis comments can contain only UTF-8 strings (according to the
specification), anything else is invalid. So there is no way to store
binary data, unless you use something like base64.
Lukas
More information about the taglib-devel
mailing list