[Vorbis-dev] minor Vorbis specification amendment proposal

Michael Niedermayer michaelni at gmx.at
Thu Jul 20 06:56:48 PDT 2006


Hi

Vorbis has 3 "global" header packets, while generic containers generally
have only a single global header per stream

my proposal to solve this, would be to add a few lines to the vorbis
specification to clarify how to convert between the 3 headers and the single
header needed for non ogg containers
currently (without any standarized way) various groups simply use their own
self-invented method to store vorbis in non ogg and consequently either
merge the 3 headers as they see fit or just dump them into the file like
normal packets leading to problems with random access (seeking) ... 
all that leads to many problems and incompatibilites


Proposed amendment------------

To split a global header from a non ogg container:

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

To convert the 3 header packets to a single one for storege in a non ogg
container, simple concatenate the 3 header packets without anything before,
after or between them

-------------------------------

the proposed spliting method will work with pretty much any way the
packets can be merged, it will specifically work with
1. simple concatenation
2. the format in matroska (2<p1 size><p2 size><p1><p2><p3>, sizes stored 
   like packet sizes in ogg)
3. 16/32bit size for packet 0, packet 0, 16/32bit size for packet 1, ...
4. 16bit size for packet 0, 16bit size for packet 1, ..., packet 0, ...
5. 16/32bit size for packet 0, 16/32bit size for packet 1, packet 0, ...

one format it could fail with is if the 3 32bit sizes are put infront of 
the 3 packets, though that would require the packets to be large 
(giga bytes) for it to fail

-- 
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 Vorbis-dev mailing list