[vorbis-dev] some (basic?) development questions...

Michael Plump plumpy at skylab.org
Tue May 16 03:25:41 PDT 2000



Pardon my ignorance, as I just started playing with Ogg stuff a few days
ago, but I'd appreciate some help if someone has time...

I was trying to write a very basic comment editor for Ogg Vorbis files.  I
think I mostly have it working, but it seems to output slightly broken
streams.

Here's a basic overview of what I'm doing; could someone tell me if I've
got the right basic idea?

Basically because the all the packets are variable-width, I (AFAIK) need
to read out all the packets one at a time, replacing the second (comment
header) packet with the new comments.  All the other packets can stay
exactly the same.  I read the packets out of one ogg stream, and feed them
into a second ogg stream, grabbing pages from the second stream as I get
them and writing them to disk.  Then I move the new file into place where
the old file was.

It's a little ugly, but I can't think of any other way to do it.

If I knew the second or third header was going to fall on a page boundary,
I could figure out how long the header pages were in the first file, then
figure out how long the header pages were in the new stream, then expand
or contract the original file to match and overwrite the header pages.  
That would probably be a classier way of doing it, but since I am probably
screwing with the page boundaries by changing the comment header, that
won't work, and my two file approach is apparently the only way to do it.

Can anyone tell me if the above assumptions are correct?  If they are I
can show you a few lines of pseudocode and hopefully you could tell me
what I'm doing wrong...

Thanks for any help you can offer...

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list