[ID3 Dev] id3v2-3 extended header

Jim jmartin92 at comcast.net
Tue Aug 14 12:31:29 PDT 2007


I believe the 6 or 10 byte size only applies to v2.3 tags.  The extended 
header size will be 10 bytes when the CRC flag is set (4 added bytes for 
the CRC value) and 6 byte when the CRC flag is unset.

To find the beginning of the frames, you would start at position 10 + 
size of extended header if present.

For v2.3 tags, you would read the first ten bytes (tag header) and then, 
if there is an extended header, read 4 bytes to get its size and then 
skip that many bytes.  (The padding that is given in the extended header 
comes AFTER the frames.)

For v2.4 tags, you would read the first ten bytes (tag header) and then, 
if there is an extended header, read 4 bytes to get its size and then 
skip (size - 4) bytes ahead.  (I believe in v2.4 tags, the size given in 
  the extended header includes the 4 bytes you would have already read.) 
  And don't forget that in v2.4 tags, the extended header size is stored 
as a syncsafe integer.

Check out this diagram.  It should help:

    Overall tag structure:

      +-----------------------------+
      |      Header (10 bytes)      |
      +-----------------------------+
      |       Extended Header       |
      | (variable length, OPTIONAL) |
      +-----------------------------+
      |   Frames (variable length)  |
      +-----------------------------+
      |           Padding           |
      | (variable length, OPTIONAL) |
      +-----------------------------+
      | Footer (10 bytes, OPTIONAL) |
      +-----------------------------+



Clemens Hammerl wrote:
> hi
> 
> more questions inline...
> 
> Am 14.08.2007 um 18:10 schrieb Jim:
> 
>> Hi Clemens.
>>
>> I'm not sure which version of ID3v2 you are asking about.  However, in 
>> both v2.3 and v2.4 tags, the extended header size is the first four 
>> bytes.  For v2.3:
>>
>>      Extended header size   $xx xx xx xx
>>      Extended Flags         $xx xx
>>      Size of padding        $xx xx xx xx
> 
> So the extended header size is variable in 2.3/4 and not constantly 10 
> Bytesin size? Im just confused about the variable size of the header.
> 
> I will not implement extended headers im only interested in parsing the 
> Text Information Frames, so i have to search for the beginning of the 
> frames at position 10(Tag header) + extendedHeaderSize + SizeOfPadding. 
> Am I right?
> 
>>
>> And for v2.4:
>>
>>      Extended header size   4 * %0xxxxxxx
>>      Number of flag bytes       $01
>>      Extended Flags             $xx
>>
>>
>> Is that what you were asking?  (Both of those descriptions were taken
>>> from the specs available on the ID3 website so you can look there for a
>> more thorough description of each field.)
>>
>> I can only guess why the size is stored as 4 bytes.  My guesses would 
>> be both for future compatability if the extended header becomes larger 
>> in later versions and to make it standard with the rest of the sizes 
>> (overall tag size & frame sizes).
>>
>> Jim
>>
>>
>> Clemens Hammerl wrote:
>>> Hi
>>> Im new to id3 an this list and i'm currently working on an 
>>> implementation of ID3 for Java.
>>> I dont understand how the length of extended header is calculated. In 
>>> the specification stands that:
>>> "...Where the 'Extended header size', currently 6 or 10 bytes, excludes
>>>    itself..."
>>> But were in the header is the size of the header stored. Is it in the 
>>> first 4 bytes. Why do you use 4 bytes when the maximum length is 10B?
>>> best regards clemens
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> ---------------------------------------------------------------------
> 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