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.
release/5.1
Anton Khirnov 3 years ago
parent a0f04433f4
commit 1b7ecb3eef
  1. 8
      libavfilter/avfilter.c

@ -862,13 +862,17 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
return ret; return ret;
} }
} else { } else {
av_dict_set(options, key, value, 0); o = av_opt_find(ctx->priv, key, NULL, 0,
if (!av_opt_find(ctx->priv, key, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) { AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
if (!o) {
av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key); av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);
av_free(value); av_free(value);
av_free(parsed_key); av_free(parsed_key);
return AVERROR_OPTION_NOT_FOUND; 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); av_free(value);

Loading…
Cancel
Save