[FFmpeg-devel] [PATCH 5/8] lavfi/avfilter: simplify process_options()

Anton Khirnov anton at khirnov.net
Sun Jan 8 14:58:08 EET 2023


This function currently treats AVFilterContext options and
filter-private options differently: the former are immediately applied,
while the latter are stored in a dictionary to be applied later.

There is no good reason for having two branches - storing all options in
the dictionary is simpler and achieves the same effect (since it is
later applied with av_opt_set_dict()).

This will also be useful in future commits.
---
 libavfilter/avfilter.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 278d5868de..43dfb11bdb 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -842,16 +842,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, AV_DICT_MULTIKEY);
-        }
+        av_dict_set(options, key, value, AV_DICT_MULTIKEY);
 
         av_free(value);
         av_free(parsed_key);
-- 
2.35.1



More information about the ffmpeg-devel mailing list