[FFmpeg-cvslog] cmdutils: remove unnecessary OPT_DUMMY implementation

Stefano Sabatini git at videolan.org
Sun Jun 5 13:46:53 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sun Jun  5 00:03:59 2011 +0200| [b4af3cf3470a14626e5d2f40ce3c88bfdd0c8561] | committer: Stefano Sabatini

cmdutils: remove unnecessary OPT_DUMMY implementation

The -i INPUT option can be implemented more cleanly by using a
function option, which can easily be done now that the
parse_arg_function passed to parse_options has a standard signature.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4af3cf3470a14626e5d2f40ce3c88bfdd0c8561
---

 cmdutils.c |    2 --
 cmdutils.h |    1 -
 ffplay.c   |   28 ++++++++++++++--------------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 2bf4e03..4f27f50 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -273,8 +273,6 @@ unknown_opt:
                 *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
             } else if (po->flags & OPT_FLOAT) {
                 *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
-            } else if (po->flags & OPT_DUMMY) {
-                /* Do nothing for this option */
             } else {
                 if (po->u.func_arg(opt, arg) < 0) {
                     fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
diff --git a/cmdutils.h b/cmdutils.h
index 171ef3c..5fd398d 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -128,7 +128,6 @@ typedef struct {
 #define OPT_INT64  0x0400
 #define OPT_EXIT   0x0800
 #define OPT_DATA   0x1000
-#define OPT_DUMMY  0x2000
      union {
         int *int_arg;
         char **str_arg;
diff --git a/ffplay.c b/ffplay.c
index 48f5f14..3ebcd59 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2916,6 +2916,19 @@ static int opt_show_mode(const char *opt, const char *arg)
     return 0;
 }
 
+static int opt_input_file(const char *opt, const char *filename)
+{
+    if (input_filename) {
+        fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
+                filename, input_filename);
+        exit(1);
+    }
+    if (!strcmp(filename, "-"))
+        filename = "pipe:";
+    input_filename = filename;
+    return 0;
+}
+
 static const OptionDef options[] = {
 #include "cmdutils_common_opts.h"
     { "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
@@ -2961,7 +2974,7 @@ static const OptionDef options[] = {
     { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
     { "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
-    { "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""},
+    { "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"},
     { NULL, },
 };
 
@@ -3006,19 +3019,6 @@ static void show_help(void)
            );
 }
 
-static int opt_input_file(const char *opt, const char *filename)
-{
-    if (input_filename) {
-        fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
-                filename, input_filename);
-        exit(1);
-    }
-    if (!strcmp(filename, "-"))
-        filename = "pipe:";
-    input_filename = filename;
-    return 0;
-}
-
 /* Called from the main */
 int main(int argc, char **argv)
 {



More information about the ffmpeg-cvslog mailing list