[vorbis-dev] granulepos start/end revisited
Arc Riley
arc at xiph.org
Tue May 18 07:14:38 PDT 2004
On Tue, May 18, 2004 at 05:49:35PM +1000, Andr? Pang wrote:
>
> A simple question (with a complex answer, no doubt): what's the
> rationale for having a start-time encoded granulepos? It adds (1)
> another dependency, and (2) the need for mode core to handle both start
> times and end times, which will also touch many parts of Ogg and
> possibly affect the code base of the codecs as well.
The answer is actually simple.
The whole definition of "continuous" is that one sample follows another
in a continuous stream of granules. You know that the endpos + 1 = the
startpos of the next page. You know that when you get a page of a
continuous stream with a granulepos of 59391 that it has enough data to
play from the granulepos of the previous page until this one.
Everything muxes well, and all is well with the world.
Then this Writ thing came along and smashed all the rules. With Writ,
the granules provided by one page may *GASP* overlap with the granules
of the next! What's more, a single page may span in time several
minutes into the future! If we order by end time, we'd have two
choices; we would either need to read ahead some absurd amount to make
sure we have enough data from the Writ stream to start displaying the
subtitles on time, or we would need to break Ogg by ordering the pages
by start-time while storing them with end-time granulepos (this is what
OggMIDI currently does).
There was a lengthy discussion about this last fall where the solution
was found. Change discontinuous streams to start-time ordering. When
compaired to a Vorbis or Theora stream, it's phrases will be in the
stream at exactly the right time and since Writ pages may overlap in
their durations, the end-time doesn't matter to Ogg anyways (only to
Writ, and the end-time is stored within the body of every data packet).
>From here the whole tangent of "well, should we ALSO switch all
continuous bitstreams too?". The answer is no, because that results in
less optimal muxing. Discontinuous streams don't matter for muxing
because they're, well atleast Writ is, very low bandwidth.
Hope this answers your question.
Check out Writ at http://wiki.xiph.org/OggWrit
--- >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