[xiph-commits] r14770 - trunk/ogg-tools/oggmerge

ivo at svn.xiph.org ivo at svn.xiph.org
Thu Apr 17 10:50:44 PDT 2008


Author: ivo
Date: 2008-04-17 10:50:44 -0700 (Thu, 17 Apr 2008)
New Revision: 14770

Modified:
   trunk/ogg-tools/oggmerge/kate.c
   trunk/ogg-tools/oggmerge/midi.c
   trunk/ogg-tools/oggmerge/oggmerge.h
   trunk/ogg-tools/oggmerge/speex.c
   trunk/ogg-tools/oggmerge/theora.c
   trunk/ogg-tools/oggmerge/vorbis.c
Log:
Fix handling of -1 granpos in partial pages.  Patch by ogg.k.ogg.k.

Modified: trunk/ogg-tools/oggmerge/kate.c
===================================================================
--- trunk/ogg-tools/oggmerge/kate.c	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/kate.c	2008-04-17 17:50:44 UTC (rev 14770)
@@ -199,6 +199,7 @@
 	u_int64_t base, offset, stamp;
 	
 	if (kstate->granule_denominator == 0) return 0;
+	if (granulepos == -1) return -1;
 	
         base = granulepos>>kstate->granule_shift;
         offset = granulepos-(base<<kstate->granule_shift);

Modified: trunk/ogg-tools/oggmerge/midi.c
===================================================================
--- trunk/ogg-tools/oggmerge/midi.c	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/midi.c	2008-04-17 17:50:44 UTC (rev 14770)
@@ -332,6 +332,8 @@
 	u_int64_t timestamp;
 	ogg_int64_t gp = midistate->old_style?midistate->old_granulepos:granulepos;
 
+	if (gp == -1) return -1;
+
 	if (midistate->smtpe) {
 		timestamp = (double)gp * ((double)(midistate->frames * midistate->ticks) / (double)1000000);
 	} else {

Modified: trunk/ogg-tools/oggmerge/oggmerge.h
===================================================================
--- trunk/ogg-tools/oggmerge/oggmerge.h	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/oggmerge.h	2008-04-17 17:50:44 UTC (rev 14770)
@@ -9,7 +9,7 @@
 
 typedef struct {
 	ogg_page *og;
-	u_int64_t timestamp;
+	int64_t timestamp;
 } oggmerge_page_t;
 
 typedef struct {

Modified: trunk/ogg-tools/oggmerge/speex.c
===================================================================
--- trunk/ogg-tools/oggmerge/speex.c	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/speex.c	2008-04-17 17:50:44 UTC (rev 14770)
@@ -176,6 +176,7 @@
         ogg_int64_t gp=sstate->old_style?sstate->old_granulepos:granulepos;
 	
 	if (sstate->rate == 0) return 0;
+	if (gp == -1) return -1;
 	
 	stamp = (double)gp * (double)1000000 / (double)sstate->rate;
 

Modified: trunk/ogg-tools/oggmerge/theora.c
===================================================================
--- trunk/ogg-tools/oggmerge/theora.c	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/theora.c	2008-04-17 17:50:44 UTC (rev 14770)
@@ -164,6 +164,7 @@
         ogg_int64_t gp = tstate->old_style?tstate->old_granulepos:granulepos;
 	
 	if (tstate->fps_denominator == 0) return 0;
+	if (gp == -1) return -1;
 	
         iframe=gp>>tstate->granule_shift;
         pframe=gp-(iframe<<tstate->granule_shift);
@@ -191,7 +192,7 @@
 	page = (oggmerge_page_t *)malloc(sizeof(oggmerge_page_t));
 	page->og = _copy_ogg_page(og);
 	page->timestamp = -1;
-        if (ogg_page_granulepos(og)>=0)
+        //if (ogg_page_granulepos(og)>=0)
             page->timestamp = _make_timestamp(tstate, ogg_page_granulepos(og));
 	
 	// build theora page

Modified: trunk/ogg-tools/oggmerge/vorbis.c
===================================================================
--- trunk/ogg-tools/oggmerge/vorbis.c	2008-04-17 14:30:36 UTC (rev 14769)
+++ trunk/ogg-tools/oggmerge/vorbis.c	2008-04-17 17:50:44 UTC (rev 14770)
@@ -157,6 +157,7 @@
 	ogg_int64_t gp=vstate->old_style?vstate->old_granulepos:granulepos;
 	
 	if (vstate->samplerate == 0) return 0;
+	if (gp == -1) return -1;
 	
 	stamp = (double)gp * (double)1000000 / (double)vstate->samplerate;
 



More information about the commits mailing list