[cvs-annodex] commit (/annodex): libannodex/trunk/src/importers/anx_import_ogg.c

conrad nobody at lists.annodex.net
Fri Apr 1 15:41:51 EST 2005


Update of /annodex (new revision 1200)

Modified files:
   libannodex/trunk/src/importers/anx_import_ogg.c

Log Message:
anx_import_ogg: When importing from exactly the time of a clip, don't include
any clips prior to it.
	* For content using CMML granuleshift, don't try to include the
keygranule if there is a clip right at the start_time.
	* For content not using CMML granuleshift, simply drop all clips
prior to the start_time.

Closes ticket:97


Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c	2005-03-31 04:42:43 UTC (rev 1199)
+++ libannodex/trunk/src/importers/anx_import_ogg.c	2005-04-01 05:41:51 UTC (rev 1200)
@@ -612,6 +612,14 @@
 		header[1], header[2], header[3], header[4], at_time);
       }
 #endif
+
+      /* If this content doesn't use cmml_granuleshift, and this clip is
+       * before the start_time, drop it */
+      if (aod->cmml_granuleshift == 0 &&
+	  at_time < aod->anx_source->start_time-TOLERANCE) {
+	return OGGZ_STOP_OK;
+      }
+
       if (aod->import_cmml)
 	aod->import_cmml ((char *)op->packet, op->bytes, at_time,
 			  aod->import_user_data);
@@ -744,7 +752,7 @@
   AnxSourceTrack * track = NULL;
   ogg_int64_t granulepos, iframe, pframe;
   ogg_int64_t cmml_keygranule;
-  double offset;
+  double offset, start_time;
 
 #ifdef DEBUG
   fprintf (aod->df, "read_page_granuleinfo: track %010ld\n", serialno);
@@ -755,9 +763,19 @@
   if (aod->cmml_serialno != -1 && serialno == aod->cmml_serialno) {
     if (!aod->cmml_need_keygranule) return OGGZ_STOP_OK;
 
+    aod->cmml_need_keygranule = 0;
+
+    /* If this content does use cmml_granuleshift, and this clip is right at
+     * the start time, there's no need to include the clip previous to this.
+     */
+    start_time = aod->anx_source->start_time;
+    offset = gp_to_time (aod->oggz, serialno, granulepos);
+    if (offset-TOLERANCE <= start_time) {
+      return OGGZ_STOP_OK;
+    }
+
     iframe = granulepos >> aod->cmml_granuleshift;
     cmml_keygranule = iframe << aod->cmml_granuleshift;
-    aod->cmml_need_keygranule = 0;
 
     offset = gp_to_time (aod->oggz, serialno, cmml_keygranule);
     if (aod->min_granule_seek == 0.0 || offset < aod->min_granule_seek)


-- 
conrad



More information about the cvs-annodex mailing list