From patchwork Tue Aug 17 01:53:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29579 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2550393iov; Mon, 16 Aug 2021 18:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK1e/wOAVTWvzlqLhzeialss/aZyat/gvby+bK8lwm46x3TljaM7e0Ss6YSCMm3vt0Qqbi X-Received: by 2002:a17:906:d1d6:: with SMTP id bs22mr1112130ejb.554.1629165259816; Mon, 16 Aug 2021 18:54:19 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b3si696367edr.477.2021.08.16.18.54.19; Mon, 16 Aug 2021 18:54:19 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=F+IyiQsm; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 805B268A5B3; Tue, 17 Aug 2021 04:54:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2101.outbound.protection.outlook.com [40.92.90.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 68D1468A13C for ; Tue, 17 Aug 2021 04:54:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXLMbwsdSGQly6Ubo0MUDISqnXaM2T0f2xjbJS8yM3sy7Nqs2/Lb/p0C5uwGSE+9sQzKqjDubA8XxfVGEb6kXVskrnSr38T2/pKdx+YY6XoOz12X6iGNhuLSSk9/Q7kuNDlLu+vgaVcj8DgI7c+eL/9CZkJJhQ3JGF/LyUY7JPxPxkxTkgqbZK2G5eFZsBFUJibSmaN3aUW1Gdia7n5sfHfopTAhxaYhqC2YkSGIDJ/VkD+65hfZbeBYkRThWc8BRf9eMbWX+ijxMj/PBRMfeDFSv4DZesOkFyIpBVGe6u7p8fm00iSWYEOXOPmsoFEm4PlSCmRN+poeP3ZTsYO6Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TG7Fp19K1Qdp2jPsfgnGz70+5Jep49j3bMoSTsxpISo=; b=XX2g0P1KeBVJHQh/VKkZDVZmS/p2X08HSnch1RkFK41QSxlbYB16XC265knymKL2TlriBk3LtnrYEyKhgTPrdvDKVbR+lAPD7KAKezhH0oOei7uOHINGFN0PPC6oRbLhs8MYFh6NDDbWKhsJ5hiQoA3FELvDkUjQ9+YI0UosWuO/DMujzKstF6rtr+TlzpixqDYMXU4RtIk4PT4DKX2BChYSwsY3TaLnnMgzdz0pr31Ap2a5fcFedoIzRZqmm26oNuYcYE4HAR0vyHexhrYW+PigcHzJQc+n4Dn9Wnhm1Nm0f2Vr7VRWnt9/7tKCX2EKkU0OAQeM6ohm57CDE3M/0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TG7Fp19K1Qdp2jPsfgnGz70+5Jep49j3bMoSTsxpISo=; b=F+IyiQsmlFtNSnZkkYQLXdrX6jyPSxbSX7NeKAElzvsZQVBa0lKuHUiCRx9XnS6TDrUpjVtIQHOcXZ0XjlkjWCuwxrYt2h7qrf+ElFTj9SdzUNxU8VfUhobKzV5W8yZKRb2RNdnRJNsbYPvMe5xbuCC7YTrkmYsY5TgIfRgMtQw/+RSm+B1GsXztqYicd2U1Y5exwIP1jcNy8ihaVcYcoKEnVm3B/f+qfOpKsYtuNP1Rc6f4J6zV120zzckCyMakB8JCIU3XBX/NEkGV5V52ZK27+JXlgwVAAGqb/05QHPNL27MAyqIrrAeJ5aHJWHXjsP8QonkLEoGTG1y9hmKFMg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6264.eurprd03.prod.outlook.com (2603:10a6:20b:13d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Tue, 17 Aug 2021 01:54:08 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ded:bace:bc7:e91d]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ded:bace:bc7:e91d%3]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 01:54:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:53:54 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [iFWZ7zW3tRrNRCLB0F2yBKsqRM6hx6JW] X-ClientProxiedBy: PR3P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:53::15) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210817015358.2985475-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR3P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:53::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Tue, 17 Aug 2021 01:54:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f38fe800-5d36-4834-a190-08d96121e66f X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNViLEfi+B1v2fp/64glZbG/aG/ipIEWQK1/a269eFF1qsvUGONUnXJGGZMxGb098tOhuIL9ugZc8Y96FZb8zaMigdVszKAtGxeTMV0jknutJVHqYaDnbAHD/RK4IuXci3b4/W5RyS/Sdc7B38SLJfj4WgsM/2GacXlbFbUzFz5jeqYPhMkGksN6tEw58V8iAGMzZ88xDqKvCN2a2zyDwGTb0yqLAVYIW0/dagtojP2zrY6t7pWEg6onrO8T80mE2ycqHv5iW89E9+50mWG6IB8OTkqRwYhqHjn1OEc5FYaQ61h08JpsXEBhwEXPhW9MeRWLSSdvFKIlqgfpoyNt7S/5JVftMdtx3SqinI2ia7jP/mjO0JpDzk3eicHdScjlo+injCEShlXamyljB0zKifFCMx8GnrrTGpkUOFiw6+rLfMpHYMTcOdRLC3rMmCR1cnDUnREM3FuyzQJO1NW/1JXqnLwbcvNPfKV8I49Iybql8Z+C8EVK8ANmZ9jbxtZ4sTGslTzAuqxbs3+vGHenHEU//ijVm5zMsp1I5e6gAEbcXdYQXi8Peyc1wqP1iWLBdKJXhShaiU8gz6g0tRCVjHWoLqBMt40/dVjCGAn7Nusyv+eksnLuER8KDl1pGNvXvXt7ewJw0sDJHS03QlEtmeqvks5z+nX7fb/zcFvluicv71hK5BD4IDkQxnjOgtoLUQ3Cw9QBT6/puOEVH0EzsVdh14zDqQsEfWo= X-MS-TrafficTypeDiagnostic: AM7PR03MB6264: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hV2TM8YCRJx+HEkItoOHKxt3zpudP+DstsVj8cwDWk0BE/4I1cyI21eXvjiAM20mbH3p2TAPvifNfFcXP4y9GlARs8BAOUTqmmCS6ZndE0iSC7xVwdrtIb3Djv7t5OJr/zRWeVVZRfb/rlDiXbcy+vaI60blSX4mG26oMAsmQ/DF/bZGkPpeDRLWKDo1Ad/oVeP+OQlzjdiajcMRLjnhDo0VZoizPrQxNi5OrvIxz1l2hKGg4rnYTizMxD4DUdyNHkIZznfGH2NDfdvOyar/LF+6y/zfi59wU06E10XPkPy/A/hNwqFO5GkMTjmTJ25Sh2aU7obRZjbf1g3OV9xcLvQfZwqvvLPoCbS3fAy/hn2R/SBbwWOJoPTHv4hURxPhXxFwqW4wPmPak6fe/r6iVca5+U3BBlwWB7JZikj3lia7AqT9tQfsiD22F/PK1uAQ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SlIFB7G0MsAYr+yfbL5S0fUTCHxYUOQqkH4VuR6VMS8Jc+buoFLd32dXWD7IpZu3ouSxcrKx89l8azDD9qdqj3Z3ZqsXp2VEi/z+XQokbIHU+2onqJSXoiiltuUZSUuXdis9J+RLmlydSxh6VsbrQA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f38fe800-5d36-4834-a190-08d96121e66f X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2021 01:54:07.9985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR03MB6264 Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/avfilter: Remove unused feature to add pads in the middle 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8seLVF+GZ3/G Signed-off-by: Andreas Rheinhardt --- libavfilter/af_acrossover.c | 2 +- libavfilter/af_afir.c | 8 ++++---- libavfilter/af_aiir.c | 4 ++-- libavfilter/af_amerge.c | 2 +- libavfilter/af_amix.c | 2 +- libavfilter/af_anequalizer.c | 4 ++-- libavfilter/af_channelsplit.c | 3 +-- libavfilter/af_headphone.c | 4 ++-- libavfilter/af_join.c | 2 +- libavfilter/af_ladspa.c | 2 +- libavfilter/af_lv2.c | 2 +- libavfilter/avf_aphasemeter.c | 4 ++-- libavfilter/avf_concat.c | 4 ++-- libavfilter/avfilter.c | 15 ++++----------- libavfilter/f_ebur128.c | 4 ++-- libavfilter/f_interleave.c | 2 +- libavfilter/f_segment.c | 2 +- libavfilter/f_select.c | 2 +- libavfilter/f_streamselect.c | 4 ++-- libavfilter/internal.h | 15 +++++---------- libavfilter/split.c | 2 +- libavfilter/src_movie.c | 2 +- libavfilter/vf_bm3d.c | 4 ++-- libavfilter/vf_decimate.c | 4 ++-- libavfilter/vf_extractplanes.c | 2 +- libavfilter/vf_fieldmatch.c | 4 ++-- libavfilter/vf_guided.c | 4 ++-- libavfilter/vf_mergeplanes.c | 2 +- libavfilter/vf_mix.c | 2 +- libavfilter/vf_premultiply.c | 4 ++-- libavfilter/vf_program_opencl.c | 2 +- libavfilter/vf_signature.c | 2 +- libavfilter/vf_stack.c | 2 +- libavfilter/vf_xmedian.c | 2 +- 34 files changed, 56 insertions(+), 69 deletions(-) diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index e8dcc48e6a..1ad7ebad01 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -191,7 +191,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.name = name; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 8cbdf81df4..670a8c837b 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -836,7 +836,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_inpad(ctx, 0, &pad); + ret = ff_insert_inpad(ctx, &pad); if (ret < 0) return ret; @@ -849,7 +849,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - ret = ff_insert_inpad(ctx, n + 1, &pad); + ret = ff_insert_inpad(ctx, &pad); if (ret < 0) { av_freep(&pad.name); return ret; @@ -862,7 +862,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; @@ -873,7 +873,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_insert_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 55d5ac7f14..5f954dcf73 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -1473,7 +1473,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; @@ -1484,7 +1484,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_insert_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 7749495970..ef84f4d264 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -328,7 +328,7 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 003c1717cd..c0c909fb0c 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -553,7 +553,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c index b9d02e28ff..48d6b8848b 100644 --- a/libavfilter/af_anequalizer.c +++ b/libavfilter/af_anequalizer.c @@ -196,7 +196,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; @@ -206,7 +206,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_insert_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index d6f1438b86..07f131eae9 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -97,9 +97,8 @@ static av_cold int init(AVFilterContext *ctx) s->map[i] = ret; } - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) return ret; - } } fail: diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index f3543fafb6..44a7cdfe74 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -652,7 +652,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (!s->map) { @@ -670,7 +670,7 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i + 1, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index 10bd3c1c01..6534b619ca 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -194,7 +194,7 @@ static av_cold int join_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c index 0c2bd5a54e..e21a874dda 100644 --- a/libavfilter/af_ladspa.c +++ b/libavfilter/af_ladspa.c @@ -639,7 +639,7 @@ static av_cold int init(AVFilterContext *ctx) pad.filter_frame = filter_frame; pad.config_props = config_input; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { + if (ff_insert_inpad(ctx, &pad) < 0) { av_freep(&pad.name); return AVERROR(ENOMEM); } diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index 83ff5e7861..179ef6e24e 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -464,7 +464,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.filter_frame = filter_frame; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { + if (ff_insert_inpad(ctx, &pad) < 0) { av_freep(&pad.name); return AVERROR(ENOMEM); } diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c index a31805f204..b4d6909063 100644 --- a/libavfilter/avf_aphasemeter.c +++ b/libavfilter/avf_aphasemeter.c @@ -355,7 +355,7 @@ static av_cold int init(AVFilterContext *ctx) .name = "out0", .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; @@ -365,7 +365,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 1, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; } diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 333a0b090c..2ad092466f 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -317,7 +317,7 @@ static av_cold int init(AVFilterContext *ctx) .get_audio_buffer = get_audio_buffer, }; pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str); - if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } @@ -332,7 +332,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; pad.name = av_asprintf("out:%c%d", "va"[type], str); - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 24184ed1ed..af371e4fb9 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -101,18 +101,16 @@ void ff_command_queue_pop(AVFilterContext *filter) av_free(c); } -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, +int ff_insert_pad(unsigned *count, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; - unsigned i; - - idx = FFMIN(idx, *count); + unsigned idx = *count; - newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); - newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); + newpads = av_realloc_array(*pads, idx + 1, sizeof(*newpads)); + newlinks = av_realloc_array(*links, idx + 1, sizeof(*newlinks)); if (newpads) *pads = newpads; if (newlinks) @@ -120,15 +118,10 @@ int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, if (!newpads || !newlinks) return AVERROR(ENOMEM); - memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); - memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; (*count)++; - for (i = idx + 1; i < *count; i++) - if ((*links)[i]) - (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; return 0; } diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 47ea9b59d7..a058ee8884 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -552,7 +552,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; } @@ -561,7 +561,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_audio_output, }; - ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); + ret = ff_insert_outpad(ctx, &pad); if (ret < 0) return ret; diff --git a/libavfilter/f_interleave.c b/libavfilter/f_interleave.c index 259952b591..a58892862b 100644 --- a/libavfilter/f_interleave.c +++ b/libavfilter/f_interleave.c @@ -173,7 +173,7 @@ static av_cold int init(AVFilterContext *ctx) default: av_assert0(0); } - if ((ret = ff_insert_inpad(ctx, i, &inpad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &inpad)) < 0) { av_freep(&inpad.name); return ret; } diff --git a/libavfilter/f_segment.c b/libavfilter/f_segment.c index f060794cfe..7a76550411 100644 --- a/libavfilter/f_segment.c +++ b/libavfilter/f_segment.c @@ -137,7 +137,7 @@ static av_cold int init(AVFilterContext *ctx, enum AVMediaType type) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 4a131f01c8..43aab5e549 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -192,7 +192,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.type = ctx->filter->inputs[0].type; pad.request_frame = request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 05a8d5f49a..732b253b0b 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -167,10 +167,10 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name); if (is_input) { - ret = ff_insert_inpad(ctx, i, &pad); + ret = ff_insert_inpad(ctx, &pad); } else { pad.config_props = config_output; - ret = ff_insert_outpad(ctx, i, &pad); + ret = ff_insert_outpad(ctx, &pad); } if (ret < 0) { diff --git a/libavfilter/internal.h b/libavfilter/internal.h index e7a9275114..13d0e2b457 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -228,34 +228,29 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end); /** * Insert a new pad. * - * @param idx Insertion point. Pad is inserted at the end if this point - * is beyond the end of the list of pads. * @param count Pointer to the number of pads in the list - * @param padidx_off Offset within an AVFilterLink structure to the element - * to increment when inserting a new pad causes link - * numbering to change * @param pads Pointer to the pointer to the beginning of the list of pads * @param links Pointer to the pointer to the beginning of the list of links * @param newpad The new pad to add. A copy is made when adding. * @return >= 0 in case of success, a negative AVERROR code on error */ -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, +int ff_insert_pad(unsigned *count, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad); /** Insert a new input pad for the filter. */ -static inline int ff_insert_inpad(AVFilterContext *f, unsigned index, +static inline int ff_insert_inpad(AVFilterContext *f, AVFilterPad *p) { - return ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad), + return ff_insert_pad(&f->nb_inputs, &f->input_pads, &f->inputs, p); } /** Insert a new output pad for the filter. */ -static inline int ff_insert_outpad(AVFilterContext *f, unsigned index, +static inline int ff_insert_outpad(AVFilterContext *f, AVFilterPad *p) { - return ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad), + return ff_insert_pad(&f->nb_outputs, &f->output_pads, &f->outputs, p); } diff --git a/libavfilter/split.c b/libavfilter/split.c index da5f681af8..81a3a58dda 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -56,7 +56,7 @@ static av_cold int split_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 7d97295dd0..3050d33e58 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -306,7 +306,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.config_props = movie_config_output_props; pad.request_frame = movie_request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index 49a52ecc18..47c2fef0ba 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -941,7 +941,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (s->ref) { @@ -949,7 +949,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "reference"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 9ef03ff1a3..2c2b443bae 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -310,13 +310,13 @@ static av_cold int decimate_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (dm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c index cede3d669e..2d26369c2d 100644 --- a/libavfilter/vf_extractplanes.c +++ b/libavfilter/vf_extractplanes.c @@ -352,7 +352,7 @@ static av_cold int init(AVFilterContext *ctx) pad.type = AVMEDIA_TYPE_VIDEO; pad.config_props = config_output; - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c index 9626737b40..eb7e0c9ebb 100644 --- a/libavfilter/vf_fieldmatch.c +++ b/libavfilter/vf_fieldmatch.c @@ -970,13 +970,13 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (fm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 4003b9578f..17e94764f1 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -442,7 +442,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (s->guidance == ON) { @@ -450,7 +450,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "guidance"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 30888f62af..e8112abba8 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -96,7 +96,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){ + if ((ret = ff_insert_inpad(ctx, &pad)) < 0){ av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index 5bd056759e..e8db74c7cf 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -125,7 +125,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index bc8e080e4c..d6fbf499c9 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -790,7 +790,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "main"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; if (!s->inplace) { @@ -798,7 +798,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "alpha"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index 5f455e9afa..1682a5d7c8 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -287,7 +287,7 @@ static av_cold int program_opencl_init(AVFilterContext *avctx) input.config_props = &ff_opencl_filter_config_input; - err = ff_insert_inpad(avctx, i, &input); + err = ff_insert_inpad(avctx, &input); if (err < 0) { av_freep(&input.name); return err; diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 69930e9f02..52bd515446 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -664,7 +664,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 38e5aa098b..5b0203fbcb 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -123,7 +123,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c index fa131a7259..462e0b82e7 100644 --- a/libavfilter/vf_xmedian.c +++ b/libavfilter/vf_xmedian.c @@ -118,7 +118,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_insert_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; }