[FFmpeg-devel] [PATCH] Enforce ogg granule position monotonicity
Sun Feb 15 01:34:34 CET 2009
On Feb 14, 2009, at 7:01 PM, Alex Converse wrote:
> I'm new to Ogg but had problems with certain streams seeming to loop
> forever. These streams were corrupted and had negative granule
> positions. See inf-loop.ogv. This patch adds a gp sanity check to
> Here is what I know for sure:
> *"The Granule Position is a signed 64 bit field appearing in the
> header of every Ogg page."  (The fact that gp variables in ffmpeg
> are almost always uint64_t bothers me.)
> *"Granule Position must always increase forward or remain equal from
> page to page, be unset, or be zero for a header page. The absolute
> time to which any correct sequence of granule position maps must
> similarly always increase forward or remain equal." Ibid.
Given that the header pages are at the start of a stream (with a
granule of 0), how can later pages have a negative granule, given that
they cannot decrease? The special '-1' case is just the simplest way
to say all 64 bits are 1 (as opposed to saying 0xFFFFFFFFFFFFFFFF).
> *"A special value of '-1' (in two's complement) indicates that no
> packets finish on this page." 
> *Libtheora rejects negative granule positions 
> What I am uncertain of is what the implications of "unset" are.
>  http://www.xiph.org/ogg/doc/ogg-multiplex.html
>  http://www.xiph.org/ogg/doc/framing.html
>  http://libtheora.sourcearchive.com/documentation/1.0~beta3/
> Your thoughts would be greatly appreciated, but I know no one here
> likes Ogg and don't want to get a lot of whining about how
> "broken"/"strange"/"ass backwards" it is.
> Alex Converse
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
More information about the ffmpeg-devel