Commit 8a4f816a authored by Michael Niedermayer's avatar Michael Niedermayer

Support comments in preset files.

Originally committed as revision 15366 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 96b52f9e
...@@ -3718,7 +3718,7 @@ static int opt_bsf(const char *opt, const char *arg) ...@@ -3718,7 +3718,7 @@ static int opt_bsf(const char *opt, const char *arg)
static int opt_preset(const char *opt, const char *arg) static int opt_preset(const char *opt, const char *arg)
{ {
FILE *f=NULL; FILE *f=NULL;
char tmp[1000], tmp2[1000]; char tmp[1000], tmp2[1000], line[1000];
int i; int i;
const char *base[3]= { getenv("HOME"), const char *base[3]= { getenv("HOME"),
"/usr/local/share", "/usr/local/share",
...@@ -3743,8 +3743,11 @@ static int opt_preset(const char *opt, const char *arg) ...@@ -3743,8 +3743,11 @@ static int opt_preset(const char *opt, const char *arg)
} }
while(!feof(f)){ while(!feof(f)){
int e= fscanf(f, "%999[^=]=%999[^\n]\n", tmp, tmp2); int e= fscanf(f, "%999[^\n]\n", line) - 1;
if(e!=2){ if(line[0] == '#' && !e)
continue;
e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
if(e){
fprintf(stderr, "Preset file invalid\n"); fprintf(stderr, "Preset file invalid\n");
av_exit(1); av_exit(1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment