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);