From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 10/10] fftools/cmdutils: drop redundant code Date: Tue, 15 Mar 2022 10:05:32 +0100 Message-ID: <20220315090532.27295-10-anton@khirnov.net> (raw) In-Reply-To: <20220315090532.27295-1-anton@khirnov.net> 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".
next prev parent reply other threads:[~2022-03-15 9:07 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-15 9:05 [FFmpeg-devel] [PATCH 01/10] fftools/cmdutils: drop prototypes for nonexistent functions Anton Khirnov 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 02/10] fftools/cmdutils: drop extern declarations for nonexistent variables Anton Khirnov 2022-03-17 14:21 ` Andreas Rheinhardt 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 03/10] fftools: drop useless indirection Anton Khirnov 2022-03-17 14:21 ` Andreas Rheinhardt 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 04/10] fftools/cmdutils: split common option handlers into their own file Anton Khirnov 2022-03-17 15:30 ` Andreas Rheinhardt 2022-03-20 10:07 ` Anton Khirnov 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 05/10] fftools: move opt_timelimit from cmdutils to ffmpeg Anton Khirnov 2022-03-17 15:34 ` Andreas Rheinhardt 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 06/10] fftools/ffmpeg: drop mistakenly added empty line Anton Khirnov 2022-03-17 15:35 ` Andreas Rheinhardt 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 07/10] fftools/ffplay: drop options deprecated since 2011 Anton Khirnov 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 08/10] fftools/ffprobe; drop -show_format_entry Anton Khirnov 2022-03-15 9:05 ` [FFmpeg-devel] [PATCH 09/10] fftools: drop the fake "default" option from ffplay/ffprobe Anton Khirnov 2022-03-15 9:05 ` Anton Khirnov [this message] 2022-03-17 14:19 ` [FFmpeg-devel] [PATCH 01/10] fftools/cmdutils: drop prototypes for nonexistent functions Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220315090532.27295-10-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git