[xiph-commits] r3621 - liboggz/trunk/src/tools

conrad at svn.annodex.net conrad at svn.annodex.net
Sun Jun 29 19:54:30 PDT 2008


Author: conrad
Date: 2008-06-29 19:54:29 -0700 (Sun, 29 Jun 2008)
New Revision: 3621

Modified:
   liboggz/trunk/src/tools/oggzinfo.c
Log:
oggzinfo: take the Presentation-Time reported in skeleton into account
when calculating the Content-Duration


Modified: liboggz/trunk/src/tools/oggzinfo.c
===================================================================
--- liboggz/trunk/src/tools/oggzinfo.c	2008-06-29 14:22:40 UTC (rev 3620)
+++ liboggz/trunk/src/tools/oggzinfo.c	2008-06-30 02:54:29 UTC (rev 3621)
@@ -441,7 +441,9 @@
 static int
 oi_pass1 (OGGZ * oggz, OI_Info * info)
 {
-  long n;
+  long n, serialno;
+  int ntracks, i;
+  OI_TrackInfo * oit;
 
   oggz_seek (oggz, 0, SEEK_SET);
   oggz_set_read_page (oggz, -1, read_page_pass1, info);
@@ -451,6 +453,19 @@
 
   oggzinfo_apply (oit_calc_average, info);
 
+  /* Now we are at the end of the file, calculate the duration */
+  info->duration = oggz_tell_units (oggz);
+
+  /* Find the Skeleton track if present, and subtract the presentation time */
+  ntracks = oggz_table_size (info->tracks);
+  for (i = 0; i < ntracks; i++) {
+    oit = oggz_table_nth (info->tracks, i, &serialno);
+    if (oit->has_fishead) {
+      info->duration -= 1000 * oit->fhInfo.ptime_n / oit->fhInfo.ptime_d;
+      break;
+    }
+  }
+
   return 0;
 }
 
@@ -597,8 +612,6 @@
     
     oi_pass1 (oggz, &info);
 
-    info.duration = oggz_tell_units (oggz);
-    
     oi_pass2 (oggz, &info);
     
     /* Print summary information */



More information about the commits mailing list