[xiph-commits] r11696 - trunk/theora-exp/examples

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Jul 6 15:34:41 PDT 2006


Author: xiphmont
Date: 2006-07-06 15:34:39 -0700 (Thu, 06 Jul 2006)
New Revision: 11696

Modified:
   trunk/theora-exp/examples/dump_video.c
Log:
Modify fps dumping code to use posix time calls



Modified: trunk/theora-exp/examples/dump_video.c
===================================================================
--- trunk/theora-exp/examples/dump_video.c	2006-07-06 21:18:02 UTC (rev 11695)
+++ trunk/theora-exp/examples/dump_video.c	2006-07-06 22:34:39 UTC (rev 11696)
@@ -27,7 +27,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/time.h>
+#include <sys/timeb.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 /*Yes, yes, we're going to hell.*/
@@ -40,8 +40,6 @@
 #include "getopt.h"
 #include "theora/theoradec.h"
 
-
-
 const char *optstring = "o:rf";
 struct option options [] = {
   {"output",required_argument,NULL,'o'},
@@ -179,9 +177,9 @@
   FILE *infile = stdin;
   outfile = stdout;
 
-  struct timeval start;
-  struct timeval after;
-  struct timeval last;
+  struct timeb start;
+  struct timeb after;
+  struct timeb last;
   int fps_only=0;
 
 #ifdef _WIN32 /* We need to set stdin/stdout to binary mode on windows. */
@@ -352,8 +350,8 @@
   }
 
   if(fps_only){
-    gettimeofday(&start,NULL);
-    gettimeofday(&last,NULL);
+    ftime(&start);
+    ftime(&last);
   }
 
   while(!got_sigint){
@@ -367,7 +365,7 @@
           videobuf_ready=1;
           frames++;
 	  if(fps_only)
-	    gettimeofday(&after,NULL);
+	    ftime(&after);
         }
 	
       }else
@@ -376,16 +374,16 @@
 
     if(fps_only && (videobuf_ready || fps_only==2)){
       long ms = 
-	after.tv_sec*1000.+after.tv_usec*.001-
-	(last.tv_sec*1000.+last.tv_usec*.001);
+	after.time*1000.+after.millitm-
+	(last.time*1000.+last.millitm);
       
       if(ms>500 || fps_only==1 || 
 	 (feof(infile) && !videobuf_ready)){
 	float file_fps = (float)ti.fps_numerator/ti.fps_denominator;
 	fps_only=2;
 	
-	ms = after.tv_sec*1000.+after.tv_usec*.001-
-	  (start.tv_sec*1000.+start.tv_usec*.001);
+	ms = after.time*1000.+after.millitm-
+	  (start.time*1000.+start.millitm);
 	
 	fprintf(stderr,"\rframe:%d rate:%.2fx           ",
 		frames, 



More information about the commits mailing list