[ID3 Dev] Why is footer not included in total size?

Jim jmartin92 at comcast.net
Wed Nov 15 21:22:46 PST 2006


Well, I can see the possibility of the problem there.  However:

I know padding and having a footer are exclusive, but since padding is
optional for a prepended tag, how does this imply footers should not be used
for prepended tags?  (I'm beginning to agree that footers should not be used
on prepended tags but relying on something implied by the spec seems to be
asking for trouble.  If footers should only be used on appended tags it
would seem better to just update the spec to explicitly say that...and not
leave it up to interpretation that could cause problems.)

But let's assume for a moment that a footer CAN be added to a prepended tag.
According to the spec, software that encounters a major tag version beyond
what it understands should skip/ignore the entire tag.  (Like a 2.2 parser
encountering a 2.3 or higher tag or a 2.3 parser encountering a 2.4 or
higher tag, etc.)  How could any software that encounters a tag with a
footer do this?  If it uses the size given by the header and skips ahead
that many bytes, it would end up exactly at the beginning of the footer
instead of after it.

I know there is never any guarantee that the size in the header is correct
and will allow you to skip right to the "real" (meaning how it would be
without the tag) beginning of the file but here you have a case where a
properly written tag with a proper size would land you 10 bytes shy of end
of the tag every time.  That seems wrong.  (Yes, I know that any decent
player should check for the sync signal but shouldn't the goal be to avoid
having to scan for this when you have a properly written tag with no "junk"
data after it?)

The idea that a 2.3 parser would get messed up because it would try to read
this as a frame seems remote.  For one thing, as previously stated, a 2.3
parser should skip a 2.4 tag entirely.  But if it did try to parse the
frames I would think it would already be hopelessly lost since the size in
2.4 frame headers is stored as a syncsafe integer while in 2.3 frames it is
not syncsafe.  And for a not fully conforming 2.4 parser it's true that this
could be a problem.  But, well, even if it doesn't fully conform to the
spec, checking a flag bit and subtracting 10 from the given size is a pretty
simple fix.

Jim

----- Original Message ----- 
From: "Ben Allison" <benski at winamp.com>
To: <id3v2 at id3.org>
Sent: Wednesday, November 15, 2006 10:47 PM
Subject: Re: [ID3 Dev] Why is footer not included in total size?


> The footer is excluded from the length because it would trip up parsers
> that aren't expecting it (either because they are ID3v2.3 or aren't fully
> conformant to 2.4).
>
> It's easy to imagine, you're done reading the last frame, and then come
> across "3DI[0x04]" and assume it's a frame you don't understand, at which
> point you read the frame size and, woops, now you're somewhere in the
> middle of the file.
>
> As others have said, footers are meant for appended tags.  Although not
> specifically banned from use on prepended tags, the fact that padding and
> the footer are mutually exclusive implies that it's never meant to be used
> at the beginning.
>
> -Ben Allison
>
> > Hi.
> >
> > I am wondering what the reasoning was behind the size stored in ID3v2.4
> > tags not including the size of the footer (if present).
> >
> > I've been looking through the source code for some utilities for MP3
files
> > and some other audio file types.  Many of these utilities use a simple
> > method for skipping over the ID3v2 tag if it is there.  They read the
> > first 10 bytes of the file, do some simple checking (look for 'ID3',
check
> > that version bytes are less than $FF and in some cases check that size
> > bytes are syncsafe, i.e. < $80) and if it looks like a tag, convert the
> > size and skip that many bytes ahead (+ 10 bytes for header).  Most of
> > these utilities would be broken if the tag has a footer.  They don't do
> > any specific version checking or checking of the flags byte.
> >
> > If the size stored in ID3v2.4 tags included the footer size (if it is
> > present), it would make these tags much more backwards compatible.  (I
> > know it is a pretty easy change to add checking for the footer flag but
> > wouldn't it have been better to make it compatible with older apps that
> > don't really need to read the tag, just skip it?)   Were there reasons
> > that came up during development why it was done the way it is?  If so,
I'd
> > appreciate if someone could share them with me.  Or if there is
somewhere
> > I can read about this (like some archive of the mailing list) I would
> > appreciate someone pointing me in the right direction.
> >
> > Thanks.
> >
> > Jim Martin
> >
>
>
> ---------------------------------------------------------------------
> 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