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

conrad at svn.annodex.net conrad at svn.annodex.net
Thu Jul 3 23:57:44 PDT 2008


Author: conrad
Date: 2008-07-03 23:57:42 -0700 (Thu, 03 Jul 2008)
New Revision: 3623

Modified:
   liboggz/trunk/src/tools/oggzinfo.c
Log:
oggzinfo: Display % overhead of Ogg framing for each track.
Patch by ogg.k.ogg.k


Modified: liboggz/trunk/src/tools/oggzinfo.c
===================================================================
--- liboggz/trunk/src/tools/oggzinfo.c	2008-06-30 10:57:10 UTC (rev 3622)
+++ liboggz/trunk/src/tools/oggzinfo.c	2008-07-04 06:57:42 UTC (rev 3623)
@@ -53,7 +53,7 @@
 #define READ_BLOCKSIZE 1024000
 
 static void
-usage (char * progname)
+usage (const char * progname)
 {
   printf ("Usage: %s [options] filename ...\n", progname);
   printf ("Display information about one or more Ogg files and their bitstreams\n");
@@ -97,6 +97,7 @@
   OggzTable * tracks;
   ogg_int64_t duration;
   long length_total;
+  long overhead_length_total;
 };
 
 struct _OI_Stats {
@@ -105,6 +106,7 @@
   long length_total;
   long length_min;
   long length_max;
+  long overhead_length_total;
 
   /* Pass 2 */
   long length_avg;
@@ -151,6 +153,7 @@
   stats->length_total = 0;
   stats->length_min = LONG_MAX;
   stats->length_max = 0;
+  stats->overhead_length_total = 0;
 
   stats->length_avg = 0;
   stats->length_deviation_total = 0;
@@ -255,9 +258,10 @@
   } else {
     printf ("\n???: serialno %010ld\n", serialno);
   }
-  printf ("\t%ld packets in %ld pages, %.1f packets/page\n",
+  printf ("\t%ld packets in %ld pages, %.1f packets/page, %.3f%% Ogg overhead\n",
 	  oit->packets.count, oit->pages.count,
-	  (double)oit->packets.count / (double)oit->pages.count);
+	  (double)oit->packets.count / (double)oit->pages.count,
+          oit->pages.length_stddev == 0 ? 0.0 : 100.0*oit->pages.overhead_length_total/oit->pages.length_total);
 
   if (show_length) {
     fputs("\tContent-Length: ", stdout);
@@ -351,6 +355,7 @@
 
   /* Increment the total stream length */
   info->length_total += bytes;
+  info->overhead_length_total += og->header_len;
 
   /* Increment the page statistics */
   oit->pages.count++;
@@ -359,6 +364,7 @@
     oit->pages.length_min = bytes;
   if (bytes > oit->pages.length_max)
     oit->pages.length_max = bytes;
+  oit->pages.overhead_length_total += og->header_len;
 
   return 0;
 }
@@ -609,6 +615,7 @@
     info.oggz = oggz;
     info.tracks = oggz_table_new ();
     info.length_total = 0;
+    info.overhead_length_total = 0;
     
     oi_pass1 (oggz, &info);
 



More information about the commits mailing list