]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Support comments in preset files.
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 18 Sep 2008 21:07:11 +0000 (21:07 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 18 Sep 2008 21:07:11 +0000 (21:07 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15366 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

ffmpeg.c

index 781001a2f550bec8fb6f8e4f155fc402f2b1a78f..d9027aeaffdab0289b207892c11a2e5e112f9f17 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3718,7 +3718,7 @@ static int opt_bsf(const char *opt, const char *arg)
 static int opt_preset(const char *opt, const char *arg)
 {
     FILE *f=NULL;
-    char tmp[1000], tmp2[1000];
+    char tmp[1000], tmp2[1000], line[1000];
     int i;
     const char *base[3]= { getenv("HOME"),
                            "/usr/local/share",
@@ -3743,8 +3743,11 @@ static int opt_preset(const char *opt, const char *arg)
     }
 
     while(!feof(f)){
-        int e= fscanf(f, "%999[^=]=%999[^\n]\n", tmp, tmp2);
-        if(e!=2){
+        int e= fscanf(f, "%999[^\n]\n", line) - 1;
+        if(line[0] == '#' && !e)
+            continue;
+        e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
+        if(e){
             fprintf(stderr, "Preset file invalid\n");
             av_exit(1);
         }