Writing byte data to tags

Glenn McCord glenn.mccord at gmail.com
Tue Aug 10 08:33:47 CEST 2010

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);


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?



More information about the taglib-devel mailing list