[ID3 Dev] Padding

Ben Bennett fiji at ayup.limey.net
Tue Aug 23 17:45:33 PDT 2005


On Tue, Aug 23, 2005 at 11:12:42PM +0100, Ion Todirel wrote:
> thanks very much Ben, i stiil dont understand why footer and padding are mutually exclusive? if i have this situation, all sems to be OK?
>  
> <tag header>
> <TIT1 header><TIT1 contents>
> <TIT2 header><TIT2 contents>
> <padding>
> <mp3 audio data>
> <tag footer>
> <ID3v1 tag>

The footer doesn't work as you have indicated here.  The footer is at
the end of a tag so:

[The following is not a legal layout due to padding and footer]
<tag header>
<TIT1 header><TIT1 contents>
<TIT2 header><TIT2 contents>
<padding>
<tag footer>
<mp3 audio data>
<ID3v1 tag>

Would be the right layout.  Except that as soon as you hit padding it
means that there is padding for the rest of the tag size.  In the case
above the footer doesn't make sense since you can't find it easily (it
is primarily for when the tag is appended).

So if you have a totally appended tag:

[Also not legal]
<mp3 audio data>
<tag header>
<TIT1 header><TIT1 contents>
<TIT2 header><TIT2 contents>
<padding>
<tag footer>
<ID3v1 tag>

The footer now makes sense since you find it easily by scanning
backwards and then you can find the tag start and parse normally.
Except that there is no real need for padding since when you are so
close to the end of the file it is easy to rewrite the remainder to
grow or shrink the tag.
  

> and second problem:
>  
> here is a simple tag:
>  
> <tag header>
> <"frame ID" header><"frame ID" content>
> ...
> <"frame IDi" header><"frame IDi" content>
> ...
> <"frame IDn" header><"frame IDn" content> (last frame (normal frame))
> 
> <padding>                                                 (lets say 100%)
> <audio data>
> <ID3v1>
> 

I am not sure what you mean by 100%.  If you mean 100% of the
remainder of the tag size, then okay, but padding always has to be
100% of the remainder.  So lets call it 100 bytes.

>  
> Ben, way just not add two new frames like this?:
>  
> <tag header>
> <"frame ID" header><"frame ID" content>
> ...
> <"frame IDi" header><"frame IDi" content>
> ...
> <"frame IDn" header><"frame IDn" content>
> 
> <"frame IDn+1" content><"frame IDn+1" content> (added frame)
> 
> <"frame IDn+2" content><"frame IDn+2" content> (added frame)                                 
> <padding>                                                          (after adding two frames padding = padding - x bytes)   
> <audio data>
> <ID3v1>

If X = the size of the 2 new frames, then that is exactly what you
would do.

> but add like you say?:
>  
> <tag header>
> <"frame ID1" header>
> <"frame ID2" header>
> <"frame ID3" header><"frame ID3" content>
> ...
> <"frame IDi" header><"frame IDi" content>
> ...
> <"frame IDn" header><"frame IDn" content> (last frame (normal frame))
> 
> <"frame ID1" content>          
> <"frame ID2" content>                                  
> <padding>                                                 (same situation) 
> <audio data>
> <ID3v1>

I did not mean to imply this and have confused you.  The previous case
is what you would do.

		-ben

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