[NUT-devel] vorbis global 3 to 1 header mess

Michael Niedermayer michaelni at gmx.at
Wed Jul 19 10:07:28 CEST 2006


Hi

On Tue, Jul 18, 2006 at 11:10:10PM +0200, Michael Niedermayer wrote:
> Hi
> 
> ive looked at the vorbis spec and it seems like its trivial to split the
> 3 header packets if they are simply blindly concatenated
> the first packet has fixed length
> 
> the comment header looks like:
> 
>   1) [vendor_length] = read an unsigned integer of 32 bits
>   2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
>   3) [user_comment_list_length] = read an unsigned integer of 32 bits
>   4) iterate [user_comment_list_length] times {
>        5) [length] = read an unsigned integer of 32 bits
>        6) this iteration's user comment = read a UTF-8 vector as [length] octets
>      }
>   7) [framing_bit] = read a single bit as boolean
>   8) if ( [framing_bit] unset or end-of-packet ) then ERROR
> 
> an they all have a "vorbis" in front of them ...

how to parse all the vorbis header variants:

1) search for the 1st occurance of 01,'v','o','r','b','i','s'
   the found match and the following 23 bytes are the 1st header packet
2) search for the 1st occurance of 03,'v','o','r','b','i','s' after here
  3) read an unsigned integer of 32 bits and skip that many bytes
  4) [user_comment_list_length] = read an unsigned integer of 32 bits
  5) iterate [user_comment_list_length] times {
       6) read an unsigned integer of 32 bits and skip that many bytes
     }
  7) skip 1 byte
8) the match in 2) and what follows until here is the 2nd header packet
9) search for the 1st occurance of 05,'v','o','r','b','i','s' after here
   the matching part and what follows is the 3rd header packet

if there are no objections then ill propose this on vorbis-dev
spelling fixes and other suggestions welcome

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is



More information about the NUT-devel mailing list