[FFmpeg-devel] [PATCH] cmdutils: look for negated boolean program options *before* subcomponents options

Stefano Sabatini stefasab at gmail.com
Thu Apr 4 22:23:25 CEST 2013


Program options have priority over subcomponents options. Also avoid
spurious error message introduced in 8bb5680.

For example with command:
ffmpeg -f lavfi -i testsrc=d=0.1 -nostdin -f null -
[...]
Could not find option 'nostdin' in any of the FFmpeg subsystems (codec, format, scaler, resampler contexts)
---
 cmdutils.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 756cf71..51ec634 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -741,6 +741,16 @@ do {                                                                           \
             continue;
         }
 
+        /* boolean -nofoo options */
+        if (opt[0] == 'n' && opt[1] == 'o' &&
+            (po = find_option(options, opt + 2)) &&
+            po->name && po->flags & OPT_BOOL) {
+            add_opt(octx, po, opt, "0");
+            av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
+                   "argument 0.\n", po->name, po->help);
+            continue;
+        }
+
         /* AVOptions */
         if (argv[optindex]) {
             ret = opt_default(NULL, opt, argv[optindex]);
@@ -756,16 +766,6 @@ do {                                                                           \
             }
         }
 
-        /* boolean -nofoo options */
-        if (opt[0] == 'n' && opt[1] == 'o' &&
-            (po = find_option(options, opt + 2)) &&
-            po->name && po->flags & OPT_BOOL) {
-            add_opt(octx, po, opt, "0");
-            av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
-                   "argument 0.\n", po->name, po->help);
-            continue;
-        }
-
         av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'.\n", opt);
         return AVERROR_OPTION_NOT_FOUND;
     }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list