From patchwork Mon Aug 24 11:36:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 21874 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 52F9144B155 for ; Mon, 24 Aug 2020 14:37:04 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E4DB68A922; Mon, 24 Aug 2020 14:37:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4B042688085 for ; Mon, 24 Aug 2020 14:36:57 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 07OBaurx027512 for ; Mon, 24 Aug 2020 13:36:56 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 71C59E8C4D; Mon, 24 Aug 2020 13:36:56 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Aug 2020 13:36:49 +0200 Message-Id: <20200824113652.255648-2-george@nsup.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824113652.255648-1-george@nsup.org> References: <20200824113652.255648-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Mon, 24 Aug 2020 13:36:56 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH v3 2/4] lavfi/formats: simplify a macro parameters. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Nicolas George --- libavfilter/formats.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) Rebased on top of recent commits and resolved conflicts. diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 0a351d4174..695d28ea8e 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -535,15 +535,15 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) FORMATS_CHANGEREF(oldref, newref); } -#define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref_fn, unref_fn) \ +#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \ int count = 0, i; \ \ if (!fmts) \ return AVERROR(ENOMEM); \ \ for (i = 0; i < ctx->nb_inputs; i++) { \ - if (ctx->inputs[i] && !ctx->inputs[i]->out_fmts) { \ - int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts); \ + if (ctx->inputs[i] && !ctx->inputs[i]->outcfg.fmts) { \ + int ret = ref_fn(fmts, &ctx->inputs[i]->outcfg.fmts); \ if (ret < 0) { \ return ret; \ } \ @@ -551,8 +551,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) } \ } \ for (i = 0; i < ctx->nb_outputs; i++) { \ - if (ctx->outputs[i] && !ctx->outputs[i]->in_fmts) { \ - int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts); \ + if (ctx->outputs[i] && !ctx->outputs[i]->incfg.fmts) { \ + int ret = ref_fn(fmts, &ctx->outputs[i]->incfg.fmts); \ if (ret < 0) { \ return ret; \ } \ @@ -567,16 +567,16 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) return 0; int ff_set_common_channel_layouts(AVFilterContext *ctx, - AVFilterChannelLayouts *layouts) + AVFilterChannelLayouts *channel_layouts) { - SET_COMMON_FORMATS(ctx, layouts, incfg.channel_layouts, outcfg.channel_layouts, + SET_COMMON_FORMATS(ctx, channel_layouts, ff_channel_layouts_ref, ff_channel_layouts_unref); } int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates) { - SET_COMMON_FORMATS(ctx, samplerates, incfg.samplerates, outcfg.samplerates, + SET_COMMON_FORMATS(ctx, samplerates, ff_formats_ref, ff_formats_unref); } @@ -587,7 +587,7 @@ int ff_set_common_samplerates(AVFilterContext *ctx, */ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) { - SET_COMMON_FORMATS(ctx, formats, incfg.formats, outcfg.formats, + SET_COMMON_FORMATS(ctx, formats, ff_formats_ref, ff_formats_unref); }