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

conrad at svn.annodex.net conrad at svn.annodex.net
Wed Oct 29 04:06:15 PDT 2008


Author: conrad
Date: 2008-10-29 04:06:15 -0700 (Wed, 29 Oct 2008)
New Revision: 3749

Modified:
   libannodex/trunk/src/importers/anx_import_ogg.c
Log:
anx_import_ogg: rename media_packets to delivery_queue throughout,
in preparation for adding more queues


Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c	2008-10-29 11:06:10 UTC (rev 3748)
+++ libannodex/trunk/src/importers/anx_import_ogg.c	2008-10-29 11:06:15 UTC (rev 3749)
@@ -148,7 +148,7 @@
   /* Maintain a list of AnxOggTracks */
   OggzTable * logicals;
 
-  AnxList * media_packets;
+  AnxList * delivery_queue;
   long current_offset; /* offset into current packet */
 
   AnxImportCMML import_cmml;
@@ -394,22 +394,13 @@
 
       if (need_insert) {
 	oggz_table_insert (aod->logicals, serialno, aot);
-
-#ifdef DEBUG
-	fprintf (aod->df,
-		 "anxogg::read_packet_headers: Added track for (%010ld): %ld/%ld, +%d headers\n",
-		 serialno,
-		 (long)track->granule_rate_n, (long)track->granule_rate_d,
-		 (int)track->nr_header_packets);
-#endif
       }
 
       /* XXX: fix this for theora */
       if (track->granule_rate_n != 0 && track->granule_rate_d != 0) {
 	if (m->start_time != 0.0) {
 	  track->start_granule =
-	    m->start_time * track->granule_rate_n /
-	    track->granule_rate_d;
+	    m->start_time * track->granule_rate_n / track->granule_rate_d;
 	} else {
 	  track->start_granule = 0;
 	}
@@ -419,23 +410,19 @@
 	    m->end_time * track->granule_rate_n / track->granule_rate_d;
 #ifdef DEBUG
 	  fprintf (aod->df, "anxogg::read_packet_headers: end_granule %lld\n",
-		  track->end_granule);
+                   track->end_granule);
 #endif
 	}
       }
 
       if (need_insert) {
-#ifdef DEBUG
-	fprintf (aod->df,
-		 "anxogg::read_packet_headers: adding track for %s\n", track->content_type);
-#endif
 	m->tracks = anx_list_append (m->tracks, track);
       } else {
         anx_free (aot);
         aot = NULL;
       }
     }
-  } else {
+  } else /* !op->b_o_s */ {
     if (op->e_o_s && serialno == aod->skeleton_serialno) {
       aod->got_skeleton_eos = 1;
     }
@@ -800,7 +787,7 @@
 
  do_read:
 
-  while ((aod->media_packets == NULL) && (oggz_read (aod->oggz, 1024)) != 0);
+  while ((aod->delivery_queue == NULL) && (oggz_read (aod->oggz, 1024)) != 0);
 
   if (aod->need_seek == NEED_SEEK && aod->nr_headers_remaining == 0) {
     anxogg_seek_update (media);
@@ -1013,7 +1000,7 @@
                              ((double)oggz_tell_units(oggz)) / SUBSECONDS);
     memcpy (aop->data, op->packet, op->bytes);
     
-    aod->media_packets = anx_list_append (aod->media_packets, aop);
+    aod->delivery_queue = anx_list_append (aod->delivery_queue, aop);
     
     if (aot->nr_headers_remaining > 0) {
       aod->nr_headers_remaining--;
@@ -1060,7 +1047,7 @@
 
   anxogg_read_update (media);
 
-  head = aod->media_packets;
+  head = aod->delivery_queue;
   if (head == NULL) {
     media->eos = 1;
     return 0;
@@ -1088,8 +1075,7 @@
 
   /* If that's finished this media packet, advance to the next one */
   if (aod->current_offset >= aop->length) {
-    aod->media_packets =
-      anx_list_remove (aod->media_packets, head);
+    aod->delivery_queue = anx_list_remove (aod->delivery_queue, head);
 
     aop = anxogg_packet_free (aop);
     anx_free (head);
@@ -1098,8 +1084,8 @@
 
     anxogg_read_update (media);
 
-    if (aod->media_packets != NULL)
-      aop = (AnxOggPacket *)aod->media_packets->data;
+    if (aod->delivery_queue != NULL)
+      aop = (AnxOggPacket *)aod->delivery_queue->data;
   }
 
   /* Set current time to the current time of the next packet that would
@@ -1119,14 +1105,14 @@
 
   if (aod->ignore_media) return -1;
 
-  while ((aod->media_packets == NULL) && (oggz_read (aod->oggz, 1024)) != 0);
+  while ((aod->delivery_queue == NULL) && (oggz_read (aod->oggz, 1024)) != 0);
 
-  if (aod->media_packets == NULL) {
+  if (aod->delivery_queue == NULL) {
     media->eos = 1;
     return 0;
   }
 
-  aop = (AnxOggPacket *)aod->media_packets->data;
+  aop = (AnxOggPacket *)aod->delivery_queue->data;
   bytes_to_read = aop->length - aod->current_offset;
 
   return bytes_to_read;
@@ -1172,7 +1158,7 @@
   aod->got_end = 0;
   aod->logicals = oggz_table_new ();
 
-  aod->media_packets = NULL;
+  aod->delivery_queue = NULL;
   aod->current_offset = 0;
 
   aod->import_cmml = NULL;
@@ -1257,7 +1243,7 @@
 
   oggz_close (aod->oggz);
 
-  anx_list_free_with (aod->media_packets, (AnxFreeFunc)anxogg_packet_free);
+  anx_list_free_with (aod->delivery_queue, (AnxFreeFunc)anxogg_packet_free);
 
   n = oggz_table_size (aod->logicals);
   for (i = 0; i < n; i++) {



More information about the commits mailing list