[xiph-commits] r3221 - in libannodex/trunk/src: importers libannodex tools

shans at svn.annodex.net shans at svn.annodex.net
Mon Sep 3 23:59:30 PDT 2007


Author: shans
Date: 2007-09-03 23:59:29 -0700 (Mon, 03 Sep 2007)
New Revision: 3221

Modified:
   libannodex/trunk/src/importers/anx_import_ogg.c
   libannodex/trunk/src/libannodex/anx_write.c
   libannodex/trunk/src/tools/anxed.c
Log:
per-track initial data cutoffs for imported ogg files



Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c	2007-09-03 13:32:10 UTC (rev 3220)
+++ libannodex/trunk/src/importers/anx_import_ogg.c	2007-09-04 06:59:29 UTC (rev 3221)
@@ -110,6 +110,7 @@
   ogg_int64_t keygranule;
   double keygranule_time;
   int filter_got_keygranule;
+  int nr_headers_remaining;
 };
 
 struct _AnxOggData {
@@ -457,6 +458,8 @@
 
       aod->nr_headers_remaining += track->nr_header_packets;
       aod->headers_unread += track->nr_header_packets;
+      
+      aot->nr_headers_remaining = track->nr_header_packets;
 
       if (track->granuleshift > 0) {
         aod->use_granule_seek = 1;
@@ -545,8 +548,8 @@
 }
 
 static int
-filter (AnxOggData * aod, AnxOggTrack * aot, long serialno, ogg_packet * op)
-{
+filter (AnxOggData * aod, AnxOggTrack * aot, long serialno, ogg_packet * op) {
+
   AnxSourceTrack * track = &(aot->source_track);
   double timestamp;
 
@@ -575,7 +578,13 @@
   /* TRUE if we're beyond the keygranule for this track */
   if (aot->filter_got_keygranule) return 1;
 
+  if (op->granulepos >= aot->keygranule) {
+    aot->filter_got_keygranule = 1;
+    return 1;
+  }
+
   /* TRUE if we're after the keygranule time */
+#if 0
   if (op->granulepos != -1 && timestamp+TOLERANCE >= aot->keygranule_time) {
     aot->filter_got_keygranule = 1;
     return 1;
@@ -593,6 +602,8 @@
     return 1;
   }
 
+#endif
+
   /* FALSE otherwise */
   return 0;
 
@@ -743,9 +754,10 @@
     memcpy (aop->data, op->packet, op->bytes);
     
     aod->media_packets = anx_list_append (aod->media_packets, aop);
-
-    if (aod->nr_headers_remaining > 0) {
+    
+    if (aot->nr_headers_remaining > 0) {
       aod->nr_headers_remaining--;
+      aot->nr_headers_remaining--;
 
 #ifdef DEBUG
       fprintf (aod->df,

Modified: libannodex/trunk/src/libannodex/anx_write.c
===================================================================
--- libannodex/trunk/src/libannodex/anx_write.c	2007-09-03 13:32:10 UTC (rev 3220)
+++ libannodex/trunk/src/libannodex/anx_write.c	2007-09-04 06:59:29 UTC (rev 3221)
@@ -44,7 +44,7 @@
 #include "anx_private.h"
 #include "anx_snprint.h" /* anx_strdup */
 
-// #define DEBUG
+/* #define DEBUG */
 
 /* set to 0 or 1 */
 #define FLUSH_ALWAYS 0

Modified: libannodex/trunk/src/tools/anxed.c
===================================================================
--- libannodex/trunk/src/tools/anxed.c	2007-09-03 13:32:10 UTC (rev 3220)
+++ libannodex/trunk/src/tools/anxed.c	2007-09-04 06:59:29 UTC (rev 3221)
@@ -41,7 +41,7 @@
 
 #include "common.h"
 
-#define DEBUG
+/*#define DEBUG*/
 
 #define ANX_CONTENT_TYPE "application/x-annodex"
 
@@ -204,9 +204,11 @@
   }
 
   while ((n = anx_write (anx, 1024)) > 0);
+#ifdef DEBUG
   if (n < 0) {
     printf("ERROR: %ld\n", n);
   }
+#endif
 
   if (anx_close (anx) != NULL) {
     fprintf (stderr, "Failed close of annodex\n");



More information about the commits mailing list