From patchwork Sun Jan 8 12:58:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39919 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423444pzb; Sun, 8 Jan 2023 04:59:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1QbrHbBkGbPgdIIDg1fKMq2sfeUiCEnkY2oXXQoq0JuOk6gTl37UnmFMev9KhOPN71/GU X-Received: by 2002:a17:907:874c:b0:7fc:4242:f9ec with SMTP id qo12-20020a170907874c00b007fc4242f9ecmr51404484ejc.43.1673182754910; Sun, 08 Jan 2023 04:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182754; cv=none; d=google.com; s=arc-20160816; b=qLNpthqCj+JWJLop6mnguWqV151Cenvvu4/WJKHd49m0yhFprNeQ8Vp8iUtBiQ3mqk vFg48q2JnTha2HVvxnKC3h0wv1g8mj6yZk3HE6QVHPZxSerJ+V5X9hnW8si0li+rKKGX zlpucxlCoQltLsMl1CEVJSOWV5cmREefG4rtHR0p6rEMG5GEliDA2xm+ebYOjFp3Skk/ ZCfa81e+SggN4dwR1vbCfqyWgijr4qv286BhC5VLj7S1qYW2/B1Fpkh613uyDuJPSdoW lRjbRNLLDqtGjkRNTqqs90Fsth5HxICwgVphB/Bq1oXxvBkI3ysNRCrm82PE7ZhBpQlh c1gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=NrCcjwXeYkOnWvULDUahdbC0OA9Fx5++RhYcna5KOZg=; b=0VMy6+D/iD9EBY7L2VXWxKta/Qj4eKGYar9tqVfZGhSexnYhzHkJML11XLGsiZapbi 3rbHC6f3Xe5d1JmsutuySEQQn5W2bZhvhfOWZksgDQUlOEBPtEpnrI2wmDDwnJDyz7B0 7bsmedATTyUWbXYXcBSUA004HIHBClQFeSzUlGStnu4ns8tW7EgPWSfoDm4zJnaKoe4F JKZSOwhOD8ueHOLfjtwR/mp6kawucsHqtOG0QjlUTvfNJWm1mmP54cOPXT/z7Iy8ONoH EDQfDKuGjhAYLmb09YQhNFaesF9K/mXoerK4Pz77QccsIJhYnqRzAeGw03VvSlLGNqsH GooA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dr6-20020a170907720600b0084d197a89e2si6222211ejc.957.2023.01.08.04.59.14; Sun, 08 Jan 2023 04:59:14 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D91368BC2A; Sun, 8 Jan 2023 14:58:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D83468B612 for ; Sun, 8 Jan 2023 14:58:36 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4B4052400F5 for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id kcnK6jBK5BgJ for ; Sun, 8 Jan 2023 13:58:35 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C02E32404F7 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 486193A0101 for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:04 +0100 Message-Id: <20230108125811.17967-1-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/8] lavfi/vf_scale: allow passing options to swscale directly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rRhgM4m5A3B2 Avoid using the dictionary mechanism, which is non-introspectable. As this is the only user of AVFilter.init_dict(), this callback can now be removed. --- libavfilter/vf_scale.c | 95 +++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 29 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index b95e2e6c66..85047e3524 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -23,6 +23,7 @@ * scale video filter */ +#include #include #include @@ -107,7 +108,8 @@ typedef struct ScaleContext { const AVClass *class; struct SwsContext *sws; ///< software scaler context struct SwsContext *isws[2]; ///< software scaler context for interlaced material - AVDictionary *opts; + // context used for forwarding options to sws + struct SwsContext *sws_opts; /** * New dimensions. Special values are: @@ -117,7 +119,6 @@ typedef struct ScaleContext { */ int w, h; char *size_str; - unsigned int flags; ///sws flags double param[2]; // sws params int hsub, vsub; ///< chroma subsampling @@ -268,11 +269,29 @@ revert: return ret; } -static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) +static av_cold int preinit(AVFilterContext *ctx) { ScaleContext *scale = ctx->priv; int ret; + scale->sws_opts = sws_alloc_context(); + if (!scale->sws_opts) + return AVERROR(ENOMEM); + + // set threads=0, so we can later check whether the user modified it + ret = av_opt_set_int(scale->sws_opts, "threads", 0, 0); + if (ret < 0) + return ret; + + return 0; +} + +static av_cold int init(AVFilterContext *ctx) +{ + ScaleContext *scale = ctx->priv; + int64_t threads; + int ret; + if (scale->size_str && (scale->w_expr || scale->h_expr)) { av_log(ctx, AV_LOG_ERROR, "Size and width/height expressions cannot be set at the same time.\n"); @@ -310,18 +329,26 @@ static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) av_log(ctx, AV_LOG_VERBOSE, "w:%s h:%s flags:'%s' interl:%d\n", scale->w_expr, scale->h_expr, (char *)av_x_if_null(scale->flags_str, ""), scale->interlaced); - scale->flags = 0; - if (scale->flags_str && *scale->flags_str) { - const AVClass *class = sws_get_class(); - const AVOption *o = av_opt_find(&class, "sws_flags", NULL, 0, - AV_OPT_SEARCH_FAKE_OBJ); - int ret = av_opt_eval_flags(&class, o, scale->flags_str, &scale->flags); + ret = av_opt_set(scale->sws_opts, "sws_flags", scale->flags_str, 0); if (ret < 0) return ret; } - scale->opts = *opts; - *opts = NULL; + + for (int i = 0; i < FF_ARRAY_ELEMS(scale->param); i++) + if (scale->param[i] != DBL_MAX) { + ret = av_opt_set_double(scale->sws_opts, i ? "param1" : "param0", + scale->param[i], 0); + if (ret < 0) + return ret; + } + + // use generic thread-count if the user did not set it explicitly + ret = av_opt_get_int(scale->sws_opts, "threads", 0, &threads); + if (ret < 0) + return ret; + if (!threads) + av_opt_set_int(scale->sws_opts, "threads", ff_filter_get_nb_threads(ctx), 0); scale->in_frame_range = AVCOL_RANGE_UNSPECIFIED; @@ -334,11 +361,11 @@ static av_cold void uninit(AVFilterContext *ctx) av_expr_free(scale->w_pexpr); av_expr_free(scale->h_pexpr); scale->w_pexpr = scale->h_pexpr = NULL; + sws_freeContext(scale->sws_opts); sws_freeContext(scale->sws); sws_freeContext(scale->isws[0]); sws_freeContext(scale->isws[1]); scale->sws = NULL; - av_dict_free(&scale->opts); } static int query_formats(AVFilterContext *ctx) @@ -486,6 +513,7 @@ static int config_props(AVFilterLink *outlink) enum AVPixelFormat outfmt = outlink->format; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); ScaleContext *scale = ctx->priv; + uint8_t *flags_val = NULL; int ret; if ((ret = scale_eval_dimensions(ctx)) < 0) @@ -534,16 +562,16 @@ static int config_props(AVFilterLink *outlink) return AVERROR(ENOMEM); *swscs[i] = s; + ret = av_opt_copy(s, scale->sws_opts); + if (ret < 0) + return ret; + av_opt_set_int(s, "srcw", inlink0 ->w, 0); av_opt_set_int(s, "srch", inlink0 ->h >> !!i, 0); av_opt_set_int(s, "src_format", inlink0->format, 0); av_opt_set_int(s, "dstw", outlink->w, 0); av_opt_set_int(s, "dsth", outlink->h >> !!i, 0); av_opt_set_int(s, "dst_format", outfmt, 0); - av_opt_set_int(s, "sws_flags", scale->flags, 0); - av_opt_set_int(s, "param0", scale->param[0], 0); - av_opt_set_int(s, "param1", scale->param[1], 0); - av_opt_set_int(s, "threads", ff_filter_get_nb_threads(ctx), 0); if (scale->in_range != AVCOL_RANGE_UNSPECIFIED) av_opt_set_int(s, "src_range", scale->in_range == AVCOL_RANGE_JPEG, 0); @@ -554,13 +582,6 @@ static int config_props(AVFilterLink *outlink) av_opt_set_int(s, "dst_range", scale->out_range == AVCOL_RANGE_JPEG, 0); - if (scale->opts) { - const AVDictionaryEntry *e = NULL; - while ((e = av_dict_iterate(scale->opts, e))) { - if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0) - return ret; - } - } /* Override YUV420P default settings to have the correct (MPEG-2) chroma positions * MPEG-2 chroma positions are used by convention * XXX: support other 4:2:0 pixel formats */ @@ -589,12 +610,17 @@ static int config_props(AVFilterLink *outlink) } else outlink->sample_aspect_ratio = inlink0->sample_aspect_ratio; - av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d -> w:%d h:%d fmt:%s sar:%d/%d flags:0x%0x\n", + if (scale->sws) + av_opt_get(scale->sws, "sws_flags", 0, &flags_val); + + av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s sar:%d/%d -> w:%d h:%d fmt:%s sar:%d/%d flags:%s\n", inlink ->w, inlink ->h, av_get_pix_fmt_name( inlink->format), inlink->sample_aspect_ratio.num, inlink->sample_aspect_ratio.den, outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format), outlink->sample_aspect_ratio.num, outlink->sample_aspect_ratio.den, - scale->flags); + flags_val); + av_freep(&flags_val); + return 0; fail: @@ -927,6 +953,14 @@ static const AVClass *child_class_iterate(void **iter) return c; } +static void *child_next(void *obj, void *prev) +{ + ScaleContext *s = obj; + if (!prev) + return s->sws_opts; + return NULL; +} + #define OFFSET(x) offsetof(ScaleContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM #define TFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM @@ -969,8 +1003,8 @@ static const AVOption scale_options[] = { { "decrease", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, FLAGS, "force_oar" }, { "increase", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 0, FLAGS, "force_oar" }, { "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1}, 1, 256, FLAGS }, - { "param0", "Scaler param 0", OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, - { "param1", "Scaler param 1", OFFSET(param[1]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, + { "param0", "Scaler param 0", OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, + { "param1", "Scaler param 1", OFFSET(param[1]), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, "eval" }, { "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" }, { "frame", "eval expressions during initialization and per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" }, @@ -984,6 +1018,7 @@ static const AVClass scale_class = { .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, .child_class_iterate = child_class_iterate, + .child_next = child_next, }; static const AVFilterPad avfilter_vf_scale_inputs[] = { @@ -1005,7 +1040,8 @@ static const AVFilterPad avfilter_vf_scale_outputs[] = { const AVFilter ff_vf_scale = { .name = "scale", .description = NULL_IF_CONFIG_SMALL("Scale the input video size and/or convert the image format."), - .init_dict = init_dict, + .preinit = preinit, + .init = init, .uninit = uninit, .priv_size = sizeof(ScaleContext), .priv_class = &scale_class, @@ -1046,7 +1082,8 @@ static const AVFilterPad avfilter_vf_scale2ref_outputs[] = { const AVFilter ff_vf_scale2ref = { .name = "scale2ref", .description = NULL_IF_CONFIG_SMALL("Scale the input video size and/or convert the image format to the given reference."), - .init_dict = init_dict, + .preinit = preinit, + .init = init, .uninit = uninit, .priv_size = sizeof(ScaleContext), .priv_class = &scale_class, From patchwork Sun Jan 8 12:58:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39916 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423268pzb; Sun, 8 Jan 2023 04:58:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1G0GBLjsPMWhWcWTY/2PFiTWBltgXRh9MZtbBoILEWoc9xxmYrNzJY1JSP64A3Y600BG7 X-Received: by 2002:a05:6402:c4c:b0:48f:acd1:8da2 with SMTP id cs12-20020a0564020c4c00b0048facd18da2mr13849175edb.27.1673182727441; Sun, 08 Jan 2023 04:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182727; cv=none; d=google.com; s=arc-20160816; b=nIUGZyAXdpxwPb7hOzzR0QwyPJONjZIIE2DLIJX9ayke5sa9THgVyLjnruv1B5dEDf tMX620ZEmK8TlzOgwMC6tBE/txse+T3Z4yxl25AdFRq8PNTmO6KtXbG7SOxwaYqdt23d inzZW6VX456hTYvEQb+b8/spJgcXaw2Rvlqb9W77qbY3NkCcJxHckMrEcmw5nxWpeDdH L0EWLA1TJDsOk7iH3a04CIYIcqvmBABmY55HLnjAqgQMjlDbFA5s9GTmY9+7nhVd7O3A QSR0RF9MlZs+hON8COU+PrGsZL6H9bA0lC4USH9XgJ4zCnbTxcVWYIXnbok1tgXzXI4s g65w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=hUdnPdlRuCY1T5SN7TTzzMUczki5YyQGsETbayt9UMQ=; b=kcd2yk9hBUtmLV6zfJFE66P6L3IwtPPde0ql+srRD70qLPOOXWmG9bimKxxuUE6aKN 9ddUaSfQ8C+zaP9Gxoj8kSf7wKn2HNSAUAWTEqlPkG/Fx0iAomssLLyFUmzKvZni2G3Y PzqRhbnQxlu40KiR+wgkmgsYxY9u9Po1FzIIgsZ+XL9/eY3ycDrHmXWQT1G4756ORWOc jM3VRaPrJWbEewEJAJn+N8a8/t0Di2FBlrHXYOdIlchwxW+BpepCxb5ApU9ugh7NZL4d LGCtc98gOawc9twcK6MBH9ow9iU2yMRuhYM0XT+nsFt03Ia9nZe2aUiV1KRUUOB6gCsR h8kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z5-20020a50eb45000000b0048b2c1d1621si6412253edp.83.2023.01.08.04.58.46; Sun, 08 Jan 2023 04:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E6F068BAAE; Sun, 8 Jan 2023 14:58:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C59E968B612 for ; Sun, 8 Jan 2023 14:58:35 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5ED91240499 for ; Sun, 8 Jan 2023 13:58:35 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id qYxB1scl18pT for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BCEA72400F5 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 565A03A0344 for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:05 +0100 Message-Id: <20230108125811.17967-2-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/8] lavfi: remove AVFilter.init_dict() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yWpoMD15yYZo Nothing uses it anymore. All options on all filters can now be set with normal AVOptions mechanisms, such as av_opt_set*(). --- libavfilter/avfilter.c | 2 -- libavfilter/avfilter.h | 13 ------------- 2 files changed, 15 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index cc5505e65b..e5dd0cfdb0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -912,8 +912,6 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) if (ctx->filter->init) ret = ctx->filter->init(ctx); - else if (ctx->filter->init_dict) - ret = ctx->filter->init_dict(ctx, options); if (ret < 0) return ret; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 6d68ebece4..c2ec7a4b5f 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -276,19 +276,6 @@ typedef struct AVFilter { */ int (*init)(AVFilterContext *ctx); - /** - * Should be set instead of @ref AVFilter.init "init" by the filters that - * want to pass a dictionary of AVOptions to nested contexts that are - * allocated during init. - * - * On return, the options dict should be freed and replaced with one that - * contains all the options which could not be processed by this filter (or - * with NULL if all the options were processed). - * - * Otherwise the semantics is the same as for @ref AVFilter.init "init". - */ - int (*init_dict)(AVFilterContext *ctx, AVDictionary **options); - /** * Filter uninitialization function. * From patchwork Sun Jan 8 12:58:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39918 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423369pzb; Sun, 8 Jan 2023 04:59:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAzm7vnS3nWluot8MB95Jao7mYXXMju9O1hGqOn69WU6UD6s+0aUpueV9aQsLq8Pdt4u0d X-Received: by 2002:a17:907:80ca:b0:7c1:20ff:c044 with SMTP id io10-20020a17090780ca00b007c120ffc044mr54110444ejc.27.1673182746590; Sun, 08 Jan 2023 04:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182746; cv=none; d=google.com; s=arc-20160816; b=EmjJd+7SoN+UxUvOEGy9+buIJMWM3KdOyjacZUTQPOSLESS0araJ2u9g/yVYjzWlni zlmdrTFnyQwb+DKpkGNwiGIHEiuY7WsAgs5Hat8DNW5KuLclVdAyKWjSlIAeyOuVyoOp 4CKCppDYLl/cUYJ0n5JQwEjS6d6UKy9XlrhZ5YJZn3H2ZVoD4tgegE0zhqMwzpOYHsWd PLv5Hg3dDP5C1cdWPZwn1/Es+hgcuvoHQGW2qBZjNk4G45Tv8ISQEsGyK3uNOyxm/FRX FFf+3qcSD53Hnk3zmBarvRLwqitcf+QFxRf5bqeojVSnT72BPDHFxbyxENYmyU7zSALy /Usw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=nx3r4vgRFG7Q5tfew2HITf67PcwkVs1RmD+Nm670DW4=; b=OOsw8F5rkMnw1c08M+OfsOL5SHQkqH3FuBVA+Sr2Ur+cOFudSmH782g9IgELKnTZuM 5pOMxOrij44Pz5PKiuJoVmHWHzDGqHxcnd1EtnqxyeRug8UHIym7oGuKxFlMB+gJ0BMm p3DesR/5f5dprT4MessmEi4ceiLtEsLZUHrD8prN45qspjBlHWr1WHvZOac9TxzJIi8T D8IdZovsYuS8/NFwp31T6B3e6DAm5iE6LOTNKFgPzH3hpkZe3N6Jx37Kdh45W1zPUkV2 mIfu6ZzAAOPD2jq3WK2vnBZtD4MLuLGT2vT46M8DSeTGDOHsTaOiZeV8HdE4bkEp87pY UC6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id oz35-20020a1709077da300b008327270a7fesi6922217ejc.538.2023.01.08.04.59.06; Sun, 08 Jan 2023 04:59:06 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 320FB68BB4C; Sun, 8 Jan 2023 14:58:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB87168BABF for ; Sun, 8 Jan 2023 14:58:35 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 69EC32406CA for ; Sun, 8 Jan 2023 13:58:34 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id j9TFQPXFE-Ns for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C2D87240591 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 61D4D3A034A for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:06 +0100 Message-Id: <20230108125811.17967-3-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/8] lavfi/avfilter: avoid a redundant av_opt_set_dict2() call X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wp6F1uobM83p Current code first sets AVFilterContext-level options, then aplies the leftover on the filter's private data. This is unnecessary, applying the options to AVFilterContext with the AV_OPT_SEARCH_CHILDREN flag accomplishes the same effect. --- libavfilter/avfilter.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e5dd0cfdb0..689c91891e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -887,7 +887,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { int ret = 0; - ret = av_opt_set_dict(ctx, options); + ret = av_opt_set_dict2(ctx, options, AV_OPT_SEARCH_CHILDREN); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Error applying generic filter options.\n"); return ret; @@ -902,14 +902,6 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ctx->thread_type = 0; } - if (ctx->filter->priv_class) { - ret = av_opt_set_dict2(ctx->priv, options, AV_OPT_SEARCH_CHILDREN); - if (ret < 0) { - av_log(ctx, AV_LOG_ERROR, "Error applying options to the filter.\n"); - return ret; - } - } - if (ctx->filter->init) ret = ctx->filter->init(ctx); if (ret < 0) From patchwork Sun Jan 8 12:58:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39922 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423593pzb; Sun, 8 Jan 2023 04:59:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXu8otAsZxMGD/+4IAvtkipBHpU242mBro67XVzIjvTwxtWrdca+Ug3a0W9bsz7EzZsgCr8/ X-Received: by 2002:a05:6402:414:b0:495:77a9:f108 with SMTP id q20-20020a056402041400b0049577a9f108mr10937457edv.39.1673182780168; Sun, 08 Jan 2023 04:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182780; cv=none; d=google.com; s=arc-20160816; b=sWUJlVsmtY3Nd6BNdqO6OmDZdVRQtv+KJ3BEJG3aTOsWnnMXAPhO/gdaAcZ6sX63Rj A0TkQ8W2b6jEMtlkBVLjnPSF35tFo/ET1MyKGFHRKbblE+jUE3zrBD8hGkkUK4/EGFbt vK6Jk1lWLlihRk2ceVaZT1kxL7j41/HQipF2vAWphu/ZuoZaM1ywnOPW8hXPJUxf8iEF qjinEnplwAPtPHVUr122aVN/Fc6NW/0yiYgq6Gw8U7VF95qrV7KWF//8MQoVOqsbFfFJ oRw/OZZ9splBx5fbty9YO6NNf4z6EU5hql73AbCyGnXB/DcdnR74sfQrk+OOn9mw5giX Gs7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=1jRKu1u0f84sFxh2u/8qsEAzvRbforybU+XZLYIuN4M=; b=ULXK1UtRCpobO2GraY+tZvn9VzHFi/qyHeQZGu4xlvSV+PhqtJjopUjHHKdCvvE8g5 yy2SrmWE1+VqJtKJWxZo6WXjoHw85LTWWHHtbqVy/IMfXocko9jmXdgcNR+ZG5d2YphV v177w7bFzt7LOD3tZDWApA04YiJL73Wk3J2AS/biF1Mys1hxYwG8zAlWxD81u9x3bLNg O3gWTohbAfb9VdnHjfJGJT+Pv4vs2BuWCl0zz3CZaCT/oYX+ERtEbVgA8S6EAF+rNI+j EgZlM8VoI8rQlfEy+pXPuHHmGKwHvYGcW82AvzQYAS+9c5eVPrpdCwlAPavlKAwJuf3V Um1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r18-20020a05640251d200b0046ffcd4df07si8064037edd.569.2023.01.08.04.59.39; Sun, 08 Jan 2023 04:59:40 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4D8E568BC80; Sun, 8 Jan 2023 14:58:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2402D68BC50 for ; Sun, 8 Jan 2023 14:58:41 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E010B2405F9 for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 46d6V0s2mL5t for ; Sun, 8 Jan 2023 13:58:34 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C16C42404F8 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 6D92D3A034C for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:07 +0100 Message-Id: <20230108125811.17967-4-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] lavfi/avfilter: export a multikey dict from process_options() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XX/WHuP39NL6 This way the function does not need to be able to match keys to AVOptions, which will be useful in future commits. --- libavfilter/avfilter.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 689c91891e..278d5868de 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -850,17 +850,7 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, return ret; } } else { - 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_dict_set(options, key, value, AV_DICT_MULTIKEY); } av_free(value); From patchwork Sun Jan 8 12:58:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39917 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423319pzb; Sun, 8 Jan 2023 04:58:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXueemFx1mzQYHsQ1i+Z1pgcEPVC39AlNMQ+/DJwqGgI243d680WXVpy03SfdZe0ZFy0vonb X-Received: by 2002:a05:6402:5172:b0:493:597e:2193 with SMTP id d18-20020a056402517200b00493597e2193mr8949111ede.37.1673182737930; Sun, 08 Jan 2023 04:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182737; cv=none; d=google.com; s=arc-20160816; b=dSIpblZKeADkmxHiFKonDRXTyPAMt3GaNMeqlpmdLPN//+ivOFhnmgFG2eZS/93+Z+ M+BJuScpiQCQXoXro+ZwbBlf9E5eAlFAn1O9Glj9w54KrAFPYZJdau9E+VnBqVt1dfwU Q/M36BeZxkJFM8FTuTpDe2jSbEUxGahlqyHRxrhfMEbeUp7jVWP+XmeACq8O+tgEqOeF YlPQHo/zZA0VoodunGt82ZOdgFJNoo+RV0D3jklwUAKfy2uLD8eoQg/pXqHGyawvt9P8 63g58oaFvDLPmEDw2SCEkEthi1OjgkdPuvg8JrnTWVIfFoUuV0JpYagBq6vMbi5d4fed uRaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=wphhLADqfyjKCnyV6g40/33k3dMx5AUMTg5J9BMoAr8=; b=WHU++3zdEiMOhAd5PETWE6TEUPYcziCXvkolFztx0L/2zY/Q6wYmAJaY4tllce6lu7 n6v0mZYzWr341SpKteyftttJveSab0Lp/Ttb47eUpZokwK6R38uDZYH+E/jLG5C1U8I1 LEeYuZGS2Iuz6MLLvff6X61ykxV2oqBaozav50VL0c9JQdHPYcjxIRdobCVCfpKXnCxy WGKTDFaWPuS4EamtyatKqgO2tPPvRdoxLsLI9C3g+co81B9UMKm9Ge5ysSpPQiohomTV v8B03pHAHdWOIoeiTVD3aI68BY0Nwmjn19jhMR8uzCnkwNtJhXKcrc+xJ+k43CzMYV9L eSQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h19-20020a05640250d300b0048e6babc2c4si7698847edb.503.2023.01.08.04.58.57; Sun, 08 Jan 2023 04:58:57 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1AB2768BB6A; Sun, 8 Jan 2023 14:58:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C87A568BAAE for ; Sun, 8 Jan 2023 14:58:35 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E11D8240591 for ; Sun, 8 Jan 2023 13:58:34 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Pmv9zFPUen7d for ; Sun, 8 Jan 2023 13:58:34 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BED9E240499 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 794F53A0354 for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:08 +0100 Message-Id: <20230108125811.17967-5-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/8] lavfi/avfilter: simplify process_options() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rjeqS2eElGc+ 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); From patchwork Sun Jan 8 12:58:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39921 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423554pzb; Sun, 8 Jan 2023 04:59:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsIGg8Vn36O8mjKndSAEV4X3lpIMx43KLLiJPoNroD7oz0v6NmXAR/Oo3slV0ei8uSb2jTm X-Received: by 2002:a17:906:53d3:b0:840:db38:bf2a with SMTP id p19-20020a17090653d300b00840db38bf2amr53869550ejo.46.1673182772730; Sun, 08 Jan 2023 04:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182772; cv=none; d=google.com; s=arc-20160816; b=TZyl5ub5Mu7gOqzmqAuLyMpyggOmUDi+9e4VkE4f3Hd2J2EKU1klu6XMve6caQn8s/ mDi2tUOIMXRoQSJnAcosev8rar3LgRHFmDP9MyzctIKWMo/XPSbK1bx52JAel3B23UtQ atgVZEXeX55qX46Q8rAUzWTdsNQDFlDaCyXQRQOhfcb7hEUt6aiPH7HqzFJN5gG5ASo5 swy8bw7XtE1XKUwlf6eU9gAC2wsxT6QKPTFMjOVPzzbY8WNJUp1ZzCm1ktCfd8TuYAMt 9LDeRkyoaujwuOPzryYnqs8zgnmlpUrwfP5hIcE84qXqCx+QT3x65VG5PWS0/Ce32MNg N8dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=LdpiSaZHIyu1gMncAyKSoxEAHBFycmX1Pvu2JoXvabo=; b=vrnaC1qdcT8ebtYklTIaJfSvjEaEoogvDrmPi1tsMHJcsuKkNjRaTUEecYag09Sifu cu5prAyAvytxdbVOpqQ0YQXt31HJGqHMDEUsAR3pfmlUqjU2UiZ46NIigRtWns5rH7Y7 TT2HjP+aDERD3Mczep5Xq7UCWFd2Z8NEOcL1ikjMA6dKf2RctoIoLdI7iZIVmcuxInIS b5CSUbBXktdR7mL2LzlZwK2VFOLyxNfZwMNIBS16X0qjY0mh2agYRoyCJmk/JMzmPVkC TIaORSRQEpRKbOFJirtJKmmPfiikK3tGa8QGRUuQoreVKJuP/ew6HA6WWPGrcIE5Y4HC kDgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wu4-20020a170906eec400b0073de493b83esi6989719ejb.147.2023.01.08.04.59.31; Sun, 08 Jan 2023 04:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A52E68BC50; Sun, 8 Jan 2023 14:58:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 256C168BC53 for ; Sun, 8 Jan 2023 14:58:41 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 491DF2404F8 for ; Sun, 8 Jan 2023 13:58:37 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dTVfgcaioPwr for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CDF6E2405EC for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 84C763A035B for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:09 +0100 Message-Id: <20230108125811.17967-6-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] lavfi/avfilter: process options for filters without a private class X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: x4X4yQFYo01p It still makes sense to apply AVFilterContext-level options to such filters. --- libavfilter/avfilter.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 43dfb11bdb..c2ecdffa6f 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -812,7 +812,8 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, while (*args) { const char *shorthand = NULL; - o = av_opt_next(ctx->priv, o); + if (ctx->filter->priv_class) + o = av_opt_next(ctx->priv, o); if (o) { if (o->type == AV_OPT_TYPE_CONST || o->offset == offset) continue; @@ -835,7 +836,10 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, args++; if (parsed_key) { key = parsed_key; - while ((o = av_opt_next(ctx->priv, o))); /* discard all remaining shorthand */ + + /* discard all remaining shorthand */ + if (ctx->filter->priv_class) + while ((o = av_opt_next(ctx->priv, o))); } else { key = shorthand; } @@ -904,12 +908,6 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) int ret = 0; if (args && *args) { - if (!filter->filter->priv_class) { - av_log(filter, AV_LOG_ERROR, "This filter does not take any " - "options, but options were provided: %s.\n", args); - return AVERROR(EINVAL); - } - ret = process_options(filter, &options, args); if (ret < 0) goto fail; From patchwork Sun Jan 8 12:58:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423656pzb; Sun, 8 Jan 2023 04:59:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7bSKT9XgWG2ALCjw1+2m+Pn5FXJ9BPeEBjjx3GfpHSjD1XqARExB1j+KdproN92v1K6t1 X-Received: by 2002:a17:907:6f18:b0:837:3ed3:9c2b with SMTP id sy24-20020a1709076f1800b008373ed39c2bmr58763098ejc.5.1673182788691; Sun, 08 Jan 2023 04:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182788; cv=none; d=google.com; s=arc-20160816; b=tPpbGcoDt4Na6mOb1hdApbLBs/681lMgyK/ccgw6vGtSeVEUD2FdYCIfculFCLLoR4 707egPBYc7m93kJAeRQiL/oKedcqkz3JfasKSaohriRMqzvJ82/aUQJ4ghtgfHpMOcgi XFSlzwkqhlXTs2qQVKKw6je4e5L0sOi0CNj3aCy7fbHfdr2cpFEY0BEl4VAqEo6URSKa 0jSPx16UhsyfJpZ10qp65DWgdii7zj17gk+z6lgDLoHRXwctJ0Un62B75ANmhIXRCIiq wUxg0WtJj3ZW/HilwJGUW0PPR7ADMsveyMHSr1cusTKxt+6WnDwSHgDvIbrNXkqXEWWj 1kZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=fU5uxLAkw/K0hqfOqT2TBxpqsKagL/3vG7716DaP5Kc=; b=uS0kMyMORVhc2gQsyLnVJ5ebQ2K1E9uifJsk6DkiUQvPNbF736u2yFXgGo1sLMogPH kNF+n3MEpDSMrBNt81nWTkIVf8UWUBeNMXBFMOAjLbg1eFb7CLu9ZjjqbXcRZ2btglZg 8VEfX8axCyKtT5LsgtccTqd5MVY1E3tGoOck6fC0ySBXdB8yoBy3wXaolfFpkc6epVr3 0mh+FxWlKeuNTnopz1S4oQDqIwun2tRDU8JPnrciFj7x4n7BQnQvuFZ+7hWdG06Js6Pa oTGj2Lk8CMIazirYYyjLGj/hsBxClnIDDKvplDjd/ueit0slr57rqJb/PxlhTBSJ9q5y h8EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wt2-20020a170906ee8200b0084d3a7b6a04si2810690ejb.576.2023.01.08.04.59.48; Sun, 08 Jan 2023 04:59:48 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 509C668BC8F; Sun, 8 Jan 2023 14:58:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 28FE168BC59 for ; Sun, 8 Jan 2023 14:58:41 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 64E9B2405EC for ; Sun, 8 Jan 2023 13:58:37 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 0MGMPqfJejzZ for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id EA8AB2406C7 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 8FBB23A03D9 for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:10 +0100 Message-Id: <20230108125811.17967-7-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/8] lavfi/graphparser: improve applying graph-level sws options X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ExOLd/kVvXGm The current code will apply them if the options string does not contain a 'flags' substring, and will do so by appending the graph-level option string to the filter option string (with the standard ':' separator). This is flawed in at least the following ways: - naive substring matching without actually parsing the options string may lead to false positives (e.g. flags are specified by shorthand) and false negatives (e.g. the 'flags' substring is not actually the option name) - graph-level sws options are not limited to flags, but may set arbitrary sws options This commit simply applies the graph-level options with av_set_options_string() and lets them be overridden as desired by the user-specified filter options (if any). This is also shorter and avoids extra string handling. --- libavfilter/graphparser.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 1385c3ae71..c8b0af5aba 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -25,6 +25,8 @@ #include "libavutil/avstring.h" #include "libavutil/mem.h" +#include "libavutil/opt.h" + #include "avfilter.h" #define WHITESPACES " \n\t\r" @@ -101,7 +103,6 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind const AVFilter *filt; char name2[30]; const char *inst_name = NULL, *filt_name = NULL; - char *tmp_args = NULL; int ret, k; av_strlcpy(name2, name, sizeof(name2)); @@ -136,16 +137,10 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind return AVERROR(ENOMEM); } - if (!strcmp(filt_name, "scale") && (!args || !strstr(args, "flags")) && - ctx->scale_sws_opts) { - if (args) { - tmp_args = av_asprintf("%s:%s", - args, ctx->scale_sws_opts); - if (!tmp_args) - return AVERROR(ENOMEM); - args = tmp_args; - } else - args = ctx->scale_sws_opts; + if (!strcmp(filt_name, "scale") && ctx->scale_sws_opts) { + ret = av_set_options_string(*filt_ctx, ctx->scale_sws_opts, "=", ":"); + if (ret < 0) + return ret; } ret = avfilter_init_str(*filt_ctx, args); @@ -159,7 +154,6 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind *filt_ctx = NULL; } - av_free(tmp_args); return ret; } From patchwork Sun Jan 8 12:58:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39920 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2423484pzb; Sun, 8 Jan 2023 04:59:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQtk9L+R25svWjVNlgoxiQLNVU+E5OXNsxWm22yMmakOeguo95IrhFizhBtgzUGWqGruhp X-Received: by 2002:a17:906:915:b0:7c0:e98d:b27 with SMTP id i21-20020a170906091500b007c0e98d0b27mr52529939ejd.58.1673182763319; Sun, 08 Jan 2023 04:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673182763; cv=none; d=google.com; s=arc-20160816; b=KEW67OvyV+tC1X14SyZ7S3ARoW0W9xukzzl3EhAIaYXwETYzdDSOHBC8a3MGjMQgZX vtd/QNKZR7FtkKNCrRr02jKZk+kqK0H00xZSs7sKzGM2aWIEzaWB+NCgpdr3HHz3Paop hmCcEx3jPDmxZkxohR86jxaHc3Cbo2G05lf4DA4zdnfB4Xp3bZlg3G4xU2bYgolvWIEi j4cm0SfyCse3GotMWNIVAKXQgDANrWXoIC1kSy9WIIyvEk5wFNk2Zf7XoCedzT4usfK1 +MXUolebvJshOVF0ApGDEWS/KMHkOvuSCz3qHL+lKY/W3s6RDtNTUmZicTm5mS7MxMGv HT2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=VkHYZa71d9LGD2ChJYd4f35RHOYZh8K4mVLpNbOC/y4=; b=qB+G6CWEEn2ec65IEB1UK5M8zMDCfRLyrBL5S3oEFJrSkkoMJ/lQf6bxxzF89e+x4z UGdVZE9sJoVG0q6EwvcUmbhJ57GRREnnjQckzXzK+lph4MqraVgEPEl23S65BuE8Xits cRt+rssaJHUCJc1fySehfPSiefSaKW26FqRQq1zAQx5GdJnbFgzbqx8aQpNUMJO9bIpT FJziyhruwzZ4CFvvmVbHwWU1JRTg3rdJq3Cq21hlqqOOjILysu7e7RiMLkl44fukAifh IjWPxC3Lx/GDt4rnaewnYkHSp/PUfjYtqHtglgMlzuHI8MuhN23m8PRgZ550qQ3IP+un 9Unw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m7-20020a170906848700b0084d119e0672si6788469ejx.932.2023.01.08.04.59.22; Sun, 08 Jan 2023 04:59:23 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2AA9968BC68; Sun, 8 Jan 2023 14:58:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11B2D68BB61 for ; Sun, 8 Jan 2023 14:58:37 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id BF2662404F7 for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Samxwib23slp for ; Sun, 8 Jan 2023 13:58:36 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id D1D762405F9 for ; Sun, 8 Jan 2023 13:58:33 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 9B5633A03EF for ; Sun, 8 Jan 2023 13:58:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Jan 2023 13:58:11 +0100 Message-Id: <20230108125811.17967-8-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230108125811.17967-1-anton@khirnov.net> References: <20230108125811.17967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/8] lavfi/graphparser: drop a redundant label X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cdEXOtAcWXSm --- libavfilter/graphparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index c8b0af5aba..0759c39014 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -421,7 +421,7 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, filters += strspn(filters, WHITESPACES); if ((ret = parse_sws_flags(&filters, graph)) < 0) - goto fail; + goto end; do { AVFilterContext *filter; @@ -463,7 +463,7 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, *outputs = open_outputs; return 0; - fail:end: +end: while (graph->nb_filters) avfilter_free(graph->filters[0]); av_freep(&graph->filters);