[Theora-dev] Dropped / Duplicate Frames
Ralph Giles
giles at xiph.org
Fri Mar 10 19:17:35 PST 2006
On Sat, Mar 11, 2006 at 12:43:37AM +0000, Philip Heron wrote:
> Nudging off-topic, the libogg API pages at xiph.org seem to have gotten
> mixed up or corrupted. For example parts of the page for
> ogg_stream_pageout() seems to be describing ogg_stream_pagein().
I think that's just a long-standing cut and paste error. I'll clean up
the text.
> What I was actually looking for was who owns the memory the ogg_page
> structure points to after a call to ogg_stream_pageout()? I'd like to
> keep a copy of the initial pages for saving parts of the live stream to
> a local file later.
libogg owns the memory. The header is a pointer into storage in the
ogg_stream_state structure, and the body is an internal working buffer.
Basically, ogg_stream_packetin() memcpy()s each successive packet
body consecutively into this internal buffer, and then
ogg_stream_pageout() checks to see if there's enough data to complete a
page, then fills out the header and hands back a pointer to the start
of that data buffer. So the pointers filled out in the ogg_page
structure are valid until the next call to ogg_stream_packetin() for
the body data, and the next call to ogg_stream_pageout() (or _flush())
for the header.
So, if you want to keep the pages around, you have to write a
my_ogg_page_copy() routine to allocate new storage and copy
the header and body data into it.
Or you could help beta test libogg2 which passes you a refcounted
handle instead. :)
HTH,
-r
More information about the Theora-dev
mailing list