summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-03-10 11:31:25 +0100
committerAnton Khirnov <anton@khirnov.net>2022-03-22 18:49:43 +0100
commit1b7ecb3eef260da0f5cdcc295ae87c0cf777966a (patch)
tree6dc80872e3a5a50372b3d50e1bb951bec20debad /libavfilter
parenta0f04433f4fcca3ccc35cbccd34943bb7333221f (diff)
avfilter: handle duplicates in the options string
Use the same logic as fftools/cmdutils - when a flag-type option starts with [+-], append it to the existing value.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 3fdbcd489c..a6d486bd66 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -862,13 +862,17 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
return ret;
}
} else {
- av_dict_set(options, key, value, 0);
- if (!av_opt_find(ctx->priv, key, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
+ o = av_opt_find(ctx->priv, key, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
+ if (!o) {
av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);
av_free(value);
av_free(parsed_key);
return AVERROR_OPTION_NOT_FOUND;
}
+ av_dict_set(options, key, value,
+ (o->type == AV_OPT_TYPE_FLAGS &&
+ (value[0] == '-' || value[0] == '+')) ? AV_DICT_APPEND : 0);
}
av_free(value);