QUOTE (mrand01 @ May 15 2009, 13:02)

I've read through the ID3 specs what feels like hundreds of times now, and I just don't think I'm getting when to unsynchronize certain values, tags, frames, etc. Tell me if I got this right:
If the tag is v2.2 or v2.3
1. If the tag header indicates unsynchronization, unsynchronize the entire tag excluding the header, but including the extended header (if it exists) and all frames...and padding?
2. Always convert the tag size in the header to a synchsafe integer
If the tag is v2.4 (this is the grey area)
1. If the tag header indicates unsynchronization, all frames need unsychronization. This means I should unsynchronize every frame, but not the extended header (if it exists)
2. All sizes (header, extended header, frame) need to be converted to synchsafe integers
It's problems like this that finally forced me to take the leap into using libraries (I like libid3tag personally, but it's not for everybody).
Here's my interpretation.
For v2.2 and v2.3:
1) You have this correct. The value of the padding bytes MUST be $00 so it doesn't need to be unsynch'd.
2) Yes, because the spec says that each size byte must be %0xxxxxxx so by definition it must always be a synch safe int.
For 2.4
1) I'm not sure. The spec doesn't mention the extended header, but it also doesn't explicitly say that the extended header should not be unsynch'd. My guess is that it would work like v2.3 and should be unsynch'd.
2) Yes for the same reasons mentioned above.
Additionally in 2.4 individual frames have an unsynch bit which can be set. I can't tell whether this should be set when the flag in the header is set, but I would assume so.
QUOTE
Now, in 2.4, if I unsynchronize a certain frame before reading it, do I still need to convert it's size to a synchsafe integer? Do I convert it before unsynchronizing the entire frame? I wish the documentation was just a LITTLE more straight forward...
Thanks a lot for your help,
MR
As stated above, its size is already a synchsafe integer. You'll need to convert to a normal integer to get the size of the frame. This size is calculated AFTER unsynchronization, so just unsynchsafe the int, read the number of bytes specified, then synchronize the data.
A word of warning if you're writing a tag writer and not just reader, Winamp has problems reading unsynchronized tags. Foobar and Mp3tag can read them just fine, but Winamp chokes on them. I tried to let the developers know, but I haven't heard back from them. I just disabled unsynchronization for this reason.