PRIV ID3V2Tag and length

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


Hi,

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));
       frame->setOwner("xxxxxxxxxxxx");
       frame->setData(v);
       tag->addFrame(frame);
       f.save();
}

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.

Andrew


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20130916/fc8e02c1/attachment.html>


More information about the taglib-devel mailing list