[xiph-commits] r17660 - trunk/theora/examples
giles at svn.xiph.org
giles at svn.xiph.org
Thu Nov 25 13:20:07 PST 2010
Author: giles
Date: 2010-11-25 13:20:07 -0800 (Thu, 25 Nov 2010)
New Revision: 17660
Modified:
trunk/theora/examples/encoder_example.c
Log:
Add a -q option to encoder_example to silence progress messages.
This makes it a little nice to call from a batch job with parallel
executation. The messages indentifying the input file parameters
and error messages are still printed.
Modified: trunk/theora/examples/encoder_example.c
===================================================================
--- trunk/theora/examples/encoder_example.c 2010-11-25 21:17:52 UTC (rev 17659)
+++ trunk/theora/examples/encoder_example.c 2010-11-25 21:20:07 UTC (rev 17660)
@@ -66,7 +66,7 @@
# define TH_ENCCTL_SET_METRICS_FILE (0x8000)
#endif
-const char *optstring = "b:e:o:a:A:v:V:s:S:f:F:ck:d:z:\1\2\3\4"
+const char *optstring = "b:e:o:a:A:v:V:s:S:f:F:qck:d:z:\1\2\3\4"
#if defined(OC_COLLECT_METRICS)
"m:"
#endif
@@ -83,6 +83,7 @@
{"aspect-denominator",required_argument,NULL,'S'},
{"framerate-numerator",required_argument,NULL,'f'},
{"framerate-denominator",required_argument,NULL,'F'},
+ {"quiet",no_argument,NULL,'q'},
{"vp3-compatible",no_argument,NULL,'c'},
{"speed",required_argument,NULL,'z'},
{"soft-target",no_argument,NULL,'\1'},
@@ -109,6 +110,8 @@
int audio_r=-1;
int vp3_compatible=0;
+int quiet=0;
+
int frame_w=0;
int frame_h=0;
int pic_w=0;
@@ -221,12 +224,13 @@
" --soft-target is used) and infinite for\n"
" two-pass encoding.\n"
" -b --begin-time <h:m:s.d> Begin encoding at offset into input\n"
- " -e --end-time <h:m:s.d> End encoding at offset into input\n"
+ " -e --end-time <h:m:s.d> End encoding at offset into input\n\n"
+ " -q --quiet Don't print progress information.\n\n"
#if defined(OC_COLLECT_METRICS)
" -m --metrics-filename File in which to accumulate mode decision\n"
" metrics. Statistics from the current\n"
" encode will be merged with those already\n"
- " in the file if it exists.\n"
+ " in the file if it exists.\n\n"
#endif
"encoder_example accepts only uncompressed RIFF WAV format audio and\n"
"YUV4MPEG2 uncompressed video.\n\n");
@@ -945,6 +949,9 @@
int spinner=0;
char *spinascii="|/-\\";
void spinnit(void){
+ if(quiet){
+ return;
+ }
spinner++;
if(spinner==4)spinner=0;
fprintf(stderr,"\r%c",spinascii[spinner]);
@@ -1369,6 +1376,10 @@
video_fps_d=(int)rint(atof(optarg));
break;
+ case 'q':
+ quiet=1;
+ break;
+
case 'c':
vp3_compatible=1;
break;
@@ -1754,6 +1765,7 @@
}
}
/* setup complete. Raw processing loop */
+ if(!quiet){
switch(passno){
case 0: case 2:
fprintf(stderr,"\rCompressing.... \n");
@@ -1762,6 +1774,7 @@
fprintf(stderr,"\rScanning first pass.... \n");
break;
}
+ }
for(;;){
int audio_or_video=-1;
if(passno==1){
@@ -1812,7 +1825,7 @@
timebase=audiotime;
}
}
- if(timebase > 0){
+ if(!quiet&&timebase>0){
int hundredths=(int)(timebase*100-(long)timebase*100);
int seconds=(long)timebase%60;
int minutes=((long)timebase/60)%60;
@@ -1845,7 +1858,9 @@
if(outfile && outfile!=stdout)fclose(outfile);
if(twopass_file)fclose(twopass_file);
- fprintf(stderr,"\r \ndone.\n\n");
+ if(!quiet){
+ fprintf(stderr,"\r \ndone.\n\n");
+ }
return(0);
More information about the commits
mailing list