Commit 631d1121 authored by Monty Montgomery's avatar Monty Montgomery Committed by conrad

Fix starting frame numbers for Theora

The correction for different starting frame numbers on early Theora streams
was backward, resulting in the timestamp calculation being off by a frame
on all stream version. This was causing oggz-sort and oggz-merge to mis-mux
streams (which oggz-validate was catching properly)
parent 331edd6b
......@@ -174,8 +174,15 @@ auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void
OGGZ_AUTO_MULT * (ogg_int64_t)fps_denominator);
oggz_set_granuleshift (oggz, serialno, keyframe_shift);
if (version > THEORA_VERSION(3,2,0))
oggz_set_first_granule (oggz, serialno, 1);
/* the theora granpos->time calculation always adds one to the
index, but 3.2.0 streams count from zero and later versions count
from one. So... for a 3.2.0 stream, the intitial frame number is
zero, but we add one (or in this case, subtract -1 in
oggz_metric_default_granuleshift). For 3.2.1 and later, we
subtract one from the first frame number (1) to get an initial index
of zero, then add one to compute time for a net change of zero */
if (version < THEORA_VERSION(3,2,0))
oggz_set_first_granule (oggz, serialno, -1);
oggz_stream_set_numheaders (oggz, serialno, 3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment