[Vorbis-dev] ogg encoding
Stephen Whiters-Ridley
s7ephen at gmail.com
Wed Jun 7 18:43:12 PDT 2006
ok, I know its faux pas to post code snippets but will pseudo code be ok? I
am not quite sure if I fully understand the logic of how this is suppose d
to work. I assumed that from a design perspective developers dont need to
manipulate the page structures, just to submit packets to them, test if they
were full, and if they were flush them. Is this a correct assumption?
Here is essentially what I am trying.
while (amtread = fread(readbuf, file)){
ogg_packet.bytes = amtread
if first_read_from_file then
ogg_packet.b_o_s = 1
if amtread < PACKETSIZE then
ogg_packet.e_o_s = 1
ogg_packet.packet = readbuf
ogg_stream_packetin()
if (ogg_stream_pageout()) then
write_page_to_file()
elseif (amtread < PACKETSIZE) then
ogg_stream_flush() and write_page_to_file()
}
On 6/7/06, Ralph Giles <giles at xiph.org> wrote:
>
> On Wed, Jun 07, 2006 at 06:21:23PM -0400, Stephen Whiters-Ridley wrote:
> > I was wondering. When doing ogg only encoding, how do you mark end of
> > stream? I am setting ogg_packet.e_o_s and then submitting it via
> > ogg_stream_packetin() and then, because
> > its the last potential page ogg_stream_flush()ing it. But when I walk
> > through the file, EOS is not set on that logical bitstream.
>
> That sounds about right. Of course with the encoders, you pass 'last=1'
> when you submit the last bit of uncompressed data and it should set the
> eos flag in the ogg_packet structure itself.
>
> One idea: are you looping over your ogg_stream_flush() in case it has
> multiple pages of data to return. That might explian why you're not
> seeing the flag, especially if you also forgot to loop on
> ogg_stream_pageout(). :-)
>
> FWIW,
> -r
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20060607/4a888001/attachment.html
More information about the Vorbis-dev
mailing list