[Theora] Stream Test

illiminable ogg at illiminable.com
Fri Apr 7 21:54:30 PDT 2006

Also, you can't just compare the raw granule pos values, because they mean 
different things to different streams. In vorbis it's a sample number, in 
theora it's a bit different, each granule is 1 frame, but it actually splits 
the granule pos field, such that if you imagine it being nnnnnnnnnnn ddddd , 
where n is the frame number of the last keyframe, and d is the number of 
frames since the last keyframe, and the number bits allocated to d is in the 
theora header.

You have to convert the granules to a real time, and compare those. Another 
thing you have to watch out of when muxing, is the rules about headers and 
header ordering, in that

1) you have to make sure all headers for all streams appear before any data 
in any stream.
2) Your algorithm has to be able to handle the case where -1 is the granule 
3) theora bos header has to appear before vorbis bos header
4) All pages with header packets have granule pos 0
5) All pages with no packets completing on them have granule pos -1

Other things to watch for especially if the stream is generated on the fly, 
because the pages have to be in order, you have to make sure that any 
streams that are providing pages have at least one page, or they are at the 
end of stream. Otherwise if one stream generates data faster than the other, 
and only one of two streams has available data then you have to make sure 
you don't just write the page from the stream with data, since it wil appear 
tp be the earliest page, but then when a page arrives on the other stream, 
it's too late to compare it with the page you already wrote.

The exception being you have to keep track of the end of stream, since you 
don't want your algorithm to block while it waits for a page on stream which 
is never going to arrive, because that stream is already finished.

And also, an update from my previous report about wmp... since then i tried 
a bit more and it crashed a few times, sometimes it did sometimes, but that 
could be because the files are out of order, it's not as resiliant to bad 
files as say vlc. Will try again once the stream is correct.


----- Original Message ----- 
From: "Robert Smith" <rob at visonair.tv>
To: <theora at xiph.org>
Sent: Saturday, April 08, 2006 6:05 AM
Subject: Re: [Theora] Stream Test

> Never mind, forgot about ogg_page_granulepos()
> lol
> ----- Original Message -----
>> Still having problems with this algorithm.
>> I presume I should call vorbis_granule_time() and theora_granule_time() 
>> on the first packet I write to each page to get the start timestamp for 
>> each page for sorting?  Or should I be woring with sorting at packet 
>> level?
> _______________________________________________
> Theora mailing list
> Theora at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora

More information about the Theora mailing list