[xiph-commits] r9137 - experimental/derf/theora-exp/examples
giles at motherfish-iii.xiph.org
giles at motherfish-iii.xiph.org
Wed Apr 13 20:11:00 PDT 2005
Author: giles
Date: 2005-04-13 20:10:59 -0700 (Wed, 13 Apr 2005)
New Revision: 9137
Modified:
experimental/derf/theora-exp/examples/dump_video.c
experimental/derf/theora-exp/examples/player_example.c
Log:
Print frame count and dropped frame statistics at the end of the example decoders.
Modified: experimental/derf/theora-exp/examples/dump_video.c
===================================================================
--- experimental/derf/theora-exp/examples/dump_video.c 2005-04-14 02:47:20 UTC (rev 9136)
+++ experimental/derf/theora-exp/examples/dump_video.c 2005-04-14 03:10:59 UTC (rev 9137)
@@ -173,6 +173,7 @@
FILE *infile = stdin;
outfile = stdout;
+ int frames = 0;
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
/* Beware the evil ifdef. We avoid these where we can, but this one we
@@ -330,6 +331,7 @@
if(theora_decode_packetin(td,&op,&videobuf_granulepos)>=0){
videobuf_time=theora_granule_time(td,videobuf_granulepos);
videobuf_ready=1;
+ frames++;
}
}else
@@ -365,8 +367,10 @@
if(outfile && outfile!=stdout)fclose(outfile);
fprintf(stderr,
- "\r "
- "\nDone.\n");
+ "\r \r");
+ fprintf(stderr, "%d frames\n", frames);
+ fprintf(stderr, "\nDone.\n");
+
return(0);
}
Modified: experimental/derf/theora-exp/examples/player_example.c
===================================================================
--- experimental/derf/theora-exp/examples/player_example.c 2005-04-14 02:47:20 UTC (rev 9136)
+++ experimental/derf/theora-exp/examples/player_example.c 2005-04-14 03:10:59 UTC (rev 9137)
@@ -444,6 +444,9 @@
FILE *infile = stdin;
+ int frames = 0;
+ int dropped = 0;
+
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
/* Beware the evil ifdef. We avoid these where we can, but this one we
cannot. Don't add any more, you'll probably go to hell if you do. */
@@ -678,6 +681,7 @@
}
if(theora_decode_packetin(td,&op,&videobuf_granulepos)>=0){
videobuf_time=theora_granule_time(td,videobuf_granulepos);
+ frames++;
/* is it already too old to be useful? This is only actually
useful cosmetically after a SIGSTOP. Note that we have to
@@ -687,8 +691,11 @@
if(videobuf_time>=get_time())
videobuf_ready=1;
- /*If we are too slow, reduce the pp level.*/
- else pp_inc=pp_level>0?-1:0;
+ else{
+ /*If we are too slow, reduce the pp level.*/
+ pp_inc=pp_level>0?-1:0;
+ dropped++;
+ }
}
}else
@@ -792,8 +799,12 @@
if(infile && infile!=stdin)fclose(infile);
fprintf(stderr,
- "\r "
- "\nDone.\n");
+ "\r \r");
+ fprintf(stderr, "%d frames", frames);
+ if (dropped) fprintf(stderr, " (%d dropped)", dropped);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "\nDone.\n");
+
return(0);
}
More information about the commits
mailing list