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;