Re: Two mux-fix patches against current liboggz
Monty Montgomery <[email protected]>
| Newsgroups | gmane.comp.multimedia.ogg.theora.general |
|---|---|
| Message-ID | <AANLkTi=YV_4bQ1CkC10fQ=fwEjkX5B+rnYhYpaDhd5CQ__35060.5601481677$1289741715$gmane$org@mail.gmail.com> |
Oops, patch two had a small bug where it only worked properly when --verbose was set. Here is an amended version. Monty _______________________________________________ theora mailing list [email protected] http://lists.xiph.org/mailman/listinfo/theora
0001-The-correction-for-different-starting-frame-numbers-.patch
(text/x-c, 1.6 KB)
From 142efb04e59a1666abf90ff6838d20e70f29e17d Mon Sep 17 00:00:00 2001 From: root <root@fishcore.(none)> Date: Sun, 19 Sep 2010 05:02:37 -0400 Subject: [PATCH 1/2] 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) --- src/liboggz/oggz_auto.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/liboggz/oggz_auto.c b/src/liboggz/oggz_auto.c index e7eba10..e477c0d 100644 --- a/src/liboggz/oggz_auto.c +++ b/src/liboggz/oggz_auto.c @@ -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); -- 1.6.3.1
0002-oggz-sort-would-miss-an-input-on-an-iteration-in-whi.patch
(text/x-c, 1.3 KB)
From 9ca31bb3797faee0e0b5d333cd44007237639c89 Mon Sep 17 00:00:00 2001
From: root <root@fishcore.(none)>
Date: Sun, 19 Sep 2010 05:04:26 -0400
Subject: [PATCH 2/2] oggz-sort would miss an input on an iteration in which a stream ends
and is removed from the stream table.
---
src/tools/oggz-sort.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/tools/oggz-sort.c b/src/tools/oggz-sort.c
index 7cc12bd..91889d3 100644
--- a/src/tools/oggz-sort.c
+++ b/src/tools/oggz-sort.c
@@ -334,11 +334,14 @@ oggz_sort (OSData * osdata, FILE * outfile)
if (osdata->verbose)
printf ("Moo\n");
}
- } else if (osdata->verbose) {
+ } else {
if (input == NULL) {
- printf ("*** index %d NULL\n", i);
+ if (osdata->verbose)
+ printf ("*** index %d NULL, removing\n", i);
+ i--;
} else {
- printf ("*** No page from index %d\n", i);
+ if (osdata->verbose)
+ printf ("*** No page from index %d\n", i);
}
}
}
@@ -351,6 +354,7 @@ oggz_sort (OSData * osdata, FILE * outfile)
if (min_i != -1) {
input = (OSInput *) oggz_table_nth (osdata->inputs, min_i, &key);
og = input->og;
+
checked_fwrite (og->header, 1, og->header_len, outfile);
checked_fwrite (og->body, 1, og->body_len, outfile);
--
1.6.3.1