[xiph-commits] r3207 - libannodex/trunk/src/importers

shans at svn.annodex.net shans at svn.annodex.net
Tue Aug 28 20:00:50 PDT 2007


Author: shans
Date: 2007-08-28 20:00:50 -0700 (Tue, 28 Aug 2007)
New Revision: 3207

Modified:
   libannodex/trunk/src/importers/anx_import_ogg.c
Log:
modified packet check to not select theora headers as keyframes
cleaned up debug message a bit, added some



Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c	2007-08-29 01:05:37 UTC (rev 3206)
+++ libannodex/trunk/src/importers/anx_import_ogg.c	2007-08-29 03:00:50 UTC (rev 3207)
@@ -256,8 +256,16 @@
 
   if (aod->use_granule_seek) {
     seek_offset = aod->min_granule_seek;
+#ifdef DEBUG
+    fprintf(aod->df, "anxogg_seek_update: using min_granule_seek %f\n", 
+                seek_offset);
+#endif
   } else {
     seek_offset = source->start_time;
+#ifdef DEBUG
+    fprintf(aod->df, "anxogg_seek_update: using start time %f\n", 
+                seek_offset);
+#endif
   }
   seek_offset -= 1.0;
   if (seek_offset < 0.0) seek_offset = 0.0;
@@ -324,8 +332,9 @@
         aod->cmml_granuleshift = 0;
 
 #ifdef DEBUG
-      printf("read_packet_headers: setting cmml_need_keygranule to %d\n",
-                      aod->cmml_granuleshift != 0);
+      fprintf(aod->df, 
+                  "read_packet_headers: setting cmml_need_keygranule to %d\n",
+                  aod->cmml_granuleshift != 0);
 #endif
       if (aod->cmml_granuleshift == 0)
         aod->cmml_need_keygranule = 0;
@@ -421,7 +430,8 @@
            aod->cmml_serialno = serialno;
            aod->cmml_granuleshift = 0;
 #ifdef DEBUG
-           printf("read_packet_headers: setting need_keygranule to 0\n");
+           fprintf(aod->df,
+                      "read_packet_headers: setting need_keygranule to 0\n");
 #endif
 	         aod->cmml_need_keygranule = 0;
 	      }
@@ -573,7 +583,7 @@
 
   /* XXX: TRUE if a theora from a keyframe, even if no granulepos */
   if (!strcmp (track->content_type, THEORA_CONTENT_TYPE) &&
-      op->bytes > 0 && !(op->packet[0] & 0x40)) {
+      op->bytes > 0 && !(op->packet[0] & 0xC0)) {
 #ifdef DEBUG
     fprintf (aod->df,
 	     "anxogg::FILTER got Theora keyframe\n");
@@ -853,6 +863,9 @@
 
     iframe = granulepos >> aod->cmml_granuleshift;
     cmml_keygranule = iframe << aod->cmml_granuleshift;
+#ifdef DEBUG
+    fprintf(aod->df, "cmml_keygranule is %llx\n", cmml_keygranule);
+#endif
 
     offset = gp_to_time (aod->oggz, serialno, cmml_keygranule);
     if (aod->min_granule_seek == 0.0 || offset < aod->min_granule_seek)
@@ -862,7 +875,6 @@
     aot = (AnxOggTrack *) oggz_table_lookup (aod->logicals, serialno);
     if (aot == NULL) {
       /* If this track is not in the table, ignore it. */
-      printf("NULL aot\n");
       return OGGZ_STOP_OK;
     }
 
@@ -878,8 +890,8 @@
       start_time = aod->anx_source->start_time;
       offset = gp_to_time (aod->oggz, serialno, granulepos);
 #ifdef DEBUG
-      printf("offset %f start_time %f TOLERANCE %f\n", offset, start_time,
-                      TOLERANCE);
+      fprintf(aod->df, "offset %f start_time %f TOLERANCE %f\n", offset, 
+                      start_time, TOLERANCE);
 #endif
       if (offset-TOLERANCE <= start_time) {
         return OGGZ_STOP_OK;
@@ -894,10 +906,14 @@
       
       offset = gp_to_time (aod->oggz, serialno, aot->keygranule);
       aot->keygranule_time = offset;
-      if (aod->min_granule_seek == 0.0 || offset < aod->min_granule_seek)
+      if (aod->min_granule_seek == 0.0 || offset < aod->min_granule_seek) {
         aod->min_granule_seek = offset;
-      
 #ifdef DEBUG
+        fprintf (aod->df, "set min_granule_seek to %f\n", 
+                            aod->min_granule_seek);
+#endif 
+      }
+#ifdef DEBUG
       fprintf (aod->df,
 	      "read_page_granuleinfo: ^^^ has keygranule "
         "%lld (%lld|0) (%f seconds) (granuleshift %d)\n",
@@ -942,7 +958,7 @@
 
   if (end_time == -1.0) {
 #ifdef DEBUG
-    printf("calling oggz_seek with whence of %d\n", SEEK_END);
+    fprintf(aod->df, "calling oggz_seek with whence of %d\n", SEEK_END);
 #endif
     end_offset = oggz_seek (aod->oggz, 0, SEEK_END);
 #ifdef DEBUG
@@ -974,6 +990,9 @@
 
   units = (ogg_int64_t)(SUBSECONDS * start_time);
   units_at = oggz_seek_units (aod->oggz, units, SEEK_SET);
+#ifdef DEBUG
+  fprintf(aod->df, "oggz_seek_units on %lld returned %lld\n", units, units_at);
+#endif
   if (units_at == -1) {
 #ifdef DEBUG
     fprintf (aod->df, "anxogg_setup: oggz_seek_units start FAIL\n");



More information about the commits mailing list