PRIV ID3V2Tag and length

Avi Treistman avi at
Mon Sep 16 11:07:17 UTC 2013


I am trying to add a PRIV ID3v2TAG using Taglib 1.8.

My code is very simple

void AddTag(const char *  payload, const char * URL)

       TagLib::MPEG::File f(URL);
       TagLib::ID3v2::Tag *tag = f.ID3v2Tag();
       TagLib::ID3v2::PrivateFrame *frame = new TagLib::ID3v2::PrivateFrame ();
       TagLib::ByteVector v = TagLib:ByteVector::fromCString(payload, strlen(payload));

The payload is a base64-encoded string in ASCII encoding. After running the code, the tag is created in my MP3 file. However, the length field of the frame header is almost double what is should be, and the payload is padded with nulls until this length. It looks like somehow when calculating the frame length , the library is treating the ByteVector as 16-bit values. For example , on a payload of 1300 bytes, I am receiving a frame length of  2593. Not sure where some of the bytes disappeared. I have confirmed the vector size by printing v.size().

I am running on MacOS Mountain Lion 10.8.4.

Any help would be appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the taglib-devel mailing list