AW: AW: [ID3 Dev] Purpose of Unsynchronization flag on ID3v24 tag header ?

Mathias Kunter mathiaskunter at yahoo.de
Sun Apr 8 07:18:22 PDT 2007


>ok i'll summarize, you have three options on a frame basis
>
>1. Dont unsynchronize it, (the preferred option)
>2. Unsynchronize it regardless of its contents and set the flag
>3. Unsynchronize it only if unsynchronization is required, and set the flag

Yup. You could also write it this way in pseudo code:

FOR EACH frame that should be written
{
    IF <you want to unsync this frame (should be an option to the end-user)>
    {
        //the following IF is optional, you actually don't HAVE to check,
        //but it's better coding.
        IF <unsync is actually required for this frame>
        {
            do the unsync
            set the frame header flag
        }
        ELSE
        {
            don't do the unsync
            don't set the frame header flag
        }
    }
    ELSE
    {
        don't do the unsync
        don't set the frame header flag
    }
}
IF <the unsync flag for ALL frames is set>
{
    set the unsync flag for the TAG header too
}
ELSE
{
    don't set the TAG header unsync flag
}


>However it never occurred to me that you could unsynchronize by simply 
>replace all occurences of FF with FF 00.
>What I do is iterate though the data looking for
>an 0xFF, then if the next byte is 0xE0 (or greater) I insert an Ox00,
>or if the next byte is 0x00 I insert an additional 0x00, this method
>seems to be what the Spec describes.

Sounds correct, this would be the "strict" way to do the unsync. However,
if you just replace FF with FF 00, it is also sufficient, because this also
replaces FF 00 with FF 00 00, and the decoder just correctly replaces FF 00
with FF back again. As I said, you may insert 00 bytes where not really
nescessary then, but this doesn't matter.

>This method  increases  the time to encode but reduces the time to 
>decode but I cant see that it matters which way you do.

Well, yes. Given the fact that you have to re-write the entire file in the
worst case (if the padding gets too small) I think the speed criteria isn't
important at all in this case. The difference won't be noticeable by an
end-user.


Best regards.
Mathias
(Magic Tagger developer)




	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

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