[FFmpeg-devel] [PATCH 2/3] ffmpeg: Move opt_preset() higher up to avoid using a prototype

Alexander Strange astrange
Mon Nov 8 05:44:06 CET 2010


---
 ffmpeg.c |   78 +++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a48a0f2..91ab431 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3276,6 +3276,45 @@ static void check_audio_video_sub_inputs(int *has_video_ptr, int *has_audio_ptr,
     *has_subtitle_ptr = has_subtitle;
 }
 
+static int opt_preset(const char *opt, const char *arg)
+{
+    FILE *f=NULL;
+    char filename[1000], tmp[1000], tmp2[1000], line[1000];
+    char *codec_name = *opt == 'v' ? video_codec_name :
+                       *opt == 'a' ? audio_codec_name :
+                                     subtitle_codec_name;
+
+    if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
+        fprintf(stderr, "File for preset '%s' not found\n", arg);
+        ffmpeg_exit(1);
+    }
+
+    while(!feof(f)){
+        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, "%s: Invalid syntax: '%s'\n", filename, line);
+            ffmpeg_exit(1);
+        }
+        if(!strcmp(tmp, "acodec")){
+            opt_audio_codec(tmp2);
+        }else if(!strcmp(tmp, "vcodec")){
+            opt_video_codec(tmp2);
+        }else if(!strcmp(tmp, "scodec")){
+            opt_subtitle_codec(tmp2);
+        }else if(opt_default(tmp, tmp2) < 0){
+            fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
+            ffmpeg_exit(1);
+        }
+    }
+
+    fclose(f);
+
+    return 0;
+}
+
 static void new_video_stream(AVFormatContext *oc, int file_idx)
 {
     AVStream *st;
@@ -4027,45 +4066,6 @@ static int opt_bsf(const char *opt, const char *arg)
     return 0;
 }
 
-static int opt_preset(const char *opt, const char *arg)
-{
-    FILE *f=NULL;
-    char filename[1000], tmp[1000], tmp2[1000], line[1000];
-    char *codec_name = *opt == 'v' ? video_codec_name :
-                       *opt == 'a' ? audio_codec_name :
-                                     subtitle_codec_name;
-
-    if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
-        fprintf(stderr, "File for preset '%s' not found\n", arg);
-        ffmpeg_exit(1);
-    }
-
-    while(!feof(f)){
-        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, "%s: Invalid syntax: '%s'\n", filename, line);
-            ffmpeg_exit(1);
-        }
-        if(!strcmp(tmp, "acodec")){
-            opt_audio_codec(tmp2);
-        }else if(!strcmp(tmp, "vcodec")){
-            opt_video_codec(tmp2);
-        }else if(!strcmp(tmp, "scodec")){
-            opt_subtitle_codec(tmp2);
-        }else if(opt_default(tmp, tmp2) < 0){
-            fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
-            ffmpeg_exit(1);
-        }
-    }
-
-    fclose(f);
-
-    return 0;
-}
-
 static const OptionDef options[] = {
     /* main options */
 #include "cmdutils_common_opts.h"
-- 
1.7.3.1




More information about the ffmpeg-devel mailing list