[xiph-commits] r11390 - trunk/ffmpeg2theora
j at svn.xiph.org
j at svn.xiph.org
Tue May 9 15:52:20 PDT 2006
Author: j
Date: 2006-05-09 15:52:19 -0700 (Tue, 09 May 2006)
New Revision: 11390
Modified:
trunk/ffmpeg2theora/ffmpeg2theora.c
Log:
patch by Jerome Alet to add
-P | --pid command line option which allows
ffmpeg2theora to register its process id in a file.
Modified: trunk/ffmpeg2theora/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.c 2006-05-09 14:35:47 UTC (rev 11389)
+++ trunk/ffmpeg2theora/ffmpeg2theora.c 2006-05-09 22:52:19 UTC (rev 11390)
@@ -849,6 +849,7 @@
#ifndef _WIN32
" --nice n set niceness to n\n"
#endif
+ " -P, --pid fname write the process' id to a file\n"
" -h, --help this message\n"
"\n"
"Examples:\n"
@@ -888,8 +889,9 @@
AVFormatParameters *formatParams = NULL;
int c,long_option_index;
- const char *optstring = "o:f:x:y:v:V:a:A:S:K:d:H:c:p:N:s:e:D:h::";
+ const char *optstring = "P:o:f:x:y:v:V:a:A:S:K:d:H:c:p:N:s:e:D:h::";
struct option options [] = {
+ {"pid",required_argument,NULL, 'P'},
{"output",required_argument,NULL,'o'},
{"format",required_argument,NULL,'f'},
{"width",required_argument,NULL,'x'},
@@ -933,6 +935,9 @@
{"help",0,NULL,'h'},
{NULL,0,NULL,0}
};
+
+ char pidfile_name[255] = { '\0' };
+ FILE *fpid = NULL;
ff2theora convert = ff2theora_init ();
av_register_all ();
@@ -1050,6 +1055,9 @@
sprintf(outputfile_name,optarg);
outputfile_set=1;
break;
+ case 'P':
+ sprintf(pidfile_name,optarg);
+ break;
case 'f':
input_fmt=av_find_input_format(optarg);
break;
@@ -1225,6 +1233,16 @@
exit(1);
}
+ if (*pidfile_name)
+ {
+ fpid = fopen(pidfile_name, "w");
+ if (fpid != NULL)
+ {
+ fprintf(fpid, "%i", getpid());
+ fclose(fpid);
+ }
+ }
+
if (av_open_input_file(&convert->context, inputfile_name, input_fmt, 0, formatParams) >= 0){
if (av_find_stream_info (convert->context) >= 0){
#ifdef WIN32
@@ -1270,5 +1288,10 @@
}
ff2theora_close (convert);
fprintf(stderr,"\n");
+
+ if (*pidfile_name)
+ {
+ unlink(pidfile_name);
+ }
return(0);
}
More information about the commits
mailing list