Use the same logic as fftools/cmdutils - when a flag-type option starts with [+-], append it to the existing value.
Showing the changes to libavfilter/avfilter.c (1 of 1 file). Show all
Unified · Split
| @@ -862,13 +862,17 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, · 861 unmodified lines | |||
| 862 | return ret; | 862 | return ret; |
| 863 | } | 863 | } |
| 864 | } else { | 864 | } else { |
| 865 | av_dict_set(options, key, value, 0); | 865 | o = av_opt_find(ctx->priv, key, NULL, 0, |
| 866 | if (!av_opt_find(ctx->priv, key, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) { | 866 | AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); |
| 867 | if (!o) { | ||
| 867 | av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key); | 868 | av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key); |
| 868 | av_free(value); | 869 | av_free(value); |
| 869 | av_free(parsed_key); | 870 | av_free(parsed_key); |
| 870 | return AVERROR_OPTION_NOT_FOUND; | 871 | return AVERROR_OPTION_NOT_FOUND; |
| 871 | } | 872 | } |
| 873 | av_dict_set(options, key, value, | ||
| 874 | (o->type == AV_OPT_TYPE_FLAGS && | ||
| 875 | (value[0] == '-' || value[0] == '+')) ? AV_DICT_APPEND : 0); | ||
| 872 | } | 876 | } |
| 873 | 877 | ||
| 874 | av_free(value); | 878 | av_free(value); |