avfilter_init_str() (via process_options()) both applies options
extracted from the given string directly to the relevant (private)
context as well as to an AVDictionary that is later given to
avfilter_init_dict() which applies these options again. This is
unnecessary, so leave applying the options to avfilter_init_dict();
this also has the advantage that all unrecognized options are reported
before erroring out in case there are unrecognized options, whereas
the current code stops after the first such option.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavfilter/avfilter.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c614eb0740..11d4e01807 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -853,25 +853,7 @@ static int process_options(AVFilterContext *ctx, 
AVDictionary **options,
 
         av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);
 
-        if (av_opt_find(ctx, key, NULL, 0, 0)) {
-            ret = av_opt_set(ctx, key, value, 0);
-            if (ret < 0) {
-                av_free(value);
-                av_free(parsed_key);
-                return ret;
-            }
-        } else {
             av_dict_set(options, key, value, 0);
-            if ((ret = av_opt_set(ctx->priv, key, value, 
AV_OPT_SEARCH_CHILDREN)) < 0) {
-                if (!av_opt_find(ctx->priv, key, NULL, 0, 
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
-                    if (ret == AVERROR_OPTION_NOT_FOUND)
-                        av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", 
key);
-                    av_free(value);
-                    av_free(parsed_key);
-                    return ret;
-                }
-            }
-        }
 
         av_free(value);
         av_free(parsed_key);
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to