[ID3 Dev] Sync-safe sizes?

Mike van Bokhoven mike at ambientdesign.com
Wed May 16 21:04:20 PDT 2007


Hi! New list member here.

I'm just writing in the hope of a bit of clarification regarding sync-safe
words, mainly the sizes of the tag and frames. The 2.3 spec says:

-------------------------------------------------------
ID3v2 size              4 * %0xxxxxxx
The ID3v2 tag size is encoded with four bytes where the most significant bit
(bit 7) is set to zero in every byte, making a total of 28 bits. The zeroed
bits are ignored, so a 257 bytes long tag is represented as $00 00 02 01.
-------------------------------------------------------

The 2.4 spec says:

-------------------------------------------------------
ID3v2 size             4 * %0xxxxxxx
The ID3v2 tag size is stored as a 32 bit synchsafe integer (section 6.2),
making a total of 28 effective bits (representing up to 256MB).

-------------------------------------------------------

As far as I can see, these two specs are identical with regards to these
fields. When I'm reading frames, I read in a word for the size. Originally I
was compressing that value to ignore the missing bit. I found that that
didn't seem to work for any APIC frame (and I expect any frame with size
>127 bytes). On a little investigation, I discovered that the raw value I
read in already represented the correct size, before the adjustment! But the
specs seem clear - both tag and frame sizes are represented by expanded,
sync-safe words.

All the tags I'm looking at are version 3 (2.3). Doing some research, I
found one person claiming that 2.3 and earlier don't use sync-safe words,
which disagrees with the spec, but agrees with my observations. I haven't
been able to find out much more.

My question is - what am I missing here? I can't believe that pretty much
everyone who writes APIC frames is getting the encoding wrong...

Thanks,

Mike.


---------------------------------------------------------------------
To unsubscribe, e-mail: id3v2-unsubscribe at id3.org
For additional commands, e-mail: id3v2-help at id3.org



More information about the ID3v2 mailing list