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.
| ... | ... |
@@ -273,8 +273,6 @@ unknown_opt: |
| 273 | 273 |
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); |
| 274 | 274 |
} else if (po->flags & OPT_FLOAT) {
|
| 275 | 275 |
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); |
| 276 |
- } else if (po->flags & OPT_DUMMY) {
|
|
| 277 |
- /* Do nothing for this option */ |
|
| 278 | 276 |
} else {
|
| 279 | 277 |
if (po->u.func_arg(opt, arg) < 0) {
|
| 280 | 278 |
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt); |
| ... | ... |
@@ -2916,6 +2916,19 @@ static int opt_show_mode(const char *opt, const char *arg) |
| 2916 | 2916 |
return 0; |
| 2917 | 2917 |
} |
| 2918 | 2918 |
|
| 2919 |
+static int opt_input_file(const char *opt, const char *filename) |
|
| 2920 |
+{
|
|
| 2921 |
+ if (input_filename) {
|
|
| 2922 |
+ fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", |
|
| 2923 |
+ filename, input_filename); |
|
| 2924 |
+ exit(1); |
|
| 2925 |
+ } |
|
| 2926 |
+ if (!strcmp(filename, "-")) |
|
| 2927 |
+ filename = "pipe:"; |
|
| 2928 |
+ input_filename = filename; |
|
| 2929 |
+ return 0; |
|
| 2930 |
+} |
|
| 2931 |
+ |
|
| 2919 | 2932 |
static const OptionDef options[] = {
|
| 2920 | 2933 |
#include "cmdutils_common_opts.h" |
| 2921 | 2934 |
{ "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
|
| ... | ... |
@@ -2961,7 +2974,7 @@ static const OptionDef options[] = {
|
| 2961 | 2961 |
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
|
| 2962 | 2962 |
{ "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
|
| 2963 | 2963 |
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
| 2964 |
- { "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""},
|
|
| 2964 |
+ { "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"},
|
|
| 2965 | 2965 |
{ NULL, },
|
| 2966 | 2966 |
}; |
| 2967 | 2967 |
|
| ... | ... |
@@ -3006,19 +3019,6 @@ static void show_help(void) |
| 3006 | 3006 |
); |
| 3007 | 3007 |
} |
| 3008 | 3008 |
|
| 3009 |
-static int opt_input_file(const char *opt, const char *filename) |
|
| 3010 |
-{
|
|
| 3011 |
- if (input_filename) {
|
|
| 3012 |
- fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", |
|
| 3013 |
- filename, input_filename); |
|
| 3014 |
- exit(1); |
|
| 3015 |
- } |
|
| 3016 |
- if (!strcmp(filename, "-")) |
|
| 3017 |
- filename = "pipe:"; |
|
| 3018 |
- input_filename = filename; |
|
| 3019 |
- return 0; |
|
| 3020 |
-} |
|
| 3021 |
- |
|
| 3022 | 3009 |
/* Called from the main */ |
| 3023 | 3010 |
int main(int argc, char **argv) |
| 3024 | 3011 |
{
|