From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C9EF04239E for ; Tue, 15 Mar 2022 09:07:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04F3A68B223; Tue, 15 Mar 2022 11:06:04 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8936E68B1C1 for ; Tue, 15 Mar 2022 11:05:54 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 2A0CD240511 for ; Tue, 15 Mar 2022 10:05:53 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id fRZWQb2Q46jt for ; Tue, 15 Mar 2022 10:05:52 +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 B6C2B240512 for ; Tue, 15 Mar 2022 10:05:46 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 2BEA23A0984; Tue, 15 Mar 2022 10:05:46 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Mar 2022 10:05:32 +0100 Message-Id: <20220315090532.27295-10-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315090532.27295-1-anton@khirnov.net> References: <20220315090532.27295-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/10] fftools/cmdutils: drop redundant code 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It allocates a dummy sws/swr context and tries setting options on it, apparently to check if they are valid. This is redundant, since the options will be checked if/when they are later applied on a context that is actually used for conversion. --- fftools/cmdutils.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index a52c87dfaf..6e5ef1beb4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -539,20 +539,12 @@ int opt_default(void *optctx, const char *opt, const char *arg) #if CONFIG_SWSCALE if (!consumed && (o = opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { - struct SwsContext *sws = sws_alloc_context(); - int ret = av_opt_set(sws, opt, arg, 0); - sws_freeContext(sws); if (!strcmp(opt, "srcw") || !strcmp(opt, "srch") || !strcmp(opt, "dstw") || !strcmp(opt, "dsth") || !strcmp(opt, "src_format") || !strcmp(opt, "dst_format")) { av_log(NULL, AV_LOG_ERROR, "Directly using swscale dimensions/format options is not supported, please use the -s or -pix_fmt options\n"); return AVERROR(EINVAL); } - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); - return ret; - } - av_dict_set(&sws_dict, opt, arg, FLAGS); consumed = 1; @@ -566,13 +558,6 @@ int opt_default(void *optctx, const char *opt, const char *arg) #if CONFIG_SWRESAMPLE if (!consumed && (o=opt_find(&swr_class, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { - struct SwrContext *swr = swr_alloc(); - int ret = av_opt_set(swr, opt, arg, 0); - swr_free(&swr); - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); - return ret; - } av_dict_set(&swr_opts, opt, arg, FLAGS); consumed = 1; } -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".