[vorbis-dev] ogg file header?

Michael Smith msmith at labyrinth.net.au
Wed Oct 17 15:42:44 PDT 2001



At 02:20 PM 10/17/01 -0700, you wrote:
>
>>
>>There's quite a lot you have to do to handle all the cases. For the
>>most common case, you just have to fix up one or two pages, but it's
>>not really worth implementing that case seperately (I found out, I tried
>>it). It's best to just implement everything (i.e. the most complex case),
>>and use that all the time.
>>
>>See vorbiscomment (vorbis-tools/vorbiscomment/vcedit.c) for details on
>>exactly how to do this (in C. Translations to other languages should
>>be straightforward). This actually does _more_ than required (though not
>>much more) in order to fix up some streams which old/broken encoders
>>produced. I can explain any particularly confusing bits of the code
>>if you need.
>>
>
>i have looked at vcedit.c and the following document: 
>http://www.xiph.org/ogg/vorbis/doc/framing.html  these helped quite a bit.
>
>a few questions though:
>
>i notice that when ever you make a new ogg file with oggdrop it sets 
>page_segments to 0x11.  does this suggesting that in the worst case no one 
>is going to add comments that are longer that 17 * 255 so you always set 
>page_segments to 0x11?  this must be the minimum expected because the 
>document says that the max is 255 * 255.  is the 'complex case'  when 
>comments get > 17 * 255?

It certainly doesn't always set page_segments to 0x11. That's just a 
particularly common case. The actual length of the comments won't
change this number in that page by more than +- 1, maybe 2. Most of
the complex cases are caused by long comment headers, but not all.

>
>
>can some one point me to the code were the page checksum is computed?  i 
>understand how to do checksums, but i would like to look at some code to 
>see exactly which bytes are being used to compute the checksum.  right now 
>i'm using byte 80 (where 'OggS' begins) to the 0x01 stop byte at the end of 
>the comments right before the 0x05 vorbis.  these must be the wrong bytes 
>cause my checksum is not correct.

Err... well, it's in ogg/src/framing.c, but you should really just be USING
this code, not reimplementing it. Superficially it might seem that this
is going to be easier. It won't be, you'd just end up having to rewrite 
most of libogg. 

You can just use vcedit directly, the license was changed to be flexible
enough that other people can do that. Then you only need to write the
high-level interface code, and vcedit actually takes care of doing all
the comment editing.

Michael

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list