diff mbox series

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

Message ID 20230108125811.17967-5-anton@khirnov.net
State Accepted
Commit d234b4b193e017411e179c7a1d0521a6fa6dbc8d
Headers show
Series [FFmpeg-devel,1/8] lavfi/vf_scale: allow passing options to swscale directly | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Jan. 8, 2023, 12:58 p.m. UTC
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 mbox series


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);