From patchwork Tue Aug 17 01:51:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29580 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2549455iov; Mon, 16 Aug 2021 18:52:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZAVdARV4SvI1pwhf4Nc70z3o8bHKphWNla9PQcIsnwypke6EIx06WZGc/izxu1oUWRJjR X-Received: by 2002:a05:6402:278b:: with SMTP id b11mr1191502ede.339.1629165151515; Mon, 16 Aug 2021 18:52:31 -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 pw3si649684ejb.206.2021.08.16.18.52.20; Mon, 16 Aug 2021 18:52:31 -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=ln4UsLZ+; 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 4AC1868A590; Tue, 17 Aug 2021 04:52:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069066.outbound.protection.outlook.com [40.92.69.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0386968A1AB for ; Tue, 17 Aug 2021 04:52:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gcdmgOi+gYADVi+Raa6HujDMh/1V3F0jqx4ultw9MyEGPH50yCKMyWVGGEAWDyRUJyEDvBh9/J7NJf3lMvn+c+Wpd5AKKZZWzJDRBFqXSK3cMFcVEcer+cdA3nWzam54LLbXbpLliY5XaChbYO60iCyUMvXbMny7xz8IT28WomNLk7HddIPxkhjvHfz/G/sdUh3LXiZht/v7UhKk5nGjIa/Q4B0eeIit4XVfrv5dWaNllHfa6PmUq+U7nynWFm4n8u+xggT7FAWoMtmmp0eO6HqYCj9mu/bUgES/SCzW3PJVeJO8U/LIvA3RxwfxYprulTipmELGtfit0rKE0yeMCA== 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=Fl/QtVBvsn4bY/nDguUNk709ZteJJviUFmXCGa36dJY=; b=bKayq7gUW0BRi9ilxKCG6/JUV3FRp9v4ISSX95Hv4sdTv5GUIobHduBwrNs2kShKnU0EFqy8b9a6gtZfP1W7GaU/SblDzWQsJPhE3bsHnzNpGjYu1OIMC+KK8h/R+0tzZy5m8JTDXBNngG+3+L9lccwTRyjng6Zyu0/rzZVFAnPJrqaXKKVcYegXPvnzVScfbuXFpZFimF2ra54cOPYd9RS401FO6LDHFCZwfHk+nGpG6RPrkP1O6Z4HrRbBqZqwZh3os2EO0pGh6NeUixllY9tmYzJPTTOg8ot8Ql9RZ0+Tlygs6DJRKAgQmMqG2iJ+lVxEhlJtr0DxJl6Zwekqng== 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=Fl/QtVBvsn4bY/nDguUNk709ZteJJviUFmXCGa36dJY=; b=ln4UsLZ+Vxm7yTG4ur2LRTB4IZhPgWXB8RzAtLa3LwU+x+V2SMYjnYdcqwtBpCymt59tkVZY8dp0muB3tdWsVvtzcHUqJmvani7/gkb+liwn7TqklDZOQ2nMigy/L1l0hAp9QN/hALE9V82GbUb+4me48ApljciLJacjX/jLQgqqoX0Wi92uWcghV7evnZ+eUI9LBXhADhTj178RYr2SHFonkJkkSwS3FJHD2OdEdxdP1obskh/a94RJsmdtkrxIKrQ0UsGpD9oGvSApi6BItMbybNiLkGqR5VWunabbwcEpEhRkFt4jHPC/db9kjin9qIcPs+kLDLF0bcRcE0ItFw== 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:52:07 +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:52:07 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:51:48 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [qSQlasBZDtZ8r0kNcjCweiWyZ0gtvLCv] X-ClientProxiedBy: AM0PR02CA0193.eurprd02.prod.outlook.com (2603:10a6:20b:28e::30) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210817015153.2983256-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR02CA0193.eurprd02.prod.outlook.com (2603:10a6:20b:28e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17 via Frontend Transport; Tue, 17 Aug 2021 01:52:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23325cb0-7b08-4cf3-703d-08d961219ed2 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNViLEfi+B1v2fp/64glZbG/8x4r4E21W6GJeBV+5MjoRcVI7gxW19xdTIIb7bxjttNksfP7iEpqFPe/uUJp6STUjjMJB7rdz+m2HEuXhv8TLc6uoanWwAjGfjYYSljyp2To7i6FTRHH/g3Ei2k13X7OkzhARs56kOrezu4NC7Up3p2c6h2r13Nm7uJAfBy2RoZUftzScYS2kEmV4mSvkE6hDz/Wxa+BQvfMzrKCKieQuXLV8XeARX3KI2aiylfFSuZ9WiB1KG37IHEC3z88yWb4d0lAFIVIr6yJOXEEYqp9+UExmBRYjh61NLwpPfyHwpLgJrfqVjX7qFcRxji+V8rUrZzoLLXFtpVRasPKQPxohRgx34awDPfnwFqrA+LCurH+d23VVmYgnTgGKYSFy2Tim0Sk6LP9yHlKD1Ch7nMfGerqX1bzR+EfdW0qIiAKlAw5S/UwPiKTco76JQ1+IFj6P92HVcCxi3MkGuDJAHqQLgk0eLArFQXXWz0nuwS01rknovra6UyFI6+NJJD7x57dnoII5AEu+2NhfW5Wf417bp9wKQjGCL4ULpe7T9jX2ee4ygkMFnBepoUCk/Fgt7X8MKh+AvUzTZlEOjUh+23i98I5ULrTkbp8GX+9+qEt07JXgTZLL38ZecmC5v+YXlFhzvQUspou1lxaWKdWYkXD9hLE0+uFsZaASKoaiukt7RjT5lWvKZvGYBC+LVz4juYvtV+cK5F3yRs= X-MS-TrafficTypeDiagnostic: AM7PR03MB6264: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w9uQYtljfGJyM9+q5KSTXVwMXJ8tMziQYe5ztPaQ/c+qsPcT0WmFgxzp9m51iwSzL4a2AJ7KGoVc9oaaWmsN4uTBjXuMXWcaXRm6Z1FSJAslM0SFLXk0rRESB+BOFPv+1fLYxIdw9gCaIe/dJ8V+NIEVEjk0nr0p1OJ8S+kNOhOE4ME+BLmyjwKst17XbQ3gmhx0570m5yaCAAK4jBHlYEk9BYyouvTPpua+JhxAH46SGywpOgw56o2sbHzhxStHfVqi+u/z71i1Uc1jtbYsNIhHQOZ2w0VdHEWmD88EL3dY1/cHvYA3s0mWAu07abZMEHrHTIh08O9R8b8DrWg2D3+iDSckWNyA5VWovhItCGmuvbDQEufki8AFjOdwDFrhCHncBm0UE+tVU5dXnTaOwj12KvCA9V3zaWum33A51ykQ73aCSQL28zeEWngJRYRa X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y5HKKgSBJ3GF143VOwD5EhPi6WiPlPj3+qDLP6i/wxwgfNvomc4hxZzKAhMVHb7Coiax869bJEb1WmUcsJqpA4hSmHFF4+ckjuvgASsIHpXDcdykl4yo1+aPooXTOEn5GHKR7nvsjtt/VStiCjAUag== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23325cb0-7b08-4cf3-703d-08d961219ed2 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:52:07.8660 (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 1/6] avfilter/internal: Replace AVFilterPad.needs_writable by flags 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: lq13Nr9TT/l9 It will be useful in the future when more flags are added. Signed-off-by: Andreas Rheinhardt --- libavfilter/af_anequalizer.c | 2 +- libavfilter/af_channelmap.c | 2 +- libavfilter/af_firequalizer.c | 2 +- libavfilter/avfilter.c | 2 +- libavfilter/f_reverse.c | 2 +- libavfilter/internal.h | 21 +++++++++++++-------- libavfilter/vf_chromakey.c | 4 ++-- libavfilter/vf_codecview.c | 2 +- libavfilter/vf_colorcontrast.c | 2 +- libavfilter/vf_colorcorrect.c | 2 +- libavfilter/vf_colorize.c | 2 +- libavfilter/vf_colorkey.c | 2 +- libavfilter/vf_colortemperature.c | 2 +- libavfilter/vf_datascope.c | 2 +- libavfilter/vf_despill.c | 2 +- libavfilter/vf_drawbox.c | 4 ++-- libavfilter/vf_drawtext.c | 2 +- libavfilter/vf_elbg.c | 2 +- libavfilter/vf_exposure.c | 2 +- libavfilter/vf_fade.c | 2 +- libavfilter/vf_fillborders.c | 2 +- libavfilter/vf_lumakey.c | 2 +- libavfilter/vf_maskfun.c | 2 +- libavfilter/vf_monochrome.c | 2 +- libavfilter/vf_subtitles.c | 2 +- libavfilter/vf_swaprect.c | 2 +- libavfilter/vf_vibrance.c | 2 +- 27 files changed, 41 insertions(+), 36 deletions(-) diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c index 9aab577079..b9d02e28ff 100644 --- a/libavfilter/af_anequalizer.c +++ b/libavfilter/af_anequalizer.c @@ -757,9 +757,9 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index f77bba363c..82df3ace15 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -383,9 +383,9 @@ static const AVFilterPad avfilter_af_channelmap_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = channelmap_filter_frame, .config_props = channelmap_config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index 7e18db5517..d2114a515a 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -939,10 +939,10 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar static const AVFilterPad firequalizer_inputs[] = { { .name = "default", + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, .type = AVMEDIA_TYPE_AUDIO, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 843b5947e5..24184ed1ed 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -950,7 +950,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) if (!(filter_frame = dst->filter_frame)) filter_frame = default_filter_frame; - if (dst->needs_writable) { + if (dst->flags & AVFILTERPAD_FLAG_NEEDS_WRITABLE) { ret = ff_inlink_make_frame_writable(link, &frame); if (ret < 0) goto fail; diff --git a/libavfilter/f_reverse.c b/libavfilter/f_reverse.c index 2b3ffd28de..29ba5fe9eb 100644 --- a/libavfilter/f_reverse.c +++ b/libavfilter/f_reverse.c @@ -269,8 +269,8 @@ static const AVFilterPad areverse_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index c2be4a18fc..e7a9275114 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -60,6 +60,19 @@ struct AVFilterPad { */ enum AVMediaType type; + /** + * The filter expects writable frames from its input link, + * duplicating data buffers if needed. + * + * input pads only. + */ +#define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0) + + /** + * A combination of AVFILTERPAD_FLAG_* flags. + */ + int flags; + /** * Callback function to get a video buffer. If NULL, the filter system will * use ff_default_get_video_buffer(). @@ -112,14 +125,6 @@ struct AVFilterPad { * and another value on error. */ int (*config_props)(AVFilterLink *link); - - /** - * The filter expects writable frames from its input link, - * duplicating data buffers if needed. - * - * input pads only. - */ - int needs_writable; }; struct AVFilterGraphInternal { diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c index a3d4caf411..185b3980bc 100644 --- a/libavfilter/vf_chromakey.c +++ b/libavfilter/vf_chromakey.c @@ -367,7 +367,7 @@ static const AVFilterPad chromakey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, @@ -420,7 +420,7 @@ static const AVFilterPad chromahold_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index 1b5c67e7d4..944d8fb303 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -300,9 +300,9 @@ static const AVFilterPad codecview_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_colorcontrast.c b/libavfilter/vf_colorcontrast.c index 8975033760..1f4c0db43c 100644 --- a/libavfilter/vf_colorcontrast.c +++ b/libavfilter/vf_colorcontrast.c @@ -358,7 +358,7 @@ static const AVFilterPad colorcontrast_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c index 3fb2798256..f28409fa44 100644 --- a/libavfilter/vf_colorcorrect.c +++ b/libavfilter/vf_colorcorrect.c @@ -303,7 +303,7 @@ static const AVFilterPad colorcorrect_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_colorize.c b/libavfilter/vf_colorize.c index 84876b78da..14c29d6486 100644 --- a/libavfilter/vf_colorize.c +++ b/libavfilter/vf_colorize.c @@ -259,7 +259,7 @@ static const AVFilterPad colorize_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c index dea7f89e28..2ebd470e6e 100644 --- a/libavfilter/vf_colorkey.c +++ b/libavfilter/vf_colorkey.c @@ -176,8 +176,8 @@ static const AVFilterPad colorkey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_colortemperature.c b/libavfilter/vf_colortemperature.c index a5ba4a7b6c..9cf3767925 100644 --- a/libavfilter/vf_colortemperature.c +++ b/libavfilter/vf_colortemperature.c @@ -324,9 +324,9 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c index 70857ea491..6a9349d0d8 100644 --- a/libavfilter/vf_datascope.c +++ b/libavfilter/vf_datascope.c @@ -1130,9 +1130,9 @@ static const AVFilterPad oscilloscope_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = oscilloscope_filter_frame, .config_props = oscilloscope_config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_despill.c b/libavfilter/vf_despill.c index 5fe9b79dd0..3d56659149 100644 --- a/libavfilter/vf_despill.c +++ b/libavfilter/vf_despill.c @@ -131,8 +131,8 @@ static const AVFilterPad despill_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 373a6f45dd..c729ed577a 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -384,9 +384,9 @@ static const AVFilterPad drawbox_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; @@ -468,9 +468,9 @@ static const AVFilterPad drawgrid_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = drawgrid_filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index c4c09894e4..c274166b9b 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1615,9 +1615,9 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c index afaa6225d2..d07b0cf0cb 100644 --- a/libavfilter/vf_elbg.c +++ b/libavfilter/vf_elbg.c @@ -235,9 +235,9 @@ static const AVFilterPad elbg_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c index f8bcf28e6a..b61d90658b 100644 --- a/libavfilter/vf_exposure.c +++ b/libavfilter/vf_exposure.c @@ -99,7 +99,7 @@ static const AVFilterPad exposure_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index d801bf8c95..07bb05478d 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -551,9 +551,9 @@ static const AVFilterPad avfilter_vf_fade_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c index 8ceac44c76..8653611393 100644 --- a/libavfilter/vf_fillborders.c +++ b/libavfilter/vf_fillborders.c @@ -705,9 +705,9 @@ static const AVFilterPad fillborders_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c index d59ad2d5ba..b556f7ab7a 100644 --- a/libavfilter/vf_lumakey.c +++ b/libavfilter/vf_lumakey.c @@ -172,9 +172,9 @@ static const AVFilterPad lumakey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_maskfun.c b/libavfilter/vf_maskfun.c index 0a6d17f7af..da1cfe91cb 100644 --- a/libavfilter/vf_maskfun.c +++ b/libavfilter/vf_maskfun.c @@ -294,9 +294,9 @@ static const AVFilterPad maskfun_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c index 0471c7d237..825a869707 100644 --- a/libavfilter/vf_monochrome.c +++ b/libavfilter/vf_monochrome.c @@ -267,7 +267,7 @@ static const AVFilterPad monochrome_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index ab32e1b7f3..2f7f927d8d 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -198,9 +198,9 @@ static const AVFilterPad ass_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c index 3b96790798..7829f2f852 100644 --- a/libavfilter/vf_swaprect.c +++ b/libavfilter/vf_swaprect.c @@ -228,9 +228,9 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, { NULL } }; diff --git a/libavfilter/vf_vibrance.c b/libavfilter/vf_vibrance.c index b8f9fa0198..bc53f47a7b 100644 --- a/libavfilter/vf_vibrance.c +++ b/libavfilter/vf_vibrance.c @@ -340,7 +340,7 @@ static const AVFilterPad vibrance_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, 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; } From patchwork Tue Aug 17 01:53:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29583 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2550483iov; Mon, 16 Aug 2021 18:54:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzglm1PJcuRh33iFkHABo/3w8JH6MlNXx/zYX484gj/MeAqvwZV2eHgopS5yzb/xdNglV32 X-Received: by 2002:a17:906:b890:: with SMTP id hb16mr1091853ejb.383.1629165269195; Mon, 16 Aug 2021 18:54:29 -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 n23si672373eju.62.2021.08.16.18.54.28; Mon, 16 Aug 2021 18:54:29 -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="aDIZ/U55"; 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 7746E68A5D1; Tue, 17 Aug 2021 04:54:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2015.outbound.protection.outlook.com [40.92.89.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7C2F68A5D7 for ; Tue, 17 Aug 2021 04:54:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhH8suM08ZknMxf53AkMWb2sL+GalpdLyzMjaD0TIIegJ3pLWc6XpOioJ4o5seNwKNEgY4H2Ia6L8fhlqnMVR1Ip05ceuVfG1ku/e+tuDrVIthgvOzA/vh7GflDayvHk3URgLjNbioZquNTovHpCxPDH3EomtQQ9JPpEniQ5Mqn+QBKnj0JVJ0ZO3tbzzYhjeINgi4Z7cJp/bYu5UQ253v7zkpUhTdAgi5lXIltz8pqWV4F9EKGq551nPS7JszTQP15t9E/u9Sj7lbaQC9e3X8Ij067bo7yRwwCvz3PaiRM+yKZJzSqRQSolwLuEkY2UcAvqv7r4Pw8ZDiKqDjpE3A== 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=JWAMDHkz+CqqO0C4vhFTotb4bIf8U9ukrmid+p3qIo4=; b=gaeFU6snRA7bm6w+5dcDwe1CrLZyDu/ynHRFyohil4iCPBWMffMSSXNdiQgtx1PYZ81Z/kRklXTzFjVGPywDPEykbUGxMisb6k17d2EzHuhAITkKM860zlLhO1aK8ircPYtdLhBBPsr7wNH2M6ahggnGvy839IINN9Q17E4zjUMYBcKckX1oecXHJZJ98heUfHNVAS6IGDbjJ0jFyrezqY13CPFyNfua23Kl9ULGZOsDfCOSS7G7WhuENGcIE3OTv+UjXEMRvi+oiR28S7Etw8WaOFksAO+ZYKs2ItG813DDMI9wAhJ740v9+Wn0pX/GXY9ubX12lkW468BuIahBKQ== 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=JWAMDHkz+CqqO0C4vhFTotb4bIf8U9ukrmid+p3qIo4=; b=aDIZ/U55KW0iNV2syvG8rw2ODx7ThL7FvuKHFgN+n/Lk6oqgPViDtE/vrCyIWW5rWu2CMsc6XurfDtURmq6IIfNUm2Jt6fCugcoyNh1/L7M7ozR61ES959IKX3Ge3/2gNeuO3ALEOcwMN+TzLPBxdKU1cuBMS4B4gxRbCpN3AmcJ5h8YAfDRl/rf5G1ZLWTpvJvzGV0D1zLoXF7i57JO+LIsY6q+MkWnfmpWEynoAFNAx/X5fVzoei3zt0xrf537k4Z/uKKSTcJyNG0RSobIcrKJqHOPxOfUse2Wxeh0csA9IftNJC5U2aUjOJMuiC8+oOuOaUoRGoAz2SKfmgbcXg== 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:16 +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:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:53:55 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [k2sn8sY7bzMpsR6estmUUjRp8Q5C4Mu1] 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-2-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:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a311eca-fa68-47b6-b3d0-08d96121eb84 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSp1XYbE3vnwSazxHNSRmcCrQRXOWPXXNPO+2tURQ4hCfJ9gu70SdLSuI/Eb9hY5Bq9RKRnZSpD66Ezk5TcHcAOmsOsRire6uxaFP+fGdiG5tZRSO/0hm1oMKGUypeVo52X7fpFK1aJgfw8QgLqGnnMTlH6/PyEA59gCVdA+Fhc/Hm9nCICZCK2t2I7D+UUiD1IS+UL687Cj3frqA/0rWD1hhSQ4y/QQgsSoYRooAI9E9l6JEVcIx3LWPbuLZkjTOd+u2ntkHGXkY4dsPat9SXzWPq6DbD1etKKzbHWujmOiop+o51pW2302m3l/eXTK+riiUdtwv4Ch2kcKMo6TlSd3DjgwKDRNxvJ5mVRb4F7pt3btBwGeLDoteauhor9vUqsLDfdmg3pjz5iWhrjXrlIew9NavZ+Ga2oZo9D7iI/Uz3oH+G8CayNV6YJ6AUUs3trfx7wxEwaSPRponkNYUFH01XZh7J1qSziaoCEhSe6ufcWT2wB12vnQxJZwsfUSDc06qu4pNqqpepCHOt03DtcCkApLv552cIwzlWWS6gj6vPWCW7jCjI/J5Pd6ApE+KyUnu6X5Qt6oUZjTmq2jH8o1ZOzX/aH0Orqvpj4dlEmi+C2QbT2A3U96Z6vmUQWC5EwRV4YcEKcMjXsvtcXbHTKoGoiZi1tGqqFq7RQ0zuwyZIi6+yownyHn+czqNaUmFfukXvLyESxSUxD+8/YQWwNc2+RzgO7RZPkKgT3ezA2nDCiah/UQ2AUU0B+Q3wblHc= X-MS-TrafficTypeDiagnostic: AM7PR03MB6264: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rnGveF0YraYNvQex+RY8P8rsrQ5IeYm/n+iktcQ1SYPalwNxo4skyGWLwDSezEiAbp8VU7G9yo3mRQL5kYiNZVQSCA8h/gyzKmbOU1/NsJrbLkzWJflzBYKm+MkejHEBpKkoh7j40IdTNwIEImn8aIgUpCnXRCZU02Isc4fqzXHY3/lbrS3RcZNaYkDPLrA46vQ7lKHa/0AAd6gSlOWfokoRLb0cYw/Knbu0uYFA7YCCyscnOGALtfuoitUVg+jdmkisolZj4xkxWM238ldM35Q5iBhH1deedm+qVUwLDWUEqmMWxM4DZrX0N+wUH0dFpxZ2TQTxNhViTw1u+qjXXyhC5seOLfkb+K9zDatySOs8sIBMbZy09sBgfwRplQftaUnfMWFhO9zMX/MoHd1CrcYx7+3JPs/PDD/CpwjGkkV5W8lXrhB2NtUav+POxPLx X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ojWOcPW6I1EmyvUR9QzjZXWJFCqFPXGRcYjGMxWz5KGddeQ3X7EoMmouHNtsenMCoCquAch4P2sMZF9p7ylHb9Ge8R6S56BYOA7DnScmVemmuBtS+g7SJPoe97c8bmKY2cQ69+NMIzirG3UmOCh83w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a311eca-fa68-47b6-b3d0-08d96121eb84 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:16.4715 (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 3/6] avfilter/internal: Uninline ff_insert_(in|out)pad() 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: AUvOKjk8n/ki These functions are not hot at all and future commits will make them bigger. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 24 +++++++++++++++++++++--- libavfilter/internal.h | 29 +++-------------------------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index af371e4fb9..c3382036d2 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -101,9 +101,17 @@ void ff_command_queue_pop(AVFilterContext *filter) av_free(c); } -int ff_insert_pad(unsigned *count, - AVFilterPad **pads, AVFilterLink ***links, - AVFilterPad *newpad) +/** + * Insert a new pad. + * + * @param count Pointer to the number of pads in the list + * @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 + */ +static int insert_pad(unsigned *count, AVFilterPad **pads, + AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; @@ -126,6 +134,16 @@ int ff_insert_pad(unsigned *count, return 0; } +int ff_insert_inpad(AVFilterContext *f, AVFilterPad *p) +{ + return insert_pad(&f->nb_inputs, &f->input_pads, &f->inputs, p); +} + +int ff_insert_outpad(AVFilterContext *f, AVFilterPad *p) +{ + return insert_pad(&f->nb_outputs, &f->output_pads, &f->outputs, p); +} + int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 13d0e2b457..8fe17a5433 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -226,33 +226,10 @@ void ff_tlog_ref(void *ctx, AVFrame *ref, int end); void ff_tlog_link(void *ctx, AVFilterLink *link, int end); /** - * Insert a new pad. - * - * @param count Pointer to the number of pads in the list - * @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 + * Append a new input/output pad to the filter's list of such pads. */ -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, - AVFilterPad *p) -{ - 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, - AVFilterPad *p) -{ - return ff_insert_pad(&f->nb_outputs, - &f->output_pads, &f->outputs, p); -} +int ff_insert_inpad (AVFilterContext *f, AVFilterPad *p); +int ff_insert_outpad(AVFilterContext *f, AVFilterPad *p); /** * Request an input frame from the filter at the other end of the link. From patchwork Tue Aug 17 01:53:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29581 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2550553iov; Mon, 16 Aug 2021 18:54:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+JDQRmb6Lcaw7SWcDqjXKJi0liTBvbQToDYcGyDjGMvbmU5nDmm/CBU0Tg8C5UCxLKVPi X-Received: by 2002:a05:6402:781:: with SMTP id d1mr1308318edy.32.1629165278612; Mon, 16 Aug 2021 18:54:38 -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 g17si803355edv.391.2021.08.16.18.54.38; Mon, 16 Aug 2021 18:54:38 -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=sVQPiNYA; 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 8EBBC68A61A; Tue, 17 Aug 2021 04:54:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2015.outbound.protection.outlook.com [40.92.89.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA41D68A5E3 for ; Tue, 17 Aug 2021 04:54:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QNBioJoTYY4gNK48Uv/KTrlwDGnSBrgz+7EgibRFEWLN7PmOzwD7LtvlAtc+Hn0nM2cmXZJRSXV9qISyba560h49PTtJw5MBN/4eHCd63+LzT39LunYIVl3kBXRQDtydxxNIwZAfZ6sUWaBczF1VtKGHaXAiUem2pCGQB75iZXRXAPxPvWFeRwOuufMUsApNkKgT19HutSSXr6+rhet4UCh9u91LLWrKtjYmfFkRwczlpLg2rpdjR3vue3qni/VMZ4zkDW9QG6caNKo01/8Rkky1k6w4wARONWXsxoZI2gtEa8qFTjHOW4y30YGH1giy9MHH3HK7fc+oeNh5Ye7Sag== 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=H5KhfAe1OI0SYYuhVBknKCmbYp+wcfuFlb1D6CKM9k8=; b=GUnmo6S4NlmDwHjNNaisnWdCbPz4R+LIiqft9GYVjGwjeaNOVF0TAJwB+T2qUapYoF5hZsBfv4vJpWsukxUSlhko216tuggz9jzw7r4EoZtfCzHirbv8rbBvxDDFxkp3pj/1ryG26WVJ7qMu6bqKhK2Z+9y2wsdnMN+yWvD0FBirAgI68PolSadHtla09heQVTOnxWiNA2X6YE3fj2mjxcdvT3CdrlLbbdTNy5nOLJkKb2zJTk8orVQlPqnvEzeuyD31iywZBDlbN4v6jF/4XsfeNpxBcsk835HcyjVzKZQ/fSwMqkPS2/00Dek906q7dXOjZFWMzbb9SAjPo54CXA== 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=H5KhfAe1OI0SYYuhVBknKCmbYp+wcfuFlb1D6CKM9k8=; b=sVQPiNYADwVPgft8RJCwxr7oPgR/rTEROUiGmDZ3rQjLFUhv8V6qlAYX/fAdq+fDN15xwAPnBnpnCAdSGxm9f0RVnvPmX9+ozuE0Cp3jJ8P/XgcU4e0Wg2enPsMePCsIpjDTecmKxro0sAV973RP5BGXl7Ecp6R4bO4OfOcZdiJWe/vv1MWC75SbMuN+sO1xE5LDb/aXIKu+4PpntQspV2fr35i9qrTXtxAHcb9rhMwuhiSHrrWXNJr551ZFHjaBi7rgAbSZCxAioCEQK2DOALy3cspHFwuKJTRcSUylrG+TYHmKonH5glK73OtrPTz0j5akpW3TL6juwBmYrmuQSQ== 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:21 +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:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:53:56 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [/UMpFgRGZV0MC9q2GytT94fqL4AXwQ3s] 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-3-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:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c151929-0d8c-4269-541f-08d96121ee69 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSp1XYbE3vnwSazxHNSRmcC0qzLA1iKopkemQR0tXBiOZ7cMvw3cxS/IhjjxjG2FP2uVscW3HzT8h/1djjTov/vVXowV6AsOnFGutsIaW+vFnwzGktR2L5nMmEVCKe+F5iufnn+7S86nyCLReO3NP3cY2OA3U5XpxV84GFNksSYhjMQ35kwuieqVPRypvuIpIDN9aUpbchHtHcTxLreeuoVIQR0aZBAfo2WiFSsWsVJdQOawXrPLmQMAZ2SC5QWWtGf0XT+Z1cB9caPbnwV2+nuIXtMcHBrOlebSPHMAWP4HH/Sqn2uRTocHwdbwh07rO5O/7rE1b4DXTl3W9erIIX+yrIEOU51gz1snKcE2a5Lo3mQ5dtPrDziC7JETFtHGLQySovjcDCW3jWWutCprLIj6PLqTHGEaYlKay+UVuE6c6BcFU9bmH2tMCHUXiocd4/cpYQ+FOs3Ef/FF2xH6/i9xZM6EsFIeRc2TYYBsKtwG3Uib2l3hqeuXUTXr8/g2NvKNIrbG4DrnTshXZj0NfMCwHZ/IAj5HGzvHRI2Sxzs8qNCXmoyBJd1b5J3LAidIMAqX6/MvbVNAVJuhDJueEnpp5RtxqzSjn8UJnyQjJb3D8XpUy+4Zh1U2BxeBcTc3v9mJY8pPtTWXanKI3f0Um8l5YUH/BuaP9KH8NBKdU97Zum1TQmxGCwFV0CGsYnpDkPxmxRl+x/frlUahRViGcn2af55+jvk+8nMkxVqTp/j0UyBDocTRQxWEA2qppeGP6I= X-MS-TrafficTypeDiagnostic: AM7PR03MB6264: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: or6WdEYE+VcvhxW6dDBbiChrKnEevdpRfTg6JbLiPDU+SjegRDUAPOlM/IB65akg6ItVCgKAyEOI+v4rnOpxKFSAxvJDBd65Uj4wI0d8PrYj4Ox1iARLnG9rJ9GosnMUpH+3APPy5izXZnlSP3mpXuFlkrq0wXvKI8PvpcFxxAZZyOuNIVdD/DYREfMjVQqAyc2+PjTwLEj0dFMPLBsOXYXPIHz9N2KUA5n6lJKXWPGwp1iVgKCGE7hX93P12Bz2VYCTmezzttOJtI8skjOH4g3rozRbW8rrLsOyIO2i9wFx6dRggPKScYENIo1vKngNZcYdpa2W+gsnQmZZfWrPtmRamwX+18o/qD3pu/Yxe0o1Yu6pRXnNyTF/Is8tot0L5fDZyfBuWmd5mYFMStB1Cpsf3VD2Ed2d7AkVbO3JBSlLtR4dg5X4f/wn0WF7n9go X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 13QaGuZJAI9g9f61FL4HpoDFCz0ys6P+Q2+9X4beOoZh0/LmtRS+kZ1BI7AnxpWc+Lk47cY1HtlRzpeE5Twk6/RRYWbxmTdHLpA0c9rWEbWdUpS2JiIYXg84KJl1NS/jOsWeG83GzA+qerocQC2rdA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c151929-0d8c-4269-541f-08d96121ee69 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:21.3153 (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 4/6] avfilter/avfilter: Allow to free non-static pads generically 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: yt2GzoGEU8lo This can be enabled/disabled on a per-filter basis by setting the new internal flags FF_FILTER_FLAG_FREE_(IN|OUT)PADS and on a per-pad basis by setting the AVFILTERPAD_FLAG_FREE_NAME flag. Signed-off-by: Andreas Rheinhardt --- I decided to combine both approaches: It has the advantage that the marginal extra code for a filter all of whose inputs'/outputs' names need to be freed is zero while making it easy to handle filters that have some inputs/outputs whose names need to be freed. libavfilter/avfilter.c | 15 ++++++++++++++- libavfilter/internal.h | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c3382036d2..48727201f6 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -123,8 +123,11 @@ static int insert_pad(unsigned *count, AVFilterPad **pads, *pads = newpads; if (newlinks) *links = newlinks; - if (!newpads || !newlinks) + if (!newpads || !newlinks) { + if (newpad->flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&newpad->name); return AVERROR(ENOMEM); + } memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; @@ -136,11 +139,17 @@ static int insert_pad(unsigned *count, AVFilterPad **pads, int ff_insert_inpad(AVFilterContext *f, AVFilterPad *p) { + if (f->filter->flags_internal & FF_FILTER_FLAG_FREE_INPADS) + p->flags |= AVFILTERPAD_FLAG_FREE_NAME; + return insert_pad(&f->nb_inputs, &f->input_pads, &f->inputs, p); } int ff_insert_outpad(AVFilterContext *f, AVFilterPad *p) { + if (f->filter->flags_internal & FF_FILTER_FLAG_FREE_OUTPADS) + p->flags |= AVFILTERPAD_FLAG_FREE_NAME; + return insert_pad(&f->nb_outputs, &f->output_pads, &f->outputs, p); } @@ -741,9 +750,13 @@ void avfilter_free(AVFilterContext *filter) for (i = 0; i < filter->nb_inputs; i++) { free_link(filter->inputs[i]); + if (filter->input_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&filter->input_pads[i].name); } for (i = 0; i < filter->nb_outputs; i++) { free_link(filter->outputs[i]); + if (filter->output_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&filter->output_pads[i].name); } if (filter->filter->priv_class) diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 8fe17a5433..0d0335bd1c 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -68,6 +68,11 @@ struct AVFilterPad { */ #define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0) + /** + * The pad's name is allocated and should be freed generically. + */ +#define AVFILTERPAD_FLAG_FREE_NAME (1 << 1) + /** * A combination of AVFILTERPAD_FLAG_* flags. */ @@ -227,6 +232,11 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end); /** * Append a new input/output pad to the filter's list of such pads. + * + * If the underlying AVFilter has the FF_FILTER_FLAG_FREE_INPADS + * set, the AVFILTERPAD_FLAG_FREE_NAME flag will be set for new inpads, + * ensuring that it will be freed generically (even on insertion error). + * Similarly for outpads. */ int ff_insert_inpad (AVFilterContext *f, AVFilterPad *p); int ff_insert_outpad(AVFilterContext *f, AVFilterPad *p); @@ -317,6 +327,16 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter */ #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0) +/** + * The names of all input pads are allocated and should be freed generically. + */ + #define FF_FILTER_FLAG_FREE_INPADS (1 << 1) + +/** + * The names of all output pads are allocated and should be freed generically. + */ + #define FF_FILTER_FLAG_FREE_OUTPADS (1 << 2) + /** * Run one round of processing on a filter graph. */ From patchwork Tue Aug 17 01:53:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29584 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2550728iov; Mon, 16 Aug 2021 18:54:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAvFDxZXlT8FrPi62oOjYirqCAERx6ggWEK6SaGG2wJQSNClPprkkiRTLbjZTj+9rzPwqr X-Received: by 2002:a17:906:3e51:: with SMTP id t17mr1134432eji.375.1629165296570; Mon, 16 Aug 2021 18:54:56 -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 b6si811727edu.115.2021.08.16.18.54.56; Mon, 16 Aug 2021 18:54:56 -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=dX7NYrwE; 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 77D3E68A63F; Tue, 17 Aug 2021 04:54:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2015.outbound.protection.outlook.com [40.92.89.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18A8C68A628 for ; Tue, 17 Aug 2021 04:54:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZ8hzx62Q/Qchl4AliOGvcdH89y520/14hSQEUQBX1KgstSFz9ubHi3dFBPP1SaK0Ya8S19f9aYlHNAX/uXWxvPdCAGKt3h/04mxFGCXuhxfSOQWn41RrdtlDmM6NfTwggyuUZ1IZlr30JppIs9Z9g08MdwZXQYip6Plrm/g+Xiru8tYuOnIUWnjkai9dmLwJumngf7s+e/EedO3JSGwGvAMKDnPIuWQwjogAnCuGo9QSAaFSjVD/3RQIP3agjzpAG4PnFAV32TAul2gVEP7+tl+2Xc6fc6T9b6Sn2Apk//E84kcbiPxsMLaWs3YZbL6WYeG0hc0TlRVVQCMno1M6Q== 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=+8xzxvBABHnReDqPmKpA+VKTTwTwIhGtQcoAvUldo6A=; b=N7+0rcF5OU8lbwQF5adR1Aka00Jqu5EFkaeIoqyZn5P5UmecpylS3P7ClBALiZGZaMhNRYgvcdP4GQUKCXyFJu1ya0lO1TO6O0RgQKrtoK2eZ4FeXenicb9lRHmeZr2CA1uHNzIr7eypCYNp1e8BJtbbolLFoKSKX7Au1ratRwJ4lrglzUaZ1dhjOo+0/NJc3oKP2blqTYfQCEM78TATAfq7b5pvqJpjyeIeNXyd+AgEFK1w+9Xd3fIVLRRpGlVpmCJmDKbXWxnMeeeHMCQ3384MBZQ6nEBKkuLrj45KLAT4+LauwY2OYOGR4edCbgzCOVSWbYJwUpgIB8jV3kGj7g== 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=+8xzxvBABHnReDqPmKpA+VKTTwTwIhGtQcoAvUldo6A=; b=dX7NYrwEjOzXP+8M5cEgbkQyvoPzfhoSWBAg+v68AIW1h3nDKed1JrzpwLusplb6TLBGbXN0rMLSwUV43eo+s3vWCoO5cHVr+Ev42LBfwhVvHthSHR8sQpI4bhSoQj55EPClxDgYFAb+XJ6BDBb90p45Zztb8CnGRxfpISquUWZZ9wRQ1SKreik4NWZm3uRgfF8aWwuRmSfltBIIcaaks8Di1jLMXijv5xl7ygqZ6gAnDw8PP/YeoJI9ffF8EWQ73lCOUKqTdOv1Bmx9V2PucE0rVk9ugvOc1YDXlQZ7sT83lbu2fmoE1Sf2fyxwlCx0tcYRLVGwDI7YXm4FvEKgDA== 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:22 +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:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:53:57 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [sFOJWXRM7SB1E6GMCClF5JLrEui1VXmQ] 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-4-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:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c70ee356-f7e6-4be3-3f80-08d96121ef38 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSp1XYbE3vnwSazxHNSRmcCvHfyZbX3PY9sqyrczogH3L27yxA/MJgB13JfJzHQ7MpkcFo4QyrzZdXExyBIg9Mqf9W6cN3fSrVaSA0DpP3X4dLwVd1CKD7tIGUVoNcJJO1uRdDC9rUjUt67rNQdqsWk3Ydq4w1F8wpyL2hC8L18wcN/OsLW2D0eP6pkb3rsDERzfQojEfBPSc7clfinPFPTe/Yc72Jd85wkvDt2LMJgsa235D9fct1tfYYb1Igrzf+sgI1wRsKwWj8d8mePqweRaX8YH3sSDxGIHPsEvLZtr8kYnHZy5iGEolM/FYsGpWnhnX2JMh5I3MJUF9Qbgh2Xjaj6TELAHcvKGOcOoXGwXTgwJZZkMr06cQc4BfEmApngloUgksJLw/UmA7QtU13ke/ixMGbp6HeLdQB67oN7w+Lpa5XZLYHl0xYKo5lWufTqF3vMh6KzERZ/XYtgfhYzacnuw716kEP8sdz/w6Ew86nlFxNPQYxBIbMwOy3/o4igsBsAJX4u+uNyNNSJPUdocDUNhcYUzQOwj3JyT6qFuZJNyNSaODss6RO7Iwq1JkDqpyuUvwJ/rRW8+Rwb60hXouHW5y4kQXJCbCSJGZ8sPAPjB/PXH+qRK3qGyqmMvF1QLGrHP6qJm114vYzuIjmnfD5XBc5a0JcR+exch3J/OfWB4qkwCOpMV5xiCiIYbD4/4l41+r9tiHGpXC8kfePfydWOkkEGYZp3p7V3l7rnljY0+heFhws5/XU/ZZDNPdE= X-MS-TrafficTypeDiagnostic: AM7PR03MB6264: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ONW61SIBeSMY2ez8yUOqSouFcXlenKGKLR10pxo/QWKK3vPtCWC9lmCg9T5YJOvOx1bJ5UbmRxoxiww4A5Px7h4z90yuQRaGTiHKljuKPIWZzKPuCe4FfxE11QMxXvHE6L+e1OO9fICPbnE6ja+6sEIaHhxybOxLr4XOsmxfyNkH0dUKMQi74jvo+karLJqE/C4CyP1kl0fzzKNXtL/dg8xfYjwDmym/MqC5fI3D8UkSbWdaUP9U5iMU5D+sAQmq7YXhnWxpczOHtr7+ezv+OKUc1DV71kvNaJapU/jLR5qQO+pj7qzBmtbQs+8OxKgPefJ0I7sa4kyP51Gm2tbWhQjJSVd7kKvjvc1sAGAD9C9fqithufNCSwSTuDmz5vHOP0jiFiRQc5eOfcdNVKKlavBu/cli/pTzPp7JSi/DPVaFjGTTdq/AB4b8sRlEqbOA X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oiWmAuDTYDxQePMczx9LQFLVzNqaAN5ODYh1d9Qo35jY6xvWQT8MThq7BcjHj3SMDU2OZLtzZ2l1Fzl8z+l2ORQOeHz6nnzHi8iBaFZwk9w/uZi4ac0/vJ8DBARxutCwLipP/DLmFiO+0xkriBv/Vw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c70ee356-f7e6-4be3-3f80-08d96121ef38 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:22.6873 (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 5/6] avfilter/af_acrossover: Free outpads' names generically 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: yGmVvu2SQfAU Signed-off-by: Andreas Rheinhardt --- libavfilter/af_acrossover.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index 1ad7ebad01..0ee9b47be5 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -191,10 +191,8 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.name = name; - if ((ret = ff_insert_outpad(ctx, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_insert_outpad(ctx, &pad)) < 0) return ret; - } } return ret; @@ -539,13 +537,9 @@ fail: static av_cold void uninit(AVFilterContext *ctx) { AudioCrossoverContext *s = ctx->priv; - int i; av_freep(&s->fdsp); av_frame_free(&s->xover); - - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); } static const AVFilterPad inputs[] = { @@ -570,4 +564,5 @@ const AVFilter ff_af_acrossover = { .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_SLICE_THREADS, + .flags_internal = FF_FILTER_FLAG_FREE_OUTPADS, }; From patchwork Tue Aug 17 01:53:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29582 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2550654iov; Mon, 16 Aug 2021 18:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy1v/FEiUqjAQID2s3aE4TKCiYTsy8qP0ZWpXtlCseJjmbVwji6CRB38qqfCp9C4U7ZyaT X-Received: by 2002:a17:906:17c4:: with SMTP id u4mr1131438eje.481.1629165287031; Mon, 16 Aug 2021 18:54:47 -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 lt22si693640ejb.119.2021.08.16.18.54.46; Mon, 16 Aug 2021 18:54:47 -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=Xn75XFTr; 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 8527068A13C; Tue, 17 Aug 2021 04:54:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074048.outbound.protection.outlook.com [40.92.74.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 62EC268A61A for ; Tue, 17 Aug 2021 04:54:25 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBhC1Ad6cfnaGsjX9RtEwteL3UayDygiu9KprHy8Ag1/LWylRas5jdAURp9X2WB3k5pLlE2huIjw4eKFOgLMPIgbQXKAObTdw6y+xtMsStuLyK1XMU//7i+gEuzUyNk8ZSIWowRf0A03+J0rapNRWSgpYDsXKk3lHRt2HXa26kyBUSxNGflN+R8ZsE7Zm0+II+HE0Lyvd0xOhL2T0elk5Y5/XvEHNfo35MpHsqiV+mCJ2dfEU1RPJQrp8ij5XGs6NjCLAKXl5t29s26PArTEfFcy6MWIlVdDvmqi6hTfrcF0mkiYi9HiZghqUhixJ3cfgYoWa/vIUqZ0532DhJumGw== 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=bHZnW20Rrp1gh+FKoJ4Tr3hYUXjUmOyt2QzyyaBlD/8=; b=FZe4qrwrsOhBAy1pgwHLoDTeJ1KeKziB0ESZJE1XFR75L+XwvhR3VAMDvePfMUD5MJzeUNAFZoYYnZuXWKr8LAbEzMwgPbRHZ+ctHqKZGNJ+tygdTXNnTlnXogpfPf4Dbff3KUiikWNrgyRoJ+F+Usk8gyuzB21Yo1WrEAGUr7DjIF4dcTeEuYED+HbDQoVmMS29xIakOKG/9U4ATi2SOMZMiQzzsc/QqvBkHID3O27uh2OBaenI5d/hoCzfSazxVhtzmnOknAJObWP+qEREDNNq0yAvzpLSHjmbHZK3dxZJN5g/HqhME3sdssmIZtH71iUvSugt/BPJ+xxAWcSwHw== 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=bHZnW20Rrp1gh+FKoJ4Tr3hYUXjUmOyt2QzyyaBlD/8=; b=Xn75XFTrqCULyNdxs7bmxshxZezQ2cYVCyKTZ/AcXn6Qie7F2YenCJuU6brig6U+sHvEJJ1NHb2qb/gbqQgptqvOHN5N/vH+nE2FEmAQwAzceU2ELb1zsBf+3MJUD4HL/XpJeNjksqp7f+pVVMqi/AiXcPQlI0SIwTsxFw+sRiywl8xK8zFX66HbxL7TQ4yGQ30t5PIiHVPGRasSAVBHHr7z0H1iXjKpKhM9O+0wHOlXqfO9K9klt3tD5un6F53+VNhawPvmPMaHMD8l+/4VXtWHzwWzQrTDfUhqpOcEvB/EjsUlXk51S8uBfiET4OhJ7bMOELekz+4P2IrlrsPvMg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB7143.eurprd03.prod.outlook.com (2603:10a6:20b:23e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.23; Tue, 17 Aug 2021 01:54:24 +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:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Aug 2021 03:53:58 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [rBetCN4tLWEc3gVVnosOahBMdkKFKN0n] 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-5-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:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6326f340-2d9c-4e12-11d9-08d96121f01b X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNViLEfi+B1v2fp/64glZbG/Z2e3CI1nJY2TWF/nlOJuNo1Z/RBF6FguBnVJCTQ/r/zkNagIntFA4eMh3MiqVrMNmJuxgJ/bu7TfsGCjUQU2ScOXIJgeluTWR8GVM79pgZstQvPxy61xb1coYrS4jBpS1ZMn/3VcONR/SHnfUF8AEk+a9sJMNwMe13DMI6GtlZYffGg4L4cPDF/WkxKBatoKf0t55Br55VQbz92rp+RK/tbaSnkwtrx6EeY4UgOLIs7qa+iAeitmNCzhM+mHZx2JjFtB4ogj5k0pHzlkEPQsAqCHZBOxrzlo7d/yxFdnjAwfznxkH/tn2drOlWUVmfcpxAS4xLHVJPNo0yQ27ckSnST731qZlwYtB+qW2SgEN59LEQ9HfFhnIBE0wjiYXFxXoFAOr7+7Tf5u9hAEDaA0r7i9sgu4zed1cG6puMUIl+gC8JLGGgwS/CAQYtewShyTmJ478MZJnz8H8vwi7lHGtFBPb55s6TW6yzgA418J+6/IspMyIdCOXzUBWek4SVIkFiABRS6hzWUVikGs0qlZ5JAKJitz71/ku+KX5eQeaO1D4BlYCxogM5kdadm7ggF92FvnpgF7jAyFXbihIjU8XaDVkA7GDEKkhVFlG7nUhCuljAD4tNDyEma20l4t1HOuKJ8ek5xtnkuY3UK2WCfM5fDBG1YpvIJNjitn+WXeRPgBiRG7xlmy9rVsLNSygFQaAvbm8wLk6fM= X-MS-TrafficTypeDiagnostic: AS8PR03MB7143: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SAmSqF0kBooBFJy4oJr3mUok9tGpESkfnWxK+QCx9UpOvVlBou3Byhww9g/H+QbrqRy18Kxjn18XlFxv5uESmWyGT6gTInt9SjzpUbr4QidiUtKb9iakwPf2ryF251YdW2IJ+ysw6USpKo2VgkuRoWV9TXTndZ2Xb4MpBvceYD+ImyFwEBmQEE6oJEAHDJypHT9aLvTdqS+WAp9JW15wF9knv7z00BavnqMhVqxl/socGrNJ45Rbk7bBXzr/nqG4lL9DC4cZ93zkamt0/Pxha0jkPAP4Ds20yIFB0eTdi/ghlSO0HvoKhtylLp2Sbu/K7ABIZQpaR+MRtI/yh5cT/ftR8DMCVAL9lzHgCUP/9bjMo4r3H5LRgCcJ8k1ykXR6zdTRB775tg6WfJzCFyNTh6o/jXcM1uUMukkTwqF9oBdcoL8lazli8cc5L3zLRkwY X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u8Ek7FgvcgwyANtGhuucOOMtLNP0lEYu0D5fWE8pKsb4o7apC+5io9vzogBRxDWFn26x3M2D4Dvhoi0Dm7BvoURwWAdVmwApZwqV15xwVARo5biuI/WAYaDUGpnBd3i47/vWGxx1mNzEb1fl+Ynj/Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6326f340-2d9c-4e12-11d9-08d96121f01b 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:24.1578 (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: AS8PR03MB7143 Subject: [FFmpeg-devel] [PATCH 6/6] avfilter/af_afir: Free inpads' names generically 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: zHSmSvFtetQ0 Signed-off-by: Andreas Rheinhardt --- This is how one of the two filters that make use of setting AVFITLERPAD_FLAG_FREE_NAME directly are handled now. headphone is the other one. Furthermore, the newly added segment filters can also be simplified by this method. I think I can avoid (re)sending the rest of the patchset. If you think otherwise, just say so and I will send it. libavfilter/af_afir.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 670a8c837b..f26ca03810 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -792,9 +792,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(&s->ir[i]); } - for (unsigned i = 1; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - av_frame_free(&s->video); } @@ -844,16 +841,15 @@ static av_cold int init(AVFilterContext *ctx) pad = (AVFilterPad) { .name = av_asprintf("ir%d", n), .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_FREE_NAME, }; if (!pad.name) return AVERROR(ENOMEM); ret = ff_insert_inpad(ctx, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } } pad = (AVFilterPad) {