[ID3 Dev] Sync-safe sizes?

Jim jmartin92 at comcast.net
Wed May 16 21:14:52 PDT 2007


Hi Mike.

Welcome to the list.  I think you are confusing the ID3 tag size, contained
in the tag header, with the frame size, which is contained in the frame
header.

In ID3v2.3 and ID3v2.4, the tag size contained in the tag header was always
a 32 bit syncsafe integer.  No change there.


In ID3v2.3 and before, the frame size was NOT a syncsafe integer.  It was
just a regular 32 bit integer.  In ID3v2.4, the frame size was changed to a
32 bit syncsafe integer.  So you have to read the frame size differently for
ID3v2.4 and later.

Check the frame overview section in the ID3v2.3 and ID3v2.4 specs.

Jim

----- Original Message ----- 
From: "Mike van Bokhoven" <mike at ambientdesign.com>
To: <id3v2 at id3.org>
Sent: Thursday, May 17, 2007 12:04 AM
Subject: [ID3 Dev] Sync-safe sizes?


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



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