From patchwork Tue Aug 10 23:42:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29408 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp899339iod; Tue, 10 Aug 2021 16:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJsJosOZZnK+Cu+eXqbgiBivHIgqyNpfVzf+qRGGFHoUylwE8QhqPrOf//LZySGvdI3RQi X-Received: by 2002:a17:906:1f54:: with SMTP id d20mr949581ejk.48.1628638990058; Tue, 10 Aug 2021 16:43:10 -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 l8si22566986edv.197.2021.08.10.16.42.46; Tue, 10 Aug 2021 16:43:10 -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=bE2scvyT; 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 800F468A214; Wed, 11 Aug 2021 02:42:42 +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-db8eur05olkn2032.outbound.protection.outlook.com [40.92.89.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BBA54688256 for ; Wed, 11 Aug 2021 02:42:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WGawLrFecyEr/lQyLPEpkGgHvyxlQNNjp128db5MmMr0ZJyymbYraH6Z1AdL4gmnV/eFIZJth+I4WFZnNaE6CGb19mq6uT6a2GGU/Tzjajx16j4AYE35GJZjDKF4+fJhg9qUIvOzafSaUoIAKdKIC9LhH9tZey5RWxT4JJSEK+Y4I5FG3ilepXdYsu9hf5tzsw0MLI1vrS1wTnUw+V8n8hIh3DBeqSS3616/ozAHSb1yn5GVOUcVGH1CXObqJ6doW2inzJjibafLg7oPWRwx+cnMIhG1eMmu8zpfNAO4rD+Fw5ErC7urLmS+fioxmkKbYCHJtvgQEJ7E5cYoWTS1HQ== 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=oZIKQfbx/cneP1Y+1A1PZTgnHFTw9ecMlgyKM8C1yX4=; b=Xeeeafb6ZSmt65McVc6cPel2k/49o7sKWpa2tGrBZoCQDls6aOk4UWASTCifnkaDVmpK28Xe9lq43ZtvKgmNB6kY2gnMI0uZ5EtOon18z3NQJYTQPa7MLrcCyqRRpMeAcwTkpwRh7MV9/1ukeF62J8NuXIwHgqJ7CTzW1WGVE9V0BUM1u33RmAV1QnCZ2tDnh5BwQc5cR0UL1xME4k7jtIbth2SuM1Ir2NATWjfzz8uL5rGN00zY4wXxGryzDGa1ISjlPZUwJwVg4AlIIVEkBgJY9Aflk1X6hP5pat0YtUwWm85bbETQ+xCWCDWaFwLATrVqo0GFDxIPVGiXgDtu0g== 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=oZIKQfbx/cneP1Y+1A1PZTgnHFTw9ecMlgyKM8C1yX4=; b=bE2scvyTi7Q7BtJ47W4TUXREClYqJCK5Jrq6r60YjRNbLIykqDeNZYkG/jKAkN5zWbPTQD2bYQEsk1i67YCNVfPyyShk7K5HXtFy5I3pZEbsX10DBrSwSwBTT3sSxt1VMW5SJK8yATcs9D/nIx+/toLWDEXvuuZdkAco0l/ITP3TRvXxbkBHBZNou7iIYQgJDMxs+P8bt6yvra7umrdaBBqoh46McP+mUYMsvxgA2prQLmTQs+UcOyK7qPQAiYCPpBXLQPWEFzpstaYgHMcxlVHMX6MQha5//esW+U9S/6zmgNHze9TOzkQEuOqG/dlmLZ4ypVOC+Ts5ZAzInS1Dkw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5607.eurprd03.prod.outlook.com (2603:10a6:20b:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Tue, 10 Aug 2021 23:42:33 +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.4394.023; Tue, 10 Aug 2021 23:42:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 01:42:24 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [apI9HU+XJhZZXLKqnqEIr2m2fOH5EhMN] X-ClientProxiedBy: AM9P250CA0025.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::30) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210810234226.652294-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by AM9P250CA0025.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Tue, 10 Aug 2021 23:42:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19353b69-1dfe-43f3-2c7c-08d95c58867f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiT4+P6zBac8z+9gXHAF6SHpmImXY4F3hFqtO63TtvenzSGKq1a6FYzcGsWZO43v/2K9V2SiekohmMwPj8yMIAfzxXNWFhybRIvonUpuwkHDkIoTLPzKb2g0GeyOulW2fK+W/VA2mfnwhkVq17roC5r9Rmz7lfionpTXa6M1iD0LlXpf6qI9xYXGpHfPX/oKagoEuvU07h70vXns4gcHarPHCTe5pB1Zcrb4AdzcTgm4cld8+rARkdBX93wCwLkacf9mviWBlf8YKd/AINmCA52uwOuMNNF+tBHXEOkyW1CxGzPiKxjunlhwfltEE1jk3JXH0q8EjNISIYRb7RbiVY4cn/OFmQTcBW4S7F5wWm8/wX0e3bCCLtbKq/acmdvNeGJiN1g5X7yuDT70KM/eaPONIa84kggt7jIfKtWCRDvRYCmGuQdfaWcfCo5O88nVJOCo+DIH71HPJKkSJmkaycwFLn1Og3CW+ct373vCVhTXqT/wOPlyYS6J0bSyPsA+mSxw78sRdUhdI44gBNRqyOR51dmRdqBQ0Cv7z/LD5lnBTIFbrjGXEGC8aD3ZCG1kFlGlzwTrtxZHgPw+2KdPWm/eisDTSpCTLEllOt7UgftzzHU5uKPOCrFHujEdyUmxoAl92Txa3v7yuk6wIrhCRVx+7mvZCreHpyTiRNyrNGwK+/M4cINYPT2Hn9wo/vK0rHHVPCfRBD1DVwBdbbh/aA9+/xuanWaDsmd+31nQknea2ShbKTTHFz0biaLqdCuxgx0= X-MS-TrafficTypeDiagnostic: AM6PR03MB5607: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DVZB3wFKoXXhOWEf7+N63ImK8q4o+UG9WHb6VaTQPNf8HpVw078DBFFbISQAWC5zGqRYoNvqbAnUCErU367hccJFh4Sjanj1fDMxLPjutnU+DlsgwgqSiFqaBktAgUqol4jePX6PzcxbRIY0uZbFMKuGKqeD1x24LCF6NSkI1ZCjgPJTK8yLBAMlCjWsYDEYzqa6LSl0WLR5wIXStH4XKXMrsOODqc30/+m6id1GtF7vC2q3cdv4bXBEiASVKXTPK8SySgxXVNnwcHVwPr3/Ve5IuRZPlHrK+U+JetGkk/0h8VL/yZj76uKdzva4AIq5yUcVfQBKaqDqE6A599kxi3YRG4Q9rdd/zOk/X1+cRcf7VlIm0bkj2N3Q44V09MQ3uUQwA7MqdmNmaYA4lubSkuQybJt0aw94DCb/NwYixyNxLilKP3K9Wx2WKPpFsRAG X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UtLyb0A0o4Rb3lPHdYiba1BR1X0zkFmpWZj3B4+/CVHr4vvA4vieoy0uVPPYKXCztnSyATuejKY58NLmujcYZZ14OQ+SpY8se6VwoonuiZU3LqSld/j33TMysu1vW6O+LVhl0YTb3sxHkcGTc5LeIw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19353b69-1dfe-43f3-2c7c-08d95c58867f X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 23:42:33.6320 (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: AM6PR03MB5607 Subject: [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Fix leaks upon filter creation error 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: 3sfuSuixTW9j Both the name as well as the options need to be freed. (Right now there is no option for the AVFilterContext itself that could leak, but some filters have options (e.g. of type AV_OPT_TYPE_STRING) that can leak.) Signed-off-by: Andreas Rheinhardt --- I intend to remove this duplicated freeing code and call avfilter_free() directly once it is ensured that it is safe to do so; a few checks will have to be added to it and the filters will have to be checked to be compatible with it. The only thing I already found out is that libvamf is buggy (even without calling avfilter_free), because it just presumes that a mutex and a condition variable have always been properly initialized. libavfilter/avfilter.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 358bf8a853..908e812b5c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -684,13 +684,19 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) err: if (preinited) filter->uninit(ret); + av_freep(&ret->name); av_freep(&ret->inputs); av_freep(&ret->input_pads); ret->nb_inputs = 0; av_freep(&ret->outputs); av_freep(&ret->output_pads); ret->nb_outputs = 0; - av_freep(&ret->priv); + if (ret->priv) { + if (filter->priv_class) + av_opt_free(ret->priv); + av_freep(&ret->priv); + } + av_opt_free(ret); av_freep(&ret->internal); av_free(ret); return NULL; From patchwork Tue Aug 10 23:43:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29407 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp899669iod; Tue, 10 Aug 2021 16:43:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6ZtrW+JaC63Q3+apAB5JmfOIRdZwgTfC3FlFYOAcgNgfuYxjj/LhLWmHqxKx59QxbN9kY X-Received: by 2002:a05:6402:b56:: with SMTP id bx22mr7942155edb.285.1628639025988; Tue, 10 Aug 2021 16:43:45 -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 d19si11416788edp.134.2021.08.10.16.43.45; Tue, 10 Aug 2021 16:43:45 -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=powJP2+m; 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 AA28368A273; Wed, 11 Aug 2021 02:43:43 +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-vi1eur05olkn2021.outbound.protection.outlook.com [40.92.90.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA9406891F1 for ; Wed, 11 Aug 2021 02:43:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qru82TX4Xcw/KKwyz8sLFUZcKbEBNlP4ZoM4NsQx59EY9F87OCQXlMIaIlCYTlbaF2KNenYK7hc/7jDJIBmFFl/Zpjf3C9vg4qpLo6UU5z1ayTyJIYeYQSH13U5q1ZANrXUQdoXMOAD0yd0UrQTYCGnjcjaE8+bMBoPlUUht13bFolVnaqaCNhw/T31mWIEbha2DUSoX4KmVSml7NdUkON6b/5tt3E8yhfkjF31ZfYlLtLT/AzGf0+W5u3wWR9kWjMvn6NuHkc4/OofHmzAddaiU+WX0FEgxRSOcI/sKUTMJIDKAz8KuuIiaMCmyNRPesXvv+Bu9UT8uGU4Ly0yqqA== 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=0ip1Yd24HwFGZOW/3KNCkVWcUgvq/0YM3JFT296lxcU=; b=nMiSaJLbdWG46ZOuvpVFNYu69e6NRA97Yx1OvEqZNx8yxtl9dkH/9+NTppxQoz5lzfYyTKK/z2UMCZGeD4gLExBiP9/98oqWBFQltHr/FGeDkIxZq0sK2srcCu01ReW+3oHwcI/Z+/G4vI9nVarZRtnoaE8NzsRgyyaRI8FhEi8aYnQS98PzavXqF3J5JIXWy1LlonnObfwHQNis9I7yFAbOnF285QsWCeEro0LoDcoqaQkaJ/e+814G9oAZm6xlFLuGjTIWw5sGsm3WRJYKojzHr7s87T8Vnj6ojTki1ICixxMsva8BGvQNtNGN2wsV7J/Ej5XbNQz8r1HYfh1xPg== 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=0ip1Yd24HwFGZOW/3KNCkVWcUgvq/0YM3JFT296lxcU=; b=powJP2+mg4e/jo5arv0zVBpH1pbmZukHwCv/kOuHUPw1hwi9FDoDb2DRv7ckw+Mbw7z6TkfFT0N4I+fGeTejT/sE/PhVAnk7GC0HTjXm2ec9nOVUqwXBC6wVMava8teTD9OoToQ2l92WK/6+VXjVztaSgUKs0vsbhf88v9c0y6mbraB7U4ok2ROAQrO/vkVTn17i2uKI3vGxTIrXIxd+m7tXTX12FX+VxJ/hmBjX6s1yeAlMb9xtLWpfwrNhCGw9BcuL795qQEFpm93C6jStjVY9PzJ1azqbW1lfmoK497z8x+rzu9tNkxBRIQjJPkaOzNHe4N3tTIF8hbOBRRlVGQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5607.eurprd03.prod.outlook.com (2603:10a6:20b:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Tue, 10 Aug 2021 23:43:35 +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.4394.023; Tue, 10 Aug 2021 23:43:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 01:43:25 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [P5YVAgyvfXO4t7XWvRGN60PsaNmDZM4h] X-ClientProxiedBy: AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210810234326.656637-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17 via Frontend Transport; Tue, 10 Aug 2021 23:43:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abc82ca6-e7b8-4b1f-5310-08d95c58ab27 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiT4+P6zBac8z+9gXHAF6SHp1zRW4lmP+VEHvnAcadEHB/hYUMIb178FD0ncD4Vb/DJGCOzyu0irRguHAQORWT9aGX8rlKvjEaTuw2xjZCz1QRk0I3bSgL8LFNftJDDyXXreE/7V7oQG3PCFrBfrRswIq75nrw/Whr8U1RoyeS3z2MaiKVDeDfB2p9irsOAXgEh9fPUX60RVYtf6s6BMv4I7L+4+RZbpyGb5N85vrHIXrzsFvWHqvw3EVxwNSOP2x1UrSu/E2VPWZuAPasw8peWmCdhaXwHKGbCPIYXcCXNdm2ag9mS21ppdXoBs4TTa0C11ctuwzZ44j9Oaq0CjGsajk1tNMdTJtMClTkUl5K/PeFeaxC3wnDHSA25F8gB8kdKcCeqPweBytK+C2UUfnGOY/ClvNPr61kb/uwpQ6TNFghIIUCnuzHsISaB/K+06lZWgN5YWTht3G3x8E3pWHAkkdCjEK9t2c/ff2+Tfi1JVHnko/9cAptJLP3SqSXrWaVwtWFbqXHmk1z9vv6AsYx5Sk1uu0xoHZV3oOXh7uNx80NTq9/QsydPa3xmKjPseXMgFUZBreLW8afycPft9REym16EmWrHNuSQS8u6BuIEOmMBU2Z5uIhMgWQPIN95AkonCUqArd9hWIz5SH3+TJwWiz7+CtqrsfTeiF82gZ5tKJWQBwr9bRI2BaIdJ57D60PNMGA9hQE/bpvMyT0WG2kwon551P97l7EVjHongX+nMyhQOdFMMe1FmKda/AwIU3cA= X-MS-TrafficTypeDiagnostic: AM6PR03MB5607: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sq0hfdHMlK/69GTmXEGqAQWTPQqzjOrMO0dTrMbKpx5XYMa8Od0yNu35gHiExJKNgL1hZ9y3HWuxp/Vy4Xbd9ee7jnoxQqmTXMaygFT6zIcwIIsBuffxNKXO87NseaSQY1rY5JnkfefQ14wOKBeQQJ1yPWTgey+lH6auzG+UxO4uDyZEcjGuP2zZX/mMb2x+pvbjfzBhUsvUeRPa1gg7EvOrCzWsOSJEHepMA+pqtq5NbpEnkQ6c9Mr7WdybaOE2HOF9s/wnhUPhekw+TlwCJG0sT6ZVr4Ts+03mLZBwi1YNNGOVrtbo4na9xgXPNLkpuQvsVZMLf6IdKI552JlYteUVkdgg/RtRAGNv/nygZDFgBdq1+7EYZxmndQZ9ZAHLe8QOEuCMDU77tX1qSr22P08Eoxm0H3mG17E4/sTPsoN4dcn4Rn0ToAZIH+dhEXB5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HtxXtD6kl+wS3V3kJTokn56sIyrwfgNpJkqypTg0flaOJ5DIvPVUvvu0jyitvpD1PRwLr3YIX5GAKlyrCidWuErgrF0YeXluZP0Vof+ORAroJZry2x847qmEBftKLuY4CEsATGccffdOowoKgU8zPw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: abc82ca6-e7b8-4b1f-5310-08d95c58ab27 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 23:43:34.9965 (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: AM6PR03MB5607 Subject: [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Use av_memdup where appropriate 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: I/Rm8dWeRGAe Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 908e812b5c..c04aefcaa8 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -659,10 +659,9 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->nb_inputs = avfilter_pad_count(filter->inputs); if (ret->nb_inputs ) { - ret->input_pads = av_malloc_array(ret->nb_inputs, sizeof(AVFilterPad)); + ret->input_pads = av_memdup(filter->inputs, ret->nb_inputs * sizeof(*filter->inputs)); if (!ret->input_pads) goto err; - memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); if (!ret->inputs) goto err; @@ -670,10 +669,9 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->nb_outputs = avfilter_pad_count(filter->outputs); if (ret->nb_outputs) { - ret->output_pads = av_malloc_array(ret->nb_outputs, sizeof(AVFilterPad)); + ret->output_pads = av_memdup(filter->outputs, ret->nb_outputs * sizeof(*filter->outputs)); if (!ret->output_pads) goto err; - memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); if (!ret->outputs) goto err; From patchwork Tue Aug 10 23:43:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29409 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp899763iod; Tue, 10 Aug 2021 16:43:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5pyEVf/zmcmTXmea+ppSwarUJ/KC4/VwxFatB0Oi6acWzuYYCBdPHyYWH+Psl/N9YqOLA X-Received: by 2002:a05:6402:230d:: with SMTP id l13mr8031679eda.10.1628639037319; Tue, 10 Aug 2021 16:43:57 -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 de19si22426564ejc.623.2021.08.10.16.43.57; Tue, 10 Aug 2021 16:43:57 -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=Ty5rEqpA; 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 A1BD4680A47; Wed, 11 Aug 2021 02:43:54 +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-vi1eur05olkn2103.outbound.protection.outlook.com [40.92.90.103]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F369680A47 for ; Wed, 11 Aug 2021 02:43:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OEMkXHoN7DZjdM6GTCVGdEHKRreeXkj+ICeEIA1zL8jF9Q0Z9jnno9aMXNZpOcFSq3nfQlRz92LY1cQ8skPzf7vp2XFtWxiHc9YWa7DTuru5uEwxAFxV6F5XpDtskBQwInviphjD3WGI7VXQuY0fYM3WfgFwgCL57O/DBoxcMh1sgzHsNuLN2s8RWkNEtGWEqJUihYNyzEZTgbebTLre0l5hX79O1u3iOsv+1VJkRIb4bA1cS3wzlXrZCJCUDVZoyy6l9C/v1edr4u/xJCNVD2urocpY0XAq0PwdOmiEiS9xtcj/Utu6TA2yZNuaTCs6yvtPZ6CyoZ3t6Sw7b5SPlw== 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=eRjQADlBREN+ykH/Qr55guZdzagSWN9b44ZFMNc/yOY=; b=SrWjeP/HuB9/a3PlnkXit4sHCeHF5uqOq48HbEOq5La/StBUbQyU+4rOSd2+m6heORsjzcG+99SuXRScT3wsGSe7cszxP6VW+KEIGGfw0ujRMe0bL+iYNgLiv7EH7jbMNZS4vGEfqqktgDvzk8dTax5V6fBbDUc5py6CzIC+lZRg+qS8yPOKEzMYadUt3wfpXHXTZURoiHQthNi2KLVS/tUqJNlOnGIs6c7JwU5BcaiT8zVG/ntqgKPKWaesT+6S1RwUhB/c4XHGJ/4NPZD0tNbFcKZt0Ssg4208XNr3bxWW3Y4nqYfxI658P+W2O7B38U3uUZPUh/fpHSoFT+Cpwg== 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=eRjQADlBREN+ykH/Qr55guZdzagSWN9b44ZFMNc/yOY=; b=Ty5rEqpA8X9LPCiTk35/mdeCPKrsv9OIc+rptTfrklEC4KhmQ3E7SsGXlaF3+INifJqbXcf5SAYpOwVW3pL18aiDoEIqZWsqF6+l0n1tXx5nBDT+iyVCfdyap8uKmMHDf2hTj50sZYQrYX6E65eTUtSUVJR0lF25Q5xKLFK5S18x8E2RVInaM2cas1/eoDu7a4iBIvf3J3lLBr7qHh/hbRB0WAhBYDvQZuPVrsNI+KAIxOovd74zxrj5MvU3UTqVrhnpn8XlzNlh7P3AxvAsNeOf08i12WG+8qGO1JpxsR/1Ncou8AmlSUqjROhOsYUBxN3NHZp5E4TuP6+LGC7xtA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5607.eurprd03.prod.outlook.com (2603:10a6:20b:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Tue, 10 Aug 2021 23:43:46 +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.4394.023; Tue, 10 Aug 2021 23:43:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 01:43:26 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [DbhhvMieF+ewW25KhMerj/B453Xl0G60] X-ClientProxiedBy: AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210810234326.656637-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17 via Frontend Transport; Tue, 10 Aug 2021 23:43:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2cc3d4d8-8458-485d-3e8c-08d95c58b1c7 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVNZZwRrMzTbfbPbtn9UOclj73UHG3uZOrr3ovUVYeocCQMQg/frfM5mmL6OOv9sZ0pzs4qrHexEnqUjLq4nwU9PG6g9j6lHSkSAyQcqJUjRZerJlNd0/ROzhr8K1K81/9LaZC7e/meX6Mwjn9WDhyZq59svST4/ov0z5FQf6HDzKHNfctWm6QKLXr8K3I2NEen2Xf62D5CYO14v7XIbFg+/kxoi6hat9OC5CreoxQW1n7O06ZWG5AhSasVunWZeZwA8qzkflSdqqI3Unk6Mw6tn7EyB0T1UhTna0ISVarrcLGhdCAzsyp+S8+BnNhRwp/PBQ2yX0IV23gdlZv6pUXZInO7HTT2Jmzs6O9HyT4qE9grXy6fOWAKzXrRMxlMcsi+PKiE/SqEz90Wek+0QfX3+a437d5BxL6saB/z3/SO7cTx/USzr4in2ICNTD1CbMQRDXgTXMBxv1Hov19sGM0Q1bxK2+Z9avXl8Xftq3tsnF2yuBtbjk6KjTn6K5UpPbvR9Jjb/fbbhTB7GLCjxu1wVstfZYMK8G7tpWQTDdBsleDuBamFbmq0GttkL/3K+OWb6ebbAIcCS0r8JTDx2Qusfl8uxkCLC5/pair/cjcnAg2MpM1DwIzSCOIIH1weaR1RWFGMUuWcw8+DL9pKCQxAeW6SQYrPSjxgvK9kHKhqFio+Yt2iWhUJ2pkyyYG2P/6j5/YxDrpau2Qd792z4It3mkwXdL0V6+Q= X-MS-TrafficTypeDiagnostic: AM6PR03MB5607: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iy0jPydhFlCzH1V6KJ+uikhsPmmoO2jCs30LdBzT/wf6ymgjRFY/XMe/BP9rpZEfWrrvr6UChSThpVGb9r+tCIuLBc8oX0D7j1l3Qs9Ze2QrWFeyWCi4+hm5cG735or8eZ2QUx2oxxqaOeEZzCnfa+fA3LiPMMqaGTiDVzU4W/Stgu6uYia5mWN/4EraSRndOqN5dPNnolaH3gNwSfvMHnNYAvvPrHabrDVKtjwOTuF7lS2R145Vsm9bhHiAfRaK+C0EeAHe+JknL/neBnfvRiCuuxrplBAQWbrWjDJc+f+shu5UlnKtDY8C2GI+ZDO2myPuOhpm832R2449gHOHhDmY7T03E6OfFipdOD/QO6Vh9cEruviolBuX3ZDHxC54wCTiD93V/YKz/72P18nOKaipT+5XWlf+fd4pftiCm3PeTcBgaBwIKxJOjEF/eGXA X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HU05+vmOcdp78lAK2fFxQiXC2vAU1jWQc3ob+fF8Jw58rQvdYHJ0aHmLh0IAVKBDnRkH8zz+PrqyGXrGOoN5xG8tFwCGN1aueFFyJYLasTMbRNZFtRiaHnYd7B9Gn/wLszo/eqNGpSLmadtmlySsXQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc3d4d8-8458-485d-3e8c-08d95c58b1c7 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 23:43:46.0930 (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: AM6PR03MB5607 Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_(guided|program_opencl): Add missing dynamic inputs flag 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: ZDnpEyu6q3Iy Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_guided.c | 3 ++- libavfilter/vf_program_opencl.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 202a6a0586..e2bf08f5c3 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -500,6 +500,7 @@ const AVFilter ff_vf_guided = { .activate = activate, .inputs = NULL, .outputs = guided_outputs, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index 4b38baeb3c..3af1485d53 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -367,6 +367,7 @@ const AVFilter ff_vf_program_opencl = { .description = NULL_IF_CONFIG_SMALL("Filter video using an OpenCL program"), .priv_size = sizeof(ProgramOpenCLContext), .priv_class = &program_opencl_class, + .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, .preinit = &program_opencl_framesync_preinit, .init = &program_opencl_init, .uninit = &program_opencl_uninit, @@ -420,6 +421,7 @@ const AVFilter ff_vsrc_openclsrc = { .description = NULL_IF_CONFIG_SMALL("Generate video using an OpenCL program"), .priv_size = sizeof(ProgramOpenCLContext), .priv_class = &openclsrc_class, + .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, .init = &program_opencl_init, .uninit = &program_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, From patchwork Wed Aug 11 01:17:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29410 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp955727iod; Tue, 10 Aug 2021 18:18:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrds4hu3w3TVmFVurOnadddDqiEC+NdsAKHBYF/O3oJ48/UGx6JDNKlIvW9LyE/I3OgfE5 X-Received: by 2002:a05:6402:b83:: with SMTP id cf3mr8287484edb.12.1628644702934; Tue, 10 Aug 2021 18:18:22 -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 sb17si22227536ejb.349.2021.08.10.18.18.22; Tue, 10 Aug 2021 18:18:22 -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=l5KIvcFW; 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 7C9ED6802B6; Wed, 11 Aug 2021 04:18:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066091.outbound.protection.outlook.com [40.92.66.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA4D76802B6 for ; Wed, 11 Aug 2021 04:18:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MCQj01bIjn/qeyQ9E7wUYN220yb1/9SIh8LCCdoY3qq7BNMqPkOPri4reVIn46+634zTkqztK5DZIJ4NwWWOds7YXnYa5wrBQXyB3bkfaRkPLtKkGqD4kyVRsDNe7aqHlC3ze8HvUfGWzEyb9cQE92tfwBWHTBN6RWNB+WWc53Ri5rUwUaSVAm4Z+eaaa1FQgjO9HoNa0Rt72rUwB4Qi1FeLlqh/afzQL1ATLUYfLRohq9q8i7FyDPtNKOih93Vf94TksXXlz7MBTLuamV/YyaKYE6kLy/AQW59rdwV2vb+M9se9gjrWGMm9wUC7axvZgz0ZvmWmfSRKxDDSlEuWFg== 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=Uqx1mEvY8b6hOpHyaBv/WHWzQWEyswiEWpK8pFi2rZU=; b=ZnFg5E3hcE7O0IjmvK8dbGoKaw+WZY3fTjZK5PuAZHay9kvCCc4uIXCILpWsQH3CYJKl9j5oYrOcYUH7GXRKN6uWJdeDP/iL+qPvK4GtCy2el8M4YFyaeH0n/XmoJh3QLl1LQvQ/hvqDJPD2lJ34G2ZEOZ/qWMJ3N32cEUEn59YGee0Rp2icmksKrefebMmC0zsknIxNH5pVH6YaITL9gEMVhkrwfq9lNjKqfZ2RMBCE48KMdks2ZX90VBoaGF0wyGk+rwZommUlLPU0+KXn3fDi05uPiOOXd4qIt6g/nbQrVUlBgE/oehjxtSauDzzkH8ztCmWTW1mc9b+G+5Q0OQ== 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=Uqx1mEvY8b6hOpHyaBv/WHWzQWEyswiEWpK8pFi2rZU=; b=l5KIvcFWe4j8QEiaey4lnmNYvO9evAv7AYV9H9HtZTau9OfpnhInjz9F/Bc0WCBB/JVD2IMq3UB/N/nmQYtCAnluY9mFPvNDgAn2Wa326n8qhdDoiuRD272TCv+K0s9KY28qLRuZoSx0InF3MxR0jMCN7iUW+FohPXghIO9oR3z161/8tn8lr/SBd9gPTeYJk0wdY1puoxZ19GMHXOfc2QVNHWaLIHxMDPX4FH76Hk5v+WIc3XD+qu3hoOfbkM1GhhzUrmk5eHX8kGpK2GSSXnaKHh1ci8fbMVrcqwfyUq/KI8J+T0XCSqmTKWfAnYs1ds2SV/QtpsHSW7msuAuSvQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4613.eurprd03.prod.outlook.com (2603:10a6:20b:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 01:18:04 +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.4394.023; Wed, 11 Aug 2021 01:18:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:47 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [kIcx7y9Ql0PSMdGx5RzVOTOX5zRXTetJ] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1efb8cad-9230-4033-3a63-08d95c65ddf0 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiT4+P6zBac8zxhOSuRwKn5l9deyVgy3pmwHSsrLVaae787vNp6rrdb4MY8ywUmz7RCi9QhV+NnrcJWYzdPFS4H7t3Vke04PMg/SWYIpzz9Cnx/OfeJJ0Om77PTqkpqswWqwJrN0mT43o/QBbRNuTuZXFAyZv/JY85bXVWvaKv7TUMkYU1f3Nwsyb5Mu7ZZLHjjhAGA/uOA9BHXfqtjqEIIGDASbkMNLVYAt4bxbrYPdtUHYLsEw9fIe7Kb7G2QvdX26f8cfKbZrsz45AoMyM/+y5yUT77l0PpQEqEW4Z12BBTRqVD0jE3OW6UbKwXbYecI3zNMAa3qUwQc4T8ZOXgdDPmf/FxQxcCbBXNMJT16mxEpqfA4szQu3r9YXzjBifaHk6b6Ysw37iutr2tUdogUuT3NomGVScRuUUMKku70m54tSuNttzvk7mFl3UjKR51efHnBtVzXvr1PlM0QSHJj2ex81tobqytoc7aqMZUM9T9y8QV067OsHsF9lf0a+I2X91mZdyyAM29DpcLmWl0+fi2CpWW3iui5dZ5/sZxsc8pE637o5nXP1ABxYqnyJF94Bcfgkzb5MCKjdHAck2A1I6n6fAoWionifv9Z/ZvnQD2gu9wU3aVw/WCw1dGeuPmfB/LY/deXlvBbXrg22TYAqklwxbtzfOBwZlBz2cX7ZKcTszBblyzXi9h2ZIDq8cVwUhWlt+kPhVUwSCH+fr2s+c39YxGa+kznzWK2dJpH9WoiDBGoHNhqPKfNZE2q1RNs= X-MS-TrafficTypeDiagnostic: AM6PR03MB4613: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GwBdl6PyZ94Y3YzeStuJRLHDl60e8p1jAlx2hH4qnYVa7gmuPxl/1ELd5k6lNZq6Npv6NfRIf4nOcDBn55bn0RcqSL5LeJDJ4W7p/tJBsvZo7uxI01kh703a7nXulkKCGDo+922RHucj7f8I/hfxRHLGg9FFIVFS5rjCXDcYuiQcTStIyw8IDnh0E36BDnpC9WQQhtBh18zENTMHXlIu1+xYCZPeMHy1XzCgJVJsgHOLQwuOz5U9CW9bedRHbCrijoe9YYL+EpxG3hqegp4FNu9KKsB1dXYN2eaKjuyjSZJiFn9VxH9EiS6dLQUvM0ED1sniSL/HOXZcWZQLc3V8v6ne4xuaxtiG+p8vPKDsXNgk9BczHpfnWA5bivsx8f6UzAV1SQNvCxuiafgPdc7KFw/GdM9Au9qUU8UUD+vUJ1EJtBpqug5yVsixG8jTp6Qq X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ib+eWLZK6CB1P+XycXcM1JPgwTzEsCWH8dmbf86BptTQOmlCXP9BCjq4Jd+2oc+n7RGiDIvxDqHrjip4thBXaIv+w6mYnSnPIosv0ro/Z5MPnmRiUz145HmIAvUOPoi/5BxfxBdvk7RosnjHKocMhw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1efb8cad-9230-4033-3a63-08d95c65ddf0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:04.0191 (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: AM6PR03MB4613 Subject: [FFmpeg-devel] [PATCH 04/10] avfilter/formats: Factor common function combinations out 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: bA01JayNjRpk Several combinations of functions happen quite often in query_format functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts)) is very common. This commit therefore adds functions that are equivalent to commonly used function combinations in order to reduce code duplication. Signed-off-by: Andreas Rheinhardt --- libavfilter/aeval.c | 27 +++++------------------ libavfilter/af_acontrast.c | 16 +++----------- libavfilter/af_acrossover.c | 17 +++------------ libavfilter/af_acrusher.c | 17 +++------------ libavfilter/af_adeclick.c | 16 +++----------- libavfilter/af_adelay.c | 19 +++------------- libavfilter/af_adenorm.c | 18 +++------------ libavfilter/af_aderivative.c | 20 ++++------------- libavfilter/af_aecho.c | 19 +++------------- libavfilter/af_aemphasis.c | 19 +++------------- libavfilter/af_aexciter.c | 19 +++------------- libavfilter/af_afade.c | 19 +++------------- libavfilter/af_afftdn.c | 18 +++------------ libavfilter/af_afftfilt.c | 19 +++------------- libavfilter/af_afir.c | 17 +++++---------- libavfilter/af_afreqshift.c | 18 +++------------ libavfilter/af_afwtdn.c | 18 +++------------ libavfilter/af_agate.c | 19 ++++------------ libavfilter/af_aiir.c | 16 +++----------- libavfilter/af_alimiter.c | 19 +++------------- libavfilter/af_amerge.c | 6 ++--- libavfilter/af_amix.c | 6 ++--- libavfilter/af_amultiply.c | 19 +++------------- libavfilter/af_anlmdn.c | 18 +++------------ libavfilter/af_anlms.c | 19 +++------------- libavfilter/af_aphaser.c | 19 +++------------- libavfilter/af_apulsator.c | 3 +-- libavfilter/af_arnndn.c | 18 +++------------ libavfilter/af_asoftclip.c | 18 +++------------ libavfilter/af_asr.c | 2 +- libavfilter/af_astats.c | 19 +++------------- libavfilter/af_asubboost.c | 18 +++------------ libavfilter/af_asupercut.c | 18 +++------------ libavfilter/af_atempo.c | 23 +++----------------- libavfilter/af_axcorrelate.c | 19 +++------------- libavfilter/af_biquads.c | 25 +++++---------------- libavfilter/af_bs2b.c | 11 ++-------- libavfilter/af_channelmap.c | 2 +- libavfilter/af_channelsplit.c | 2 +- libavfilter/af_chorus.c | 19 +++------------- libavfilter/af_compand.c | 19 +++------------- libavfilter/af_compensationdelay.c | 19 +++------------- libavfilter/af_crossfeed.c | 2 +- libavfilter/af_crystalizer.c | 18 +++------------ libavfilter/af_dcshift.c | 19 +++------------- libavfilter/af_deesser.c | 18 +++------------ libavfilter/af_drmeter.c | 19 +++------------- libavfilter/af_dynaudnorm.c | 19 +++------------- libavfilter/af_earwax.c | 2 +- libavfilter/af_extrastereo.c | 3 +-- libavfilter/af_firequalizer.c | 19 +++------------- libavfilter/af_flanger.c | 19 +++------------- libavfilter/af_haas.c | 3 +-- libavfilter/af_hdcd.c | 3 +-- libavfilter/af_headphone.c | 5 +---- libavfilter/af_join.c | 2 +- libavfilter/af_ladspa.c | 22 ++++--------------- libavfilter/af_loudnorm.c | 13 ++--------- libavfilter/af_lv2.c | 16 +++----------- libavfilter/af_mcompand.c | 19 +++------------- libavfilter/af_pan.c | 4 +--- libavfilter/af_rubberband.c | 19 +++------------- libavfilter/af_sidechaincompress.c | 26 +++++----------------- libavfilter/af_silencedetect.c | 11 ++-------- libavfilter/af_silenceremove.c | 19 +++------------- libavfilter/af_sofalizer.c | 11 ++-------- libavfilter/af_speechnorm.c | 19 +++------------- libavfilter/af_stereotools.c | 3 +-- libavfilter/af_stereowiden.c | 3 +-- libavfilter/af_superequalizer.c | 15 +++---------- libavfilter/af_surround.c | 5 +---- libavfilter/af_tremolo.c | 19 +++------------- libavfilter/af_vibrato.c | 19 +++------------- libavfilter/af_volume.c | 19 +++------------- libavfilter/af_volumedetect.c | 14 ++---------- libavfilter/asrc_afirsrc.c | 20 +++-------------- libavfilter/asrc_anoisesrc.c | 20 +++-------------- libavfilter/asrc_anullsrc.c | 4 ++-- libavfilter/asrc_hilbert.c | 20 +++-------------- libavfilter/asrc_sinc.c | 19 +++------------- libavfilter/asrc_sine.c | 19 +++------------- libavfilter/avfiltergraph.c | 4 +--- libavfilter/f_reverse.c | 14 ++---------- libavfilter/f_select.c | 10 +-------- libavfilter/f_streamselect.c | 9 +++----- libavfilter/formats.c | 32 +++++++++++++++++++++++++-- libavfilter/formats.h | 29 +++++++++++++++++++++++++ libavfilter/opencl.c | 7 +----- libavfilter/vf_amplify.c | 5 +---- libavfilter/vf_atadenoise.c | 5 +---- libavfilter/vf_avgblur.c | 2 +- libavfilter/vf_bbox.c | 5 +---- libavfilter/vf_bilateral.c | 2 +- libavfilter/vf_bitplanenoise.c | 5 +---- libavfilter/vf_blackdetect.c | 5 +---- libavfilter/vf_blackframe.c | 5 +---- libavfilter/vf_blend.c | 5 +---- libavfilter/vf_bm3d.c | 5 +---- libavfilter/vf_bwdif.c | 6 +---- libavfilter/vf_cas.c | 8 +------ libavfilter/vf_chromakey.c | 9 +++----- libavfilter/vf_chromanr.c | 5 +---- libavfilter/vf_chromashift.c | 6 +---- libavfilter/vf_codecview.c | 5 +---- libavfilter/vf_colorbalance.c | 5 +---- libavfilter/vf_colorchannelmixer.c | 5 +---- libavfilter/vf_colorconstancy.c | 2 +- libavfilter/vf_colorcontrast.c | 8 +------ libavfilter/vf_colorcorrect.c | 8 +------ libavfilter/vf_colorize.c | 8 +------ libavfilter/vf_colorkey.c | 8 +------ libavfilter/vf_colorlevels.c | 5 +---- libavfilter/vf_colormatrix.c | 5 +---- libavfilter/vf_colortemperature.c | 8 +------ libavfilter/vf_convolution.c | 2 +- libavfilter/vf_convolve.c | 5 +---- libavfilter/vf_cover_rect.c | 2 +- libavfilter/vf_cropdetect.c | 5 +---- libavfilter/vf_curves.c | 5 +---- libavfilter/vf_dblur.c | 2 +- libavfilter/vf_dctdnoiz.c | 5 +---- libavfilter/vf_deband.c | 6 +---- libavfilter/vf_deblock.c | 5 +---- libavfilter/vf_decimate.c | 5 +---- libavfilter/vf_dedot.c | 5 +---- libavfilter/vf_deflicker.c | 5 +---- libavfilter/vf_deinterlace_qsv.c | 7 +----- libavfilter/vf_delogo.c | 5 +---- libavfilter/vf_derain.c | 5 +---- libavfilter/vf_deshake.c | 5 +---- libavfilter/vf_despill.c | 7 +----- libavfilter/vf_displace.c | 2 +- libavfilter/vf_dnn_classify.c | 3 +-- libavfilter/vf_dnn_detect.c | 3 +-- libavfilter/vf_dnn_processing.c | 3 +-- libavfilter/vf_drawbox.c | 5 +---- libavfilter/vf_edgedetect.c | 6 +---- libavfilter/vf_elbg.c | 5 +---- libavfilter/vf_entropy.c | 5 +---- libavfilter/vf_epx.c | 5 +---- libavfilter/vf_eq.c | 5 +---- libavfilter/vf_estdif.c | 5 +---- libavfilter/vf_exposure.c | 8 +------ libavfilter/vf_fade.c | 14 +++++------- libavfilter/vf_fftdnoiz.c | 5 +---- libavfilter/vf_fftfilt.c | 5 +---- libavfilter/vf_fillborders.c | 5 +---- libavfilter/vf_find_rect.c | 2 +- libavfilter/vf_floodfill.c | 7 +----- libavfilter/vf_format.c | 6 +---- libavfilter/vf_framepack.c | 5 +---- libavfilter/vf_framerate.c | 5 +---- libavfilter/vf_freezedetect.c | 5 +---- libavfilter/vf_fspp.c | 5 +---- libavfilter/vf_gblur.c | 2 +- libavfilter/vf_geq.c | 10 ++------- libavfilter/vf_gradfun.c | 5 +---- libavfilter/vf_guided.c | 2 +- libavfilter/vf_histeq.c | 5 +---- libavfilter/vf_hqdn3d.c | 5 +---- libavfilter/vf_hqx.c | 5 +---- libavfilter/vf_hue.c | 5 +---- libavfilter/vf_hysteresis.c | 2 +- libavfilter/vf_identity.c | 5 +---- libavfilter/vf_idet.c | 5 +---- libavfilter/vf_kerndeint.c | 5 +---- libavfilter/vf_lagfun.c | 5 +---- libavfilter/vf_lenscorrection.c | 5 +---- libavfilter/vf_lensfun.c | 3 +-- libavfilter/vf_libopencv.c | 5 +---- libavfilter/vf_libvmaf.c | 5 +---- libavfilter/vf_limiter.c | 5 +---- libavfilter/vf_lumakey.c | 7 +----- libavfilter/vf_lut.c | 5 +---- libavfilter/vf_lut2.c | 2 +- libavfilter/vf_lut3d.c | 5 +---- libavfilter/vf_maskedclamp.c | 2 +- libavfilter/vf_maskedmerge.c | 2 +- libavfilter/vf_maskedminmax.c | 2 +- libavfilter/vf_maskedthreshold.c | 2 +- libavfilter/vf_maskfun.c | 2 +- libavfilter/vf_mcdeint.c | 5 +---- libavfilter/vf_median.c | 2 +- libavfilter/vf_mestimate.c | 5 +---- libavfilter/vf_midequalizer.c | 2 +- libavfilter/vf_minterpolate.c | 5 +---- libavfilter/vf_monochrome.c | 8 +------ libavfilter/vf_mpdecimate.c | 5 +---- libavfilter/vf_neighbor.c | 2 +- libavfilter/vf_nlmeans.c | 5 +---- libavfilter/vf_nnedi.c | 5 +---- libavfilter/vf_normalize.c | 5 +---- libavfilter/vf_ocr.c | 5 +---- libavfilter/vf_overlay.c | 2 +- libavfilter/vf_overlay_cuda.c | 4 +--- libavfilter/vf_owdenoise.c | 5 +---- libavfilter/vf_perspective.c | 5 +---- libavfilter/vf_phase.c | 5 +---- libavfilter/vf_photosensitivity.c | 5 +---- libavfilter/vf_pp.c | 5 +---- libavfilter/vf_pp7.c | 5 +---- libavfilter/vf_premultiply.c | 2 +- libavfilter/vf_pseudocolor.c | 5 +---- libavfilter/vf_psnr.c | 5 +---- libavfilter/vf_pullup.c | 5 +---- libavfilter/vf_readeia608.c | 5 +---- libavfilter/vf_readvitc.c | 5 +---- libavfilter/vf_removegrain.c | 5 +---- libavfilter/vf_removelogo.c | 5 +---- libavfilter/vf_repeatfields.c | 5 +---- libavfilter/vf_rotate.c | 5 +---- libavfilter/vf_sab.c | 5 +---- libavfilter/vf_scale_cuda.c | 5 +---- libavfilter/vf_scale_npp.c | 4 +--- libavfilter/vf_scale_qsv.c | 7 +----- libavfilter/vf_scdet.c | 5 +---- libavfilter/vf_scroll.c | 5 +---- libavfilter/vf_selectivecolor.c | 5 +---- libavfilter/vf_shear.c | 5 +---- libavfilter/vf_shufflepixels.c | 5 +---- libavfilter/vf_signalstats.c | 5 +---- libavfilter/vf_signature.c | 2 +- libavfilter/vf_smartblur.c | 5 +---- libavfilter/vf_spp.c | 5 +---- libavfilter/vf_sr.c | 9 +------- libavfilter/vf_ssim.c | 5 +---- libavfilter/vf_stereo3d.c | 6 +---- libavfilter/vf_super2xsai.c | 5 +---- libavfilter/vf_threshold.c | 2 +- libavfilter/vf_thumbnail.c | 5 +---- libavfilter/vf_thumbnail_cuda.c | 5 +---- libavfilter/vf_tinterlace.c | 5 +---- libavfilter/vf_tmidequalizer.c | 2 +- libavfilter/vf_tonemap.c | 2 +- libavfilter/vf_transpose_npp.c | 3 +-- libavfilter/vf_unsharp.c | 5 +---- libavfilter/vf_uspp.c | 5 +---- libavfilter/vf_v360.c | 5 +---- libavfilter/vf_vaguedenoiser.c | 5 +---- libavfilter/vf_vibrance.c | 8 +------ libavfilter/vf_vidstabdetect.c | 5 +---- libavfilter/vf_vidstabtransform.c | 5 +---- libavfilter/vf_vif.c | 5 +---- libavfilter/vf_vignette.c | 5 +---- libavfilter/vf_w3fdif.c | 5 +---- libavfilter/vf_xbr.c | 5 +---- libavfilter/vf_xfade.c | 5 +---- libavfilter/vf_xmedian.c | 5 +---- libavfilter/vf_yadif.c | 5 +---- libavfilter/vf_yaepblur.c | 2 +- libavfilter/vf_zoompan.c | 5 +---- libavfilter/vsrc_cellauto.c | 5 +---- libavfilter/vsrc_gradients.c | 5 +---- libavfilter/vsrc_life.c | 4 +--- libavfilter/vsrc_mandelbrot.c | 5 +---- libavfilter/vsrc_mptestsrc.c | 5 +---- libavfilter/vsrc_sierpinski.c | 5 +---- libavfilter/vsrc_testsrc.c | 35 ++++++------------------------ libavfilter/vulkan.c | 5 +---- 259 files changed, 470 insertions(+), 1712 deletions(-) diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 007758bf57..dc2be24326 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -246,28 +246,17 @@ static int query_formats(AVFilterContext *ctx) static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int64_t chlayouts[] = { eval->chlayout ? eval->chlayout : FF_COUNT2LAYOUT(eval->nb_channels) , -1 }; int sample_rates[] = { eval->sample_rate, -1 }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int request_frame(AVFilterLink *outlink) @@ -349,7 +338,6 @@ AVFILTER_DEFINE_CLASS(aeval); static int aeval_query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; @@ -365,8 +353,7 @@ static int aeval_query_formats(AVFilterContext *ctx) return ret; if (eval->same_chlayout) { - layouts = ff_all_channel_counts(); - if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) + if ((ret = ff_set_all_channel_counts(ctx)) < 0) return ret; } else { // outlink supports only requested output channel layout @@ -379,12 +366,10 @@ static int aeval_query_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int aeval_config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_acontrast.c b/libavfilter/af_acontrast.c index 69fe6b7e22..85a7885a06 100644 --- a/libavfilter/af_acontrast.c +++ b/libavfilter/af_acontrast.c @@ -44,8 +44,6 @@ AVFILTER_DEFINE_CLASS(acontrast); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, @@ -53,23 +51,15 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void filter_flt(void **d, const void **s, diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index 3ba67b30e1..2e4cd367c7 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -305,32 +305,21 @@ static void calc_q_factors(int order, double *q) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define BIQUAD_PROCESS(name, type) \ diff --git a/libavfilter/af_acrusher.c b/libavfilter/af_acrusher.c index ce337013ab..8a0e997cea 100644 --- a/libavfilter/af_acrusher.c +++ b/libavfilter/af_acrusher.c @@ -265,32 +265,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; int ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_adeclick.c b/libavfilter/af_adeclick.c index 798838f522..cda83bbb67 100644 --- a/libavfilter/af_adeclick.c +++ b/libavfilter/af_adeclick.c @@ -115,31 +115,21 @@ AVFILTER_DEFINE_CLASS(adeclick); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c index c6450cb2b9..862abfea91 100644 --- a/libavfilter/af_adelay.c +++ b/libavfilter/af_adelay.c @@ -63,33 +63,20 @@ AVFILTER_DEFINE_CLASS(adelay); static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_U8P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define DELAY(name, type, fill) \ diff --git a/libavfilter/af_adenorm.c b/libavfilter/af_adenorm.c index ee8d26ee73..5c604bcbd7 100644 --- a/libavfilter/af_adenorm.c +++ b/libavfilter/af_adenorm.c @@ -45,31 +45,19 @@ typedef struct ADenormContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void dc_denorm_fltp(AVFilterContext *ctx, void *dstp, diff --git a/libavfilter/af_aderivative.c b/libavfilter/af_aderivative.c index 6b3e4dd0e4..abf993ed29 100644 --- a/libavfilter/af_aderivative.c +++ b/libavfilter/af_aderivative.c @@ -29,8 +29,6 @@ typedef struct ADerivativeContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat derivative_sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP, @@ -40,26 +38,16 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(strcmp(ctx->filter->name, "aintegral") ? - derivative_sample_fmts : integral_sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ? + derivative_sample_fmts : integral_sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define DERIVATIVE(name, type) \ diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c index 4e45ab9a8b..c94ad2be73 100644 --- a/libavfilter/af_aecho.c +++ b/libavfilter/af_aecho.c @@ -154,33 +154,20 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c index 66fe7036fa..9fbf8bbb73 100644 --- a/libavfilter/af_aemphasis.c +++ b/libavfilter/af_aemphasis.c @@ -153,32 +153,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static inline void set_highshelf_rbj(BiquadCoeffs *bq, double freq, double q, double peak, double sr) diff --git a/libavfilter/af_aexciter.c b/libavfilter/af_aexciter.c index e7f72cca38..778a253bf1 100644 --- a/libavfilter/af_aexciter.c +++ b/libavfilter/af_aexciter.c @@ -220,32 +220,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index b22432f2e7..7c340fdb2a 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -59,8 +59,6 @@ enum CurveType { NONE = -1, TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, @@ -68,26 +66,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static double fade_gain(int curve, int64_t index, int64_t range) diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index 693585439b..38bd474c80 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -1349,31 +1349,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c index 877ccc5be0..9ca63cbddb 100644 --- a/libavfilter/af_afftfilt.c +++ b/libavfilter/af_afftfilt.c @@ -412,32 +412,19 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 309eb3dd2e..e60bdc4f6f 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -715,8 +715,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { AudioFIRContext *s = ctx->priv; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE @@ -729,21 +727,18 @@ static int query_formats(AVFilterContext *ctx) if (s->response) { AVFilterLink *videolink = ctx->outputs[1]; - formats = ff_make_format_list(pix_fmts); + AVFilterFormats *formats = ff_make_format_list(pix_fmts); if ((ret = ff_formats_ref(formats, &videolink->incfg.formats)) < 0) return ret; } - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - if (s->ir_format) { - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; } else { AVFilterChannelLayouts *mono = NULL; + AVFilterChannelLayouts *layouts = ff_all_channel_counts(); if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0) return ret; @@ -759,12 +754,10 @@ static int query_formats(AVFilterContext *ctx) } } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_afreqshift.c b/libavfilter/af_afreqshift.c index 85a1e65a96..c2fa2cedfc 100644 --- a/libavfilter/af_afreqshift.c +++ b/libavfilter/af_afreqshift.c @@ -49,32 +49,20 @@ typedef struct AFreqShift { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define PFILTER(name, type, sin, cos, cc) \ diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c index a23bb902ea..6a25c98d7a 100644 --- a/libavfilter/af_afwtdn.c +++ b/libavfilter/af_afwtdn.c @@ -463,31 +463,19 @@ AVFILTER_DEFINE_CLASS(afwtdn); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define pow2(x) (1U << (x)) diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c index 3c858021d1..cd9438c9e1 100644 --- a/libavfilter/af_agate.c +++ b/libavfilter/af_agate.c @@ -189,7 +189,6 @@ AVFILTER_DEFINE_CLASS(agate); static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts; int ret; if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0) @@ -198,18 +197,11 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -346,7 +338,6 @@ static int activate(AVFilterContext *ctx) static int scquery_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -371,12 +362,10 @@ static int scquery_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int scconfig_output(AVFilterLink *outlink) diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 6ac39872ef..7ff49aab4d 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -79,7 +79,6 @@ static int query_formats(AVFilterContext *ctx) { AudioIIRContext *s = ctx->priv; AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE @@ -98,25 +97,16 @@ static int query_formats(AVFilterContext *ctx) return ret; } - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; sample_fmts[0] = s->sample_format; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define IIR_CH(name, type, min, max, need_clipping) \ diff --git a/libavfilter/af_alimiter.c b/libavfilter/af_alimiter.c index 30f1a4cba5..f98575ecc8 100644 --- a/libavfilter/af_alimiter.c +++ b/libavfilter/af_alimiter.c @@ -278,32 +278,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 2e45b7c277..7dcd09bb9f 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -76,7 +76,6 @@ static int query_formats(AVFilterContext *ctx) }; AMergeContext *s = ctx->priv; int64_t inlayout[SWR_CH_MAX], outlayout = 0; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; int i, ret, overlap = 0, nb_ch = 0; @@ -129,8 +128,7 @@ static int query_formats(AVFilterContext *ctx) if ((inlayout[i] >> c) & 1) *(route[i]++) = out_ch_number++; } - formats = ff_make_format_list(packed_sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, packed_sample_fmts)) < 0) return ret; for (i = 0; i < s->nb_inputs; i++) { layouts = NULL; @@ -145,7 +143,7 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) return ret; - return ff_set_common_samplerates(ctx, ff_all_samplerates()); + return ff_set_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 2296b49243..1a1de86335 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -603,11 +603,11 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - if ((ret = ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0 || + (ret = ff_set_all_samplerates(ctx)) < 0) return ret; - return ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); + return ff_set_all_channel_counts(ctx); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, diff --git a/libavfilter/af_amultiply.c b/libavfilter/af_amultiply.c index b50bbfb6ce..0ebfbe7c2b 100644 --- a/libavfilter/af_amultiply.c +++ b/libavfilter/af_amultiply.c @@ -42,33 +42,20 @@ typedef struct AudioMultiplyContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int activate(AVFilterContext *ctx) diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c index 05e84282f0..0ed49bb630 100644 --- a/libavfilter/af_anlmdn.c +++ b/libavfilter/af_anlmdn.c @@ -95,31 +95,19 @@ AVFILTER_DEFINE_CLASS(anlmdn); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K) diff --git a/libavfilter/af_anlms.c b/libavfilter/af_anlms.c index 26df40107f..fb9c8cef4c 100644 --- a/libavfilter/af_anlms.c +++ b/libavfilter/af_anlms.c @@ -78,32 +78,19 @@ AVFILTER_DEFINE_CLASS(anlms); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static float fir_sample(AudioNLMSContext *s, float sample, float *delay, diff --git a/libavfilter/af_aphaser.c b/libavfilter/af_aphaser.c index e033a6d904..264faebb41 100644 --- a/libavfilter/af_aphaser.c +++ b/libavfilter/af_aphaser.c @@ -85,8 +85,6 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, @@ -94,26 +92,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c index 56ff4579d6..ce84d472e4 100644 --- a/libavfilter/af_apulsator.c +++ b/libavfilter/af_apulsator.c @@ -196,8 +196,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c index 0c70a32271..0a227b35ac 100644 --- a/libavfilter/af_arnndn.c +++ b/libavfilter/af_arnndn.c @@ -330,33 +330,21 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; int ret, sample_rates[] = { 48000, -1 }; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_asoftclip.c b/libavfilter/af_asoftclip.c index 17361ba3a2..44071d8dae 100644 --- a/libavfilter/af_asoftclip.c +++ b/libavfilter/af_asoftclip.c @@ -84,32 +84,20 @@ AVFILTER_DEFINE_CLASS(asoftclip); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void filter_flt(ASoftClipContext *s, diff --git a/libavfilter/af_asr.c b/libavfilter/af_asr.c index b34cdd38ee..8dbe67fa5b 100644 --- a/libavfilter/af_asr.c +++ b/libavfilter/af_asr.c @@ -133,7 +133,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_MONO )) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates )) < 0) return ret; return 0; diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 23a5785d5a..67e7aaf69f 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -147,8 +147,6 @@ AVFILTER_DEFINE_CLASS(astats); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, @@ -157,26 +155,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void reset_stats(AudioStatsContext *s) diff --git a/libavfilter/af_asubboost.c b/libavfilter/af_asubboost.c index f36ce81552..4ec7cf64e0 100644 --- a/libavfilter/af_asubboost.c +++ b/libavfilter/af_asubboost.c @@ -46,31 +46,19 @@ typedef struct ASubBoostContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int get_coeffs(AVFilterContext *ctx) diff --git a/libavfilter/af_asupercut.c b/libavfilter/af_asupercut.c index 54921cf4c3..c6f5b0d1bd 100644 --- a/libavfilter/af_asupercut.c +++ b/libavfilter/af_asupercut.c @@ -51,32 +51,20 @@ typedef struct ASuperCutContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void calc_q_factors(int n, double *q) diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 80a33c43ed..b1d6cf279f 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -995,9 +995,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts = NULL; - AVFilterFormats *formats = NULL; - // WSOLA necessitates an internal sliding window ring buffer // for incoming audio stream. // @@ -1012,29 +1009,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) { - return AVERROR(ENOMEM); - } - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) { - return AVERROR(ENOMEM); - } - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) { - return AVERROR(ENOMEM); - } - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/af_axcorrelate.c b/libavfilter/af_axcorrelate.c index cec39dee76..f08eeddb39 100644 --- a/libavfilter/af_axcorrelate.c +++ b/libavfilter/af_axcorrelate.c @@ -48,32 +48,19 @@ typedef struct AudioXCorrelateContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static float mean_sum(const float *in, int size) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index 0baf5541fd..8ccdbf4fe2 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -146,8 +146,6 @@ typedef struct BiquadsContext { static int query_formats(AVFilterContext *ctx) { BiquadsContext *s = ctx->priv; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat auto_sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, @@ -159,46 +157,33 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + const enum AVSampleFormat *sample_fmts_list = sample_fmts; + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; switch (s->precision) { case 0: sample_fmts[0] = AV_SAMPLE_FMT_S16P; - formats = ff_make_format_list(sample_fmts); break; case 1: sample_fmts[0] = AV_SAMPLE_FMT_S32P; - formats = ff_make_format_list(sample_fmts); break; case 2: sample_fmts[0] = AV_SAMPLE_FMT_FLTP; - formats = ff_make_format_list(sample_fmts); break; case 3: sample_fmts[0] = AV_SAMPLE_FMT_DBLP; - formats = ff_make_format_list(sample_fmts); break; default: - formats = ff_make_format_list(auto_sample_fmts); + sample_fmts_list = auto_sample_fmts; break; } - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts_list); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define BIQUAD_FILTER(name, type, min, max, need_clipping) \ diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c index 7b9958325f..42ce56be8e 100644 --- a/libavfilter/af_bs2b.c +++ b/libavfilter/af_bs2b.c @@ -92,7 +92,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { @@ -111,17 +110,11 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 3cdf8b2bd8..6ea0000b32 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -284,7 +284,7 @@ static int channelmap_query_formats(AVFilterContext *ctx) int ret; if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_all_samplerates() )) < 0 || + (ret = ff_set_all_samplerates(ctx )) < 0 || (ret = ff_add_channel_layout(&channel_layouts, s->output_layout)) < 0 || (ret = ff_channel_layouts_ref(channel_layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 3bd3355d88..23722f0a15 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -113,7 +113,7 @@ static int query_formats(AVFilterContext *ctx) int i, ret; if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + (ret = ff_set_all_samplerates(ctx)) < 0) return ret; if ((ret = ff_add_channel_layout(&in_layouts, s->channel_layout)) < 0 || diff --git a/libavfilter/af_chorus.c b/libavfilter/af_chorus.c index 72e684bd3a..6b89dd4ced 100644 --- a/libavfilter/af_chorus.c +++ b/libavfilter/af_chorus.c @@ -156,31 +156,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 62d9c2e941..920f6da34a 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -102,32 +102,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void count_items(char *item_str, int *nb_items) diff --git a/libavfilter/af_compensationdelay.c b/libavfilter/af_compensationdelay.c index f2e0dcd467..d1a965f264 100644 --- a/libavfilter/af_compensationdelay.c +++ b/libavfilter/af_compensationdelay.c @@ -65,32 +65,19 @@ AVFILTER_DEFINE_CLASS(compensationdelay); static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c index 7ad9c4f483..410d629753 100644 --- a/libavfilter/af_crossfeed.c +++ b/libavfilter/af_crossfeed.c @@ -48,7 +48,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO)) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_all_samplerates())) < 0) + (ret = ff_set_all_samplerates (ctx )) < 0) return ret; return 0; diff --git a/libavfilter/af_crystalizer.c b/libavfilter/af_crystalizer.c index f4ad326ede..50c3c812a4 100644 --- a/libavfilter/af_crystalizer.c +++ b/libavfilter/af_crystalizer.c @@ -45,32 +45,20 @@ AVFILTER_DEFINE_CLASS(crystalizer); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } typedef struct ThreadData { diff --git a/libavfilter/af_dcshift.c b/libavfilter/af_dcshift.c index 1384ad87bf..dd791c6f53 100644 --- a/libavfilter/af_dcshift.c +++ b/libavfilter/af_dcshift.c @@ -54,31 +54,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/af_deesser.c b/libavfilter/af_deesser.c index e05ee9f10b..2daa59d78b 100644 --- a/libavfilter/af_deesser.c +++ b/libavfilter/af_deesser.c @@ -70,31 +70,19 @@ AVFILTER_DEFINE_CLASS(deesser); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c index 58932fe6c5..c7e136579a 100644 --- a/libavfilter/af_drmeter.c +++ b/libavfilter/af_drmeter.c @@ -55,32 +55,19 @@ AVFILTER_DEFINE_CLASS(drmeter); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index 01c99788af..5c30c3acc2 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -129,32 +129,19 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static inline int frame_size(int sample_rate, int frame_len_msec) diff --git a/libavfilter/af_earwax.c b/libavfilter/af_earwax.c index a5a7e6a5d2..9656008e07 100644 --- a/libavfilter/af_earwax.c +++ b/libavfilter/af_earwax.c @@ -90,7 +90,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO )) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates )) < 0) return ret; return 0; diff --git a/libavfilter/af_extrastereo.c b/libavfilter/af_extrastereo.c index 0555aa6610..6641cb962d 100644 --- a/libavfilter/af_extrastereo.c +++ b/libavfilter/af_extrastereo.c @@ -53,8 +53,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index 77de69e3ef..b8ec20f5ae 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -182,32 +182,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void fast_convolute(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, float *av_restrict conv_buf, diff --git a/libavfilter/af_flanger.c b/libavfilter/af_flanger.c index 6984ab12d3..976c67fdc2 100644 --- a/libavfilter/af_flanger.c +++ b/libavfilter/af_flanger.c @@ -90,31 +90,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_haas.c b/libavfilter/af_haas.c index b1a207f808..2aecdb6488 100644 --- a/libavfilter/af_haas.c +++ b/libavfilter/af_haas.c @@ -91,8 +91,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 144c0d31ed..3d180bbbda 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -1648,8 +1648,7 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - return - ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates) ); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 5e8fadb6cd..1b7dd51d64 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -624,10 +624,7 @@ static int query_formats(AVFilterContext *ctx) } } - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index 6a4b449021..6c3c80372c 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -238,7 +238,7 @@ static int join_query_formats(AVFilterContext *ctx) } if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + (ret = ff_set_all_samplerates(ctx)) < 0) return ret; return 0; diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c index 4060251670..8c33ef9a92 100644 --- a/libavfilter/af_ladspa.c +++ b/libavfilter/af_ladspa.c @@ -657,42 +657,28 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { LADSPAContext *s = ctx->priv; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; if (s->nb_inputs) { - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - ret = ff_set_common_samplerates(ctx, formats); + ret = ff_set_all_samplerates(ctx); if (ret < 0) return ret; } else { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); + ret = ff_set_common_samplerates_from_list(ctx, sample_rates); if (ret < 0) return ret; } if (s->nb_inputs == 1 && s->nb_outputs == 1) { // We will instantiate multiple LADSPA_Handle, one over each channel - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; } else if (s->nb_inputs == 2 && s->nb_outputs == 2) { diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index a07e8a3c93..54a58bb9a1 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -685,7 +685,6 @@ static int query_formats(AVFilterContext *ctx) { LoudNormContext *s = ctx->priv; AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; static const int input_srate[] = {192000, -1}; @@ -693,19 +692,11 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index 28b729691d..e39efa5c41 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -476,32 +476,22 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { LV2Context *s = ctx->priv; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; if (s->nb_inputs) { - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - ret = ff_set_common_samplerates(ctx, formats); + ret = ff_set_all_samplerates(ctx); if (ret < 0) return ret; } else { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); + ret = ff_set_common_samplerates_from_list(ctx, sample_rates); if (ret < 0) return ret; } diff --git a/libavfilter/af_mcompand.c b/libavfilter/af_mcompand.c index 08d93f8c6a..3164a8f7db 100644 --- a/libavfilter/af_mcompand.c +++ b/libavfilter/af_mcompand.c @@ -124,32 +124,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void count_items(char *item_str, int *nb_items, char delimiter) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 7ae18e9bfe..22b4421859 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -251,7 +251,6 @@ static int query_formats(AVFilterContext *ctx) PanContext *pan = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; int ret; @@ -260,8 +259,7 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) return ret; - formats = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, formats)) < 0) + if ((ret = ff_set_all_samplerates(ctx)) < 0) return ret; // inlink supports any channel layout diff --git a/libavfilter/af_rubberband.c b/libavfilter/af_rubberband.c index bfacbcd245..9b00a7d572 100644 --- a/libavfilter/af_rubberband.c +++ b/libavfilter/af_rubberband.c @@ -91,32 +91,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE, }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/af_sidechaincompress.c b/libavfilter/af_sidechaincompress.c index 71e27d4530..064a1070a9 100644 --- a/libavfilter/af_sidechaincompress.c +++ b/libavfilter/af_sidechaincompress.c @@ -297,7 +297,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -322,12 +321,10 @@ static int query_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -433,32 +430,19 @@ static int acompressor_filter_frame(AVFilterLink *inlink, AVFrame *in) static int acompressor_query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } #define acompressor_options options diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 53f54d1834..9a1dd2045f 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -197,7 +197,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -215,17 +214,11 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 9d6d683688..f990c48727 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -889,33 +889,20 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index 1bffd57de9..0412bc5dda 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -648,7 +648,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { struct SOFAlizerContext *s = ctx->priv; - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; int ret, sample_rates[] = { 48000, -1 }; static const enum AVSampleFormat sample_fmts[] = { @@ -656,10 +655,7 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE }; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret) return ret; @@ -681,10 +677,7 @@ static int query_formats(AVFilterContext *ctx) return ret; sample_rates[0] = s->sample_rate; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int getfilter_float(AVFilterContext *ctx, float x, float y, float z, diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c index d044177352..808f3b7c7e 100644 --- a/libavfilter/af_speechnorm.c +++ b/libavfilter/af_speechnorm.c @@ -116,32 +116,19 @@ AVFILTER_DEFINE_CLASS(speechnorm); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int get_pi_samples(PeriodItem *pi, int start, int end, int remain) diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c index d60fa55ccd..271239d204 100644 --- a/libavfilter/af_stereotools.c +++ b/libavfilter/af_stereotools.c @@ -111,8 +111,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c index 1fbb635841..2256e725d9 100644 --- a/libavfilter/af_stereowiden.c +++ b/libavfilter/af_stereowiden.c @@ -64,8 +64,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c index aa8b6376b0..fcec71921f 100644 --- a/libavfilter/af_superequalizer.c +++ b/libavfilter/af_superequalizer.c @@ -272,27 +272,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index 3fb7a1bbba..8d6eebe2e5 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx) if (ret) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_tremolo.c b/libavfilter/af_tremolo.c index 8f9e310040..959c308dee 100644 --- a/libavfilter/af_tremolo.c +++ b/libavfilter/af_tremolo.c @@ -85,32 +85,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_vibrato.c b/libavfilter/af_vibrato.c index fe4d194531..c0ef05f05d 100644 --- a/libavfilter/af_vibrato.c +++ b/libavfilter/af_vibrato.c @@ -113,32 +113,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index 844ddbeff7..a484775796 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -132,8 +132,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { VolumeContext *vol = ctx->priv; - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[][7] = { [PRECISION_FIXED] = { AV_SAMPLE_FMT_U8, @@ -155,26 +153,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE } }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts[vol->precision]); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts[vol->precision]); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src, diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index 61af21797c..df211ee0fc 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -40,21 +40,11 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - if (!(formats = ff_make_format_list(sample_fmts))) - return AVERROR(ENOMEM); - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, sample_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *samples) diff --git a/libavfilter/asrc_afirsrc.c b/libavfilter/asrc_afirsrc.c index 0ede722ba1..aba15dc5e2 100644 --- a/libavfilter/asrc_afirsrc.c +++ b/libavfilter/asrc_afirsrc.c @@ -134,29 +134,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int parse_string(char *str, float **items, int *nb_items, int *items_size) diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c index 0aab14b58f..c3e6252b3d 100644 --- a/libavfilter/asrc_anoisesrc.c +++ b/libavfilter/asrc_anoisesrc.c @@ -90,29 +90,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static double white_filter(double white, double *buf, double ha) diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c index 45d830e3a2..5d9b16dfce 100644 --- a/libavfilter/asrc_anullsrc.c +++ b/libavfilter/asrc_anullsrc.c @@ -87,10 +87,10 @@ static int query_formats(AVFilterContext *ctx) int ret; if ((ret = ff_set_common_formats (ctx, ff_all_formats (AVMEDIA_TYPE_AUDIO))) < 0 || - (ret = ff_set_common_samplerates (ctx, ff_make_format_list (sample_rates ))) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0) return ret; - return ff_set_common_channel_layouts(ctx, ff_make_format64_list(chlayouts)); + return ff_set_common_channel_layouts_from_list(ctx, chlayouts); } static av_cold int config_props(AVFilterLink *outlink) diff --git a/libavfilter/asrc_hilbert.c b/libavfilter/asrc_hilbert.c index e7d596ee46..fe0c7c8659 100644 --- a/libavfilter/asrc_hilbert.c +++ b/libavfilter/asrc_hilbert.c @@ -102,29 +102,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold int config_props(AVFilterLink *outlink) diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c index 5397d89c77..ca8991ac2c 100644 --- a/libavfilter/asrc_sinc.c +++ b/libavfilter/asrc_sinc.c @@ -74,28 +74,15 @@ static int query_formats(AVFilterContext *ctx) int sample_rates[] = { s->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static float bessel_I_0(float x) diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c index f75a5fc728..af0329e8c7 100644 --- a/libavfilter/asrc_sine.c +++ b/libavfilter/asrc_sine.c @@ -183,28 +183,15 @@ static av_cold int query_formats(AVFilterContext *ctx) int sample_rates[] = { sine->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold int config_props(AVFilterLink *outlink) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 5389d82d9f..f6bbcd8578 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -362,7 +362,6 @@ static int filter_query_formats(AVFilterContext *ctx) int ret, i; AVFilterFormats *formats; AVFilterChannelLayouts *chlayouts; - AVFilterFormats *samplerates; enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type : ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; @@ -386,8 +385,7 @@ static int filter_query_formats(AVFilterContext *ctx) if ((ret = ff_set_common_formats(ctx, formats)) < 0) return ret; if (type == AVMEDIA_TYPE_AUDIO) { - samplerates = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, samplerates)) < 0) + if ((ret = ff_set_all_samplerates(ctx)) < 0) return ret; chlayouts = ff_all_channel_layouts(); if ((ret = ff_set_common_channel_layouts(ctx, chlayouts)) < 0) diff --git a/libavfilter/f_reverse.c b/libavfilter/f_reverse.c index 2a85e6966e..336f0b80ed 100644 --- a/libavfilter/f_reverse.c +++ b/libavfilter/f_reverse.c @@ -149,14 +149,7 @@ const AVFilter ff_vf_reverse = { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; @@ -164,10 +157,7 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_all_samplerates(ctx); } static void reverse_samples_planar(AVFrame *out) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index f0468078e8..4a131f01c8 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -497,7 +497,6 @@ static int query_formats(AVFilterContext *ctx) if (!select->do_scene_detect) { return ff_default_query_formats(ctx); } else { - int ret; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, @@ -506,15 +505,8 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P10, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - - if (!fmts_list) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, fmts_list); - if (ret < 0) - return ret; + return ff_set_common_formats_from_list(ctx, pix_fmts); } - return 0; } DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM); diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 22eb76d4d7..16a54c7e44 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -305,8 +305,7 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats, *rates = NULL; - AVFilterChannelLayouts *layouts = NULL; + AVFilterFormats *formats; int ret, i; for (i = 0; i < ctx->nb_inputs; i++) { @@ -315,11 +314,9 @@ static int query_formats(AVFilterContext *ctx) return ret; if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) { - rates = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, rates)) < 0) + if ((ret = ff_set_all_samplerates(ctx)) < 0) return ret; - layouts = ff_all_channel_counts(); - if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) + if ((ret = ff_set_all_channel_counts(ctx)) < 0) return ret; } } diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 6c05b118c9..fca16273b8 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -566,6 +566,17 @@ int ff_set_common_channel_layouts(AVFilterContext *ctx, ff_channel_layouts_ref, ff_channel_layouts_unref); } +int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, + const int64_t *fmts) +{ + return ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)); +} + +int ff_set_all_channel_counts(AVFilterContext *ctx) +{ + return ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); +} + int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates) { @@ -573,6 +584,17 @@ int ff_set_common_samplerates(AVFilterContext *ctx, ff_formats_ref, ff_formats_unref); } +int ff_set_common_samplerates_from_list(AVFilterContext *ctx, + const int *samplerates) +{ + return ff_set_common_samplerates(ctx, ff_make_format_list(samplerates)); +} + +int ff_set_all_samplerates(AVFilterContext *ctx) +{ + return ff_set_common_samplerates(ctx, ff_all_samplerates()); +} + /** * A helper for query_formats() which sets all links to the same list of * formats. If there are no links hooked to this filter, the list of formats is @@ -584,6 +606,12 @@ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) ff_formats_ref, ff_formats_unref); } +int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts) +{ + return ff_set_common_formats(ctx, ff_make_format_list(fmts)); +} + + int ff_default_query_formats(AVFilterContext *ctx) { int ret; @@ -595,10 +623,10 @@ int ff_default_query_formats(AVFilterContext *ctx) if (ret < 0) return ret; if (type == AVMEDIA_TYPE_AUDIO) { - ret = ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); + ret = ff_set_all_channel_counts(ctx); if (ret < 0) return ret; - ret = ff_set_common_samplerates(ctx, ff_all_samplerates()); + ret = ff_set_all_samplerates(ctx); if (ret < 0) return ret; } diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 65acc939e3..3a8a367315 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -164,9 +164,32 @@ AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts); av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, + const int64_t *fmts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts()) + */ +av_warn_unused_result +int ff_set_all_channel_counts(AVFilterContext *ctx); + av_warn_unused_result int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates)) + */ +av_warn_unused_result +int ff_set_common_samplerates_from_list(AVFilterContext *ctx, + const int *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates()) + */ +av_warn_unused_result +int ff_set_all_samplerates(AVFilterContext *ctx); /** * A helper for query_formats() which sets all links to the same list of @@ -176,6 +199,12 @@ int ff_set_common_samplerates(AVFilterContext *ctx, av_warn_unused_result int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); +/** + * Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts); + av_warn_unused_result int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout); diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c index 9c46cfdc09..f479182140 100644 --- a/libavfilter/opencl.c +++ b/libavfilter/opencl.c @@ -31,13 +31,8 @@ int ff_opencl_filter_query_formats(AVFilterContext *avctx) AV_PIX_FMT_OPENCL, AV_PIX_FMT_NONE, }; - AVFilterFormats *formats; - formats = ff_make_format_list(pix_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pix_fmts); } static int opencl_filter_set_device(AVFilterContext *avctx, diff --git a/libavfilter/vf_amplify.c b/libavfilter/vf_amplify.c index e9e0a90b41..2640b61be8 100644 --- a/libavfilter/vf_amplify.c +++ b/libavfilter/vf_amplify.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c index 6b2f4a4e50..ad99c7a797 100644 --- a/libavfilter/vf_atadenoise.c +++ b/libavfilter/vf_atadenoise.c @@ -120,10 +120,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c index 361801e8fd..f6d36abb50 100644 --- a/libavfilter/vf_avgblur.c +++ b/libavfilter/vf_avgblur.c @@ -246,7 +246,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c index 849e75646b..f6426a5135 100644 --- a/libavfilter/vf_bbox.c +++ b/libavfilter/vf_bbox.c @@ -72,10 +72,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SET_META(key, value) \ diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c index 7b9bd9737a..7a160798d4 100644 --- a/libavfilter/vf_bilateral.c +++ b/libavfilter/vf_bilateral.c @@ -89,7 +89,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_params(AVFilterContext *ctx) diff --git a/libavfilter/vf_bitplanenoise.c b/libavfilter/vf_bitplanenoise.c index 284c2966cf..71b78f3ea1 100644 --- a/libavfilter/vf_bitplanenoise.c +++ b/libavfilter/vf_bitplanenoise.c @@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixfmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixfmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index 9f6b293b54..e7fa5ce3ab 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -98,10 +98,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index b82c044f3e..8856542053 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -54,10 +54,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SET_META(key, format, value) \ diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 0b33107b79..5eed52a5d8 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -680,10 +680,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index f719e79cb0..96bf8b671a 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 228067c8e5..d63976b70b 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -321,11 +321,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *link) diff --git a/libavfilter/vf_cas.c b/libavfilter/vf_cas.c index c5a53adfe9..4378ccd5eb 100644 --- a/libavfilter/vf_cas.c +++ b/libavfilter/vf_cas.c @@ -230,13 +230,7 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c index 45d8e43c2c..61a1ab53f9 100644 --- a/libavfilter/vf_chromakey.c +++ b/libavfilter/vf_chromakey.c @@ -331,14 +331,11 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; + const enum AVPixelFormat *pix_fmts; - AVFilterFormats *formats = NULL; + pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts; - formats = ff_make_format_list(!strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pix_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 810fd2ce9d..006d6410b7 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -74,10 +74,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SQR(x) ((x)*(x)) diff --git a/libavfilter/vf_chromashift.c b/libavfilter/vf_chromashift.c index 3f172a8e2b..8079196862 100644 --- a/libavfilter/vf_chromashift.c +++ b/libavfilter/vf_chromashift.c @@ -76,17 +76,13 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; if (!strcmp(ctx->filter->name, "rgbashift")) pix_fmts = rgb_pix_fmts; else pix_fmts = yuv_pix_fmts; - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define DEFINE_SMEAR(depth, type, div) \ diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index e3c613f10c..1b5c67e7d4 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -83,10 +83,7 @@ static int query_formats(AVFilterContext *ctx) // TODO: we can probably add way more pixel formats without any other // changes; anything with 8-bit luma in first plane should be working static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx) diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index 4e13ce97b9..1da1a643eb 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -92,10 +92,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float get_component(float v, float l, diff --git a/libavfilter/vf_colorchannelmixer.c b/libavfilter/vf_colorchannelmixer.c index 9a538ddf5f..e259fa3028 100644 --- a/libavfilter/vf_colorchannelmixer.c +++ b/libavfilter/vf_colorchannelmixer.c @@ -100,10 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float lerpf(float v0, float v1, float f) diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c index e44d9afa01..0cef043bcd 100644 --- a/libavfilter/vf_colorconstancy.c +++ b/libavfilter/vf_colorconstancy.c @@ -643,7 +643,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorcontrast.c b/libavfilter/vf_colorcontrast.c index b5b547b46f..8aae031745 100644 --- a/libavfilter/vf_colorcontrast.c +++ b/libavfilter/vf_colorcontrast.c @@ -327,13 +327,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c index 13ef50ad1d..d4567d2a30 100644 --- a/libavfilter/vf_colorcorrect.c +++ b/libavfilter/vf_colorcorrect.c @@ -150,13 +150,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorize.c b/libavfilter/vf_colorize.c index 653832ab92..1dc99681ce 100644 --- a/libavfilter/vf_colorize.c +++ b/libavfilter/vf_colorize.c @@ -232,13 +232,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c index e0b4372842..93e69b712c 100644 --- a/libavfilter/vf_colorkey.c +++ b/libavfilter/vf_colorkey.c @@ -171,13 +171,7 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static const AVFilterPad colorkey_inputs[] = { diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c index 8bc0d96df0..b17bb9f11f 100644 --- a/libavfilter/vf_colorlevels.c +++ b/libavfilter/vf_colorlevels.c @@ -87,10 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index c304f2dba8..0686ca068b 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -413,10 +413,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_UYVY422, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *link, AVFrame *in) diff --git a/libavfilter/vf_colortemperature.c b/libavfilter/vf_colortemperature.c index 1a4c9261f6..ad288e3b84 100644 --- a/libavfilter/vf_colortemperature.c +++ b/libavfilter/vf_colortemperature.c @@ -293,13 +293,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c index c0fc7356bd..db92f5aa0b 100644 --- a/libavfilter/vf_convolution.c +++ b/libavfilter/vf_convolution.c @@ -100,7 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_convolve.c b/libavfilter/vf_convolve.c index a0066bbd39..fd0f3ca404 100644 --- a/libavfilter/vf_convolve.c +++ b/libavfilter/vf_convolve.c @@ -95,10 +95,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static int config_input_main(AVFilterLink *inlink) diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c index 337778224d..a1502073fb 100644 --- a/libavfilter/vf_cover_rect.c +++ b/libavfilter/vf_cover_rect.c @@ -62,7 +62,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index deeb9e480a..97c42a5c35 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -63,10 +63,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp) diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 64cfea1527..457fd77184 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -531,10 +531,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_slice_packed(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) diff --git a/libavfilter/vf_dblur.c b/libavfilter/vf_dblur.c index dcb6635c95..f3d0ab1141 100644 --- a/libavfilter/vf_dblur.c +++ b/libavfilter/vf_dblur.c @@ -136,7 +136,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c index c7f949f9f5..8c0691c07f 100644 --- a/libavfilter/vf_dctdnoiz.c +++ b/libavfilter/vf_dctdnoiz.c @@ -661,10 +661,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c index aa560bd9fb..767f1c7687 100644 --- a/libavfilter/vf_deband.c +++ b/libavfilter/vf_deband.c @@ -108,11 +108,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->coupling ? cpix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->coupling ? cpix_fmts : pix_fmts); } static float frand(int x, int y) diff --git a/libavfilter/vf_deblock.c b/libavfilter/vf_deblock.c index 2d91fe358b..4069123baf 100644 --- a/libavfilter/vf_deblock.c +++ b/libavfilter/vf_deblock.c @@ -84,10 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } #define WEAK_HFILTER(name, type, ldiv) \ diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 72ed349427..9ef03ff1a3 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -365,10 +365,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c index b79d4a51c4..8660eb08b4 100644 --- a/libavfilter/vf_dedot.c +++ b/libavfilter/vf_dedot.c @@ -75,10 +75,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } #define DEFINE_DEDOTCRAWL(name, type, div) \ diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c index 1ce8a482e8..b3a301edaf 100644 --- a/libavfilter/vf_deflicker.c +++ b/libavfilter/vf_deflicker.c @@ -115,10 +115,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int deflicker8(AVFilterContext *ctx, diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index 3c2d87c7c8..06c4c5e2df 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -106,13 +106,8 @@ static int qsvdeint_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index 9838301702..4d2966e249 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -234,10 +234,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c index 5037f3a5f7..a5c003ecdf 100644 --- a/libavfilter/vf_derain.c +++ b/libavfilter/vf_derain.c @@ -58,15 +58,12 @@ AVFILTER_DEFINE_CLASS(derain); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; const enum AVPixelFormat pixel_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - formats = ff_make_format_list(pixel_fmts); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 4ff6a94702..7794eecc8d 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -379,10 +379,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *link) diff --git a/libavfilter/vf_despill.c b/libavfilter/vf_despill.c index e0990d7443..315104638b 100644 --- a/libavfilter/vf_despill.c +++ b/libavfilter/vf_despill.c @@ -125,13 +125,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static const AVFilterPad despill_inputs[] = { diff --git a/libavfilter/vf_displace.c b/libavfilter/vf_displace.c index 9c310e1740..fcdbadb1c1 100644 --- a/libavfilter/vf_displace.c +++ b/libavfilter/vf_displace.c @@ -78,7 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void displace_planar(DisplaceContext *s, const AVFrame *in, diff --git a/libavfilter/vf_dnn_classify.c b/libavfilter/vf_dnn_classify.c index 7900255cfe..eb8758b265 100644 --- a/libavfilter/vf_dnn_classify.c +++ b/libavfilter/vf_dnn_classify.c @@ -207,8 +207,7 @@ static int dnn_classify_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_classify_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index d23e30aedd..629743ae61 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -350,8 +350,7 @@ static int dnn_detect_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_detect_filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c index e1d9d24683..8b7471c8cb 100644 --- a/libavfilter/vf_dnn_processing.c +++ b/libavfilter/vf_dnn_processing.c @@ -75,8 +75,7 @@ static int query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } #define LOG_FORMAT_CHANNEL_MISMATCH() \ diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 1e9e028650..373a6f45dd 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -193,10 +193,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c index e21d341fd2..e6111b4a27 100644 --- a/libavfilter/vf_edgedetect.c +++ b/libavfilter/vf_edgedetect.c @@ -101,7 +101,6 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat wires_pix_fmts[] = {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat canny_pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat colormix_pix_fmts[] = {AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list; const enum AVPixelFormat *pix_fmts = NULL; if (edgedetect->mode == MODE_WIRES) { @@ -113,10 +112,7 @@ static int query_formats(AVFilterContext *ctx) } else { av_assert0(0); } - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c index 008f470068..afaa6225d2 100644 --- a/libavfilter/vf_elbg.c +++ b/libavfilter/vf_elbg.c @@ -91,10 +91,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; if (!elbg->pal8) { - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } else { static const enum AVPixelFormat pal8_fmt[] = { AV_PIX_FMT_PAL8, diff --git a/libavfilter/vf_entropy.c b/libavfilter/vf_entropy.c index 32f4bac95d..73ece7cbb9 100644 --- a/libavfilter/vf_entropy.c +++ b/libavfilter/vf_entropy.c @@ -73,10 +73,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixfmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixfmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_epx.c b/libavfilter/vf_epx.c index 676513c302..f33be65095 100644 --- a/libavfilter/vf_epx.c +++ b/libavfilter/vf_epx.c @@ -228,10 +228,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index 7d740d501a..e1953db891 100644 --- a/libavfilter/vf_eq.c +++ b/libavfilter/vf_eq.c @@ -243,10 +243,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_estdif.c b/libavfilter/vf_estdif.c index 863d453775..92b1c77806 100644 --- a/libavfilter/vf_estdif.c +++ b/libavfilter/vf_estdif.c @@ -129,10 +129,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c index 5374a8396e..135a9a0e03 100644 --- a/libavfilter/vf_exposure.c +++ b/libavfilter/vf_exposure.c @@ -82,13 +82,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index 3c65b0f2ac..05ab762ec8 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -149,22 +149,20 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pixel_fmts; if (s->alpha) { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts_alpha); + pixel_fmts = pix_fmts_alpha; else - fmts_list = ff_make_format_list(pix_fmts_rgba); + pixel_fmts = pix_fmts_rgba; } else { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts); + pixel_fmts = pix_fmts; else - fmts_list = ff_make_format_list(pix_fmts_rgb); + pixel_fmts = pix_fmts_rgb; } - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } const static enum AVPixelFormat studio_level_pix_fmts[] = { diff --git a/libavfilter/vf_fftdnoiz.c b/libavfilter/vf_fftdnoiz.c index 78dde44e80..eeb3dd9572 100644 --- a/libavfilter/vf_fftdnoiz.c +++ b/libavfilter/vf_fftdnoiz.c @@ -135,10 +135,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c index bcef9ff7d2..541e780ce1 100644 --- a/libavfilter/vf_fftfilt.c +++ b/libavfilter/vf_fftfilt.c @@ -404,10 +404,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static const AVFilterPad fftfilt_inputs[] = { diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c index 2515bc9de9..8ceac44c76 100644 --- a/libavfilter/vf_fillborders.c +++ b/libavfilter/vf_fillborders.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void smear_borders8(FillBordersContext *s, AVFrame *frame) diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c index 1a94655b6b..c0c210d9ef 100644 --- a/libavfilter/vf_find_rect.c +++ b/libavfilter/vf_find_rect.c @@ -67,7 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static AVFrame *downscale(AVFrame *in) diff --git a/libavfilter/vf_floodfill.c b/libavfilter/vf_floodfill.c index 3b17b04c61..28045f1c2e 100644 --- a/libavfilter/vf_floodfill.c +++ b/libavfilter/vf_floodfill.c @@ -367,13 +367,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 960d4b0acf..6c5475b84a 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -129,12 +129,8 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { FormatContext *s = ctx->priv; - AVFilterFormats *formats = ff_make_format_list(s->formats); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, s->formats); } diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c index 4fa9b4d144..2bf6ed538a 100644 --- a/libavfilter/vf_framepack.c +++ b/libavfilter/vf_framepack.c @@ -82,10 +82,7 @@ static const enum AVPixelFormat formats_supported[] = { static int query_formats(AVFilterContext *ctx) { // this will ensure that formats are the same on all pads - AVFilterFormats *fmts_list = ff_make_format_list(formats_supported); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, formats_supported); } static av_cold void framepack_uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index 6b509443a6..e8f6b5b8c5 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -231,10 +231,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define BLEND_FRAME_FUNC(nbits) \ diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c index 9cf8fbab15..39d712d21e 100644 --- a/libavfilter/vf_freezedetect.c +++ b/libavfilter/vf_freezedetect.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c index 44d22fc1e4..88b13d638f 100644 --- a/libavfilter/vf_fspp.c +++ b/libavfilter/vf_fspp.c @@ -503,10 +503,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index 3f61275658..1def5b049b 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -227,7 +227,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } void ff_gblur_init(GBlurContext *s) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index d9bb6ac256..4162476f41 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -335,15 +335,9 @@ static int geq_query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pix_fmts = geq->is_rgb ? rgb_pix_fmts : yuv_pix_fmts; - if (geq->is_rgb) { - fmts_list = ff_make_format_list(rgb_pix_fmts); - } else - fmts_list = ff_make_format_list(yuv_pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int geq_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index af77b13d4d..f1cf9a3a06 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -155,10 +155,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index e2bf08f5c3..83976cbcae 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -150,7 +150,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_histeq.c b/libavfilter/vf_histeq.c index dea819e672..dc17afe30d 100644 --- a/libavfilter/vf_histeq.c +++ b/libavfilter/vf_histeq.c @@ -100,10 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index bd3eb2d01c..99c43593cd 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -244,10 +244,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void calc_coefs(AVFilterContext *ctx) diff --git a/libavfilter/vf_hqx.c b/libavfilter/vf_hqx.c index 8b0d794b6e..b6c3893b66 100644 --- a/libavfilter/vf_hqx.c +++ b/libavfilter/vf_hqx.c @@ -464,10 +464,7 @@ HQX_FUNC(4) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c index 3d250dbe25..3df27d985c 100644 --- a/libavfilter/vf_hue.c +++ b/libavfilter/vf_hue.c @@ -263,10 +263,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_hysteresis.c b/libavfilter/vf_hysteresis.c index 3732ed5c22..12025f9eb6 100644 --- a/libavfilter/vf_hysteresis.c +++ b/libavfilter/vf_hysteresis.c @@ -81,7 +81,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int process_frame(FFFrameSync *fs) diff --git a/libavfilter/vf_identity.c b/libavfilter/vf_identity.c index f47611924e..f5dcdfc906 100644 --- a/libavfilter/vf_identity.c +++ b/libavfilter/vf_identity.c @@ -257,10 +257,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index 54fc08e915..36ec73df46 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -395,10 +395,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c index a86407beb0..04c04b7e13 100644 --- a/libavfilter/vf_kerndeint.c +++ b/libavfilter/vf_kerndeint.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_lagfun.c b/libavfilter/vf_lagfun.c index e147479671..0f4f38e0ed 100644 --- a/libavfilter/vf_lagfun.c +++ b/libavfilter/vf_lagfun.c @@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c index 7bd008d3d8..9d89f79101 100644 --- a/libavfilter/vf_lenscorrection.c +++ b/libavfilter/vf_lenscorrection.c @@ -203,10 +203,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c index f34add961a..ffe81b9bc2 100644 --- a/libavfilter/vf_lensfun.c +++ b/libavfilter/vf_lensfun.c @@ -197,8 +197,7 @@ static int query_formats(AVFilterContext *ctx) { // Some of the functions provided by lensfun require pixels in RGB format static const enum AVPixelFormat fmts[] = {AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, fmts); } static float lanczos_kernel(float x) diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 221a8ac4c2..8c65007044 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -69,10 +69,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct OCVContext { diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c index d2621c7a9f..fc8a0183be 100644 --- a/libavfilter/vf_libvmaf.c +++ b/libavfilter/vf_libvmaf.c @@ -256,10 +256,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c index 04bfbb63d1..3bf1b371cf 100644 --- a/libavfilter/vf_limiter.c +++ b/libavfilter/vf_limiter.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void limiter8(const uint8_t *src, uint8_t *dst, diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c index 3f98d5077d..8b2a102369 100644 --- a/libavfilter/vf_lumakey.c +++ b/libavfilter/vf_lumakey.c @@ -154,13 +154,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 47c2416da7..78f0955446 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -150,10 +150,7 @@ static int query_formats(AVFilterContext *ctx) const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts : s->is_yuv ? yuv_pix_fmts : all_pix_fmts; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } /** diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c index 658a0bfa56..85669a2e2d 100644 --- a/libavfilter/vf_lut2.c +++ b/libavfilter/vf_lut2.c @@ -176,7 +176,7 @@ static int query_formats(AVFilterContext *ctx) int ret; if (s->tlut2 || !s->odepth) - return ff_set_common_formats(ctx, ff_make_format_list(all_pix_fmts)); + return ff_set_common_formats_from_list(ctx, all_pix_fmts); ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats); if (ret < 0) diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index c86585cf09..b81ef46b48 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -1166,10 +1166,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c index 050e3ae6e4..2cd1ec88c7 100644 --- a/libavfilter/vf_maskedclamp.c +++ b/libavfilter/vf_maskedclamp.c @@ -84,7 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int maskedclamp_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c index 28ac0dd52d..6a15a907c5 100644 --- a/libavfilter/vf_maskedmerge.c +++ b/libavfilter/vf_maskedmerge.c @@ -61,7 +61,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_maskedminmax.c b/libavfilter/vf_maskedminmax.c index 0d79fc177f..6ad5ddb1de 100644 --- a/libavfilter/vf_maskedminmax.c +++ b/libavfilter/vf_maskedminmax.c @@ -87,7 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void maskedmin8(const uint8_t *src, uint8_t *dst, const uint8_t *f1, const uint8_t *f2, int w) diff --git a/libavfilter/vf_maskedthreshold.c b/libavfilter/vf_maskedthreshold.c index 518ab54546..e80d383f9d 100644 --- a/libavfilter/vf_maskedthreshold.c +++ b/libavfilter/vf_maskedthreshold.c @@ -79,7 +79,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void threshold8(const uint8_t *src, const uint8_t *ref, uint8_t *dst, int threshold, int w) diff --git a/libavfilter/vf_maskfun.c b/libavfilter/vf_maskfun.c index 0f3e3545b3..70198c66bc 100644 --- a/libavfilter/vf_maskfun.c +++ b/libavfilter/vf_maskfun.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c index 1a49829d5b..034e72a487 100644 --- a/libavfilter/vf_mcdeint.c +++ b/libavfilter/vf_mcdeint.c @@ -167,10 +167,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) diff --git a/libavfilter/vf_median.c b/libavfilter/vf_median.c index 1e66ab87ff..e02629a5ca 100644 --- a/libavfilter/vf_median.c +++ b/libavfilter/vf_median.c @@ -107,7 +107,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void check_params(MedianContext *s, AVFilterLink *inlink) diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index f57f2578ec..1b65c738d5 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -81,10 +81,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_midequalizer.c b/libavfilter/vf_midequalizer.c index ba50fa0a82..ec1ffe5539 100644 --- a/libavfilter/vf_midequalizer.c +++ b/libavfilter/vf_midequalizer.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int process_frame(FFFrameSync *fs) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index c6aed7755f..4b58eb00d8 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -249,10 +249,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static uint64_t get_sbad(AVMotionEstContext *me_ctx, int x, int y, int x_mv, int y_mv) diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c index 29e70f8c25..870811d4d4 100644 --- a/libavfilter/vf_monochrome.c +++ b/libavfilter/vf_monochrome.c @@ -245,13 +245,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index 53f5a56ef4..301475906e 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -178,10 +178,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c index a2e9a51165..ea6449830c 100644 --- a/libavfilter/vf_neighbor.c +++ b/libavfilter/vf_neighbor.c @@ -73,7 +73,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void erosion(uint8_t *dst, const uint8_t *p1, int width, diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 7451bec4ae..95cdad780e 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } /** diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index b802ca5433..cffb23d37c 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -205,10 +205,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float dot_dsp(const NNEDIContext *const s, const float *kernel, const float *input, diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c index 3a2127ade3..a9474056af 100644 --- a/libavfilter/vf_normalize.c +++ b/libavfilter/vf_normalize.c @@ -411,10 +411,7 @@ static int query_formats(AVFilterContext *ctx) // According to filter_design.txt, using ff_set_common_formats() this way // ensures the pixel formats of the input and output will be the same. That // saves a bit of effort possibly needing to handle format conversions. - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } // At this point we know the pixel format used for both input and output. We diff --git a/libavfilter/vf_ocr.c b/libavfilter/vf_ocr.c index 6de474025a..d33e7222ef 100644 --- a/libavfilter/vf_ocr.c +++ b/libavfilter/vf_ocr.c @@ -87,10 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 9155de3736..8fec1f554c 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -255,7 +255,7 @@ static int query_formats(AVFilterContext *ctx) overlay_formats = overlay_pix_fmts_gbrp; break; case OVERLAY_FORMAT_AUTO: - return ff_set_common_formats(ctx, ff_make_format_list(alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, alpha_pix_fmts); default: av_assert0(0); } diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c index 37af4e2fa0..5bab678b0f 100644 --- a/libavfilter/vf_overlay_cuda.c +++ b/libavfilter/vf_overlay_cuda.c @@ -423,9 +423,7 @@ static int overlay_cuda_query_formats(AVFilterContext *avctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } /** diff --git a/libavfilter/vf_owdenoise.c b/libavfilter/vf_owdenoise.c index f16a06e3b8..6a832b8f3c 100644 --- a/libavfilter/vf_owdenoise.c +++ b/libavfilter/vf_owdenoise.c @@ -309,10 +309,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c index a3fa080f21..eb8e5e2414 100644 --- a/libavfilter/vf_perspective.c +++ b/libavfilter/vf_perspective.c @@ -103,10 +103,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline double get_coeff(double d) diff --git a/libavfilter/vf_phase.c b/libavfilter/vf_phase.c index 556620d36c..3262454348 100644 --- a/libavfilter/vf_phase.c +++ b/libavfilter/vf_phase.c @@ -125,10 +125,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_photosensitivity.c b/libavfilter/vf_photosensitivity.c index dd3d957bfa..c28d06b08a 100644 --- a/libavfilter/vf_photosensitivity.c +++ b/libavfilter/vf_photosensitivity.c @@ -77,10 +77,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } typedef struct ThreadData_convert_frame diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c index 5cd89932f8..3fb1333bd6 100644 --- a/libavfilter/vf_pp.c +++ b/libavfilter/vf_pp.c @@ -88,10 +88,7 @@ static int pp_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int pp_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c index a9a2fa3d19..d632d9bea8 100644 --- a/libavfilter/vf_pp7.c +++ b/libavfilter/vf_pp7.c @@ -276,10 +276,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index b5d0ca6d67..1dde273eae 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -86,7 +86,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts); } static void premultiply8(const uint8_t *msrc, const uint8_t *asrc, diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c index ec14a0c363..35b9a10519 100644 --- a/libavfilter/vf_pseudocolor.c +++ b/libavfilter/vf_pseudocolor.c @@ -281,10 +281,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline float lerpf(float v0, float v1, float f) diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index e5459d3f34..715230142b 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -312,10 +312,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_pullup.c b/libavfilter/vf_pullup.c index 00d3a8dc51..8be10b4fa4 100644 --- a/libavfilter/vf_pullup.c +++ b/libavfilter/vf_pullup.c @@ -64,10 +64,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define ABS(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)) diff --git a/libavfilter/vf_readeia608.c b/libavfilter/vf_readeia608.c index 9558e938ab..fe4a8c4648 100644 --- a/libavfilter/vf_readeia608.c +++ b/libavfilter/vf_readeia608.c @@ -125,10 +125,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int config_filter(AVFilterContext *ctx, int start, int end) diff --git a/libavfilter/vf_readvitc.c b/libavfilter/vf_readvitc.c index 25cfa5f32d..8dde55b7da 100644 --- a/libavfilter/vf_readvitc.c +++ b/libavfilter/vf_readvitc.c @@ -207,10 +207,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c index 75b3ec35bb..2fde9a954c 100644 --- a/libavfilter/vf_removegrain.c +++ b/libavfilter/vf_removegrain.c @@ -57,10 +57,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define REMOVE_GRAIN_SORT_AXIS \ diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c index 4bb81a8a5b..92eeb2e5f5 100644 --- a/libavfilter/vf_removelogo.c +++ b/libavfilter/vf_removelogo.c @@ -206,10 +206,7 @@ static void convert_mask_to_strength_mask(uint8_t *data, int linesize, static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int load_mask(uint8_t **mask, int *w, int *h, diff --git a/libavfilter/vf_repeatfields.c b/libavfilter/vf_repeatfields.c index 1e2abd3a82..75f2fdbfb2 100644 --- a/libavfilter/vf_repeatfields.c +++ b/libavfilter/vf_repeatfields.c @@ -50,10 +50,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index f16207cbff..654a7171a9 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -157,10 +157,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static double get_rotated_w(void *opaque, double angle) diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c index 12fbe40655..b4f8f128b7 100644 --- a/libavfilter/vf_sab.c +++ b/libavfilter/vf_sab.c @@ -65,10 +65,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define RADIUS_MIN 0.1 diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index f3ea01634b..ecb3d62256 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -150,11 +150,8 @@ static int cudascale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static av_cold int init_hwframe_ctx(CUDAScaleContext *s, AVBufferRef *device_ctx, int width, int height) diff --git a/libavfilter/vf_scale_npp.c b/libavfilter/vf_scale_npp.c index 8d2ad3aab7..3f5538ad3f 100644 --- a/libavfilter/vf_scale_npp.c +++ b/libavfilter/vf_scale_npp.c @@ -148,9 +148,7 @@ static int nppscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_stage(NPPScaleStageContext *stage, AVBufferRef *device_ctx) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 189223a58a..2f3afa6ace 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -160,13 +160,8 @@ static int qsvscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_out_pool(AVFilterContext *ctx, diff --git a/libavfilter/vf_scdet.c b/libavfilter/vf_scdet.c index ff8bf21a9c..b9ea30d47a 100644 --- a/libavfilter/vf_scdet.c +++ b/libavfilter/vf_scdet.c @@ -74,10 +74,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_scroll.c b/libavfilter/vf_scroll.c index 4b7b45f52a..77d8db51bc 100644 --- a/libavfilter/vf_scroll.c +++ b/libavfilter/vf_scroll.c @@ -66,10 +66,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c index 4733cc48f2..af6e8b2518 100644 --- a/libavfilter/vf_selectivecolor.c +++ b/libavfilter/vf_selectivecolor.c @@ -297,10 +297,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline int comp_adjust(int scale, float value, float adjust, float k, int correction_method) diff --git a/libavfilter/vf_shear.c b/libavfilter/vf_shear.c index 6b9db161d9..849592ccde 100644 --- a/libavfilter/vf_shear.c +++ b/libavfilter/vf_shear.c @@ -114,10 +114,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define NN(type, name) \ diff --git a/libavfilter/vf_shufflepixels.c b/libavfilter/vf_shufflepixels.c index b5e757c929..051be44bf3 100644 --- a/libavfilter/vf_shufflepixels.c +++ b/libavfilter/vf_shufflepixels.c @@ -68,10 +68,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void make_horizontal_map(AVFilterContext *ctx) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 6f0ff53029..49a2996b5c 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -134,10 +134,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index a345ad6ebd..69930e9f02 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -84,7 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c index 36ed72a12c..1820bbb265 100644 --- a/libavfilter/vf_smartblur.c +++ b/libavfilter/vf_smartblur.c @@ -124,10 +124,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int flags) diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index cfa1cb77c4..51f3670f4a 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -328,10 +328,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index f930b38748..4373f749d3 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -71,15 +71,8 @@ static int query_formats(AVFilterContext *context) const enum AVPixelFormat pixel_formats[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *formats_list; - formats_list = ff_make_format_list(pixel_formats); - if (!formats_list){ - av_log(context, AV_LOG_ERROR, "could not create formats list\n"); - return AVERROR(ENOMEM); - } - - return ff_set_common_formats(context, formats_list); + return ff_set_common_formats_from_list(context, pixel_formats); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index c6e4fe286a..618b24c010 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -434,10 +434,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index ec7d410f76..099dd5724b 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -283,7 +283,6 @@ static int query_formats(AVFilterContext *ctx) { Stereo3DContext *s = ctx->priv; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; switch (s->out.format) { case ANAGLYPH_GM_COLOR: @@ -306,10 +305,7 @@ static int query_formats(AVFilterContext *ctx) pix_fmts = other_pix_fmts; } - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline uint8_t ana_convert(const int *coeff, const uint8_t *left, const uint8_t *right) diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c index 00e88eafe3..d6371644e6 100644 --- a/libavfilter/vf_super2xsai.c +++ b/libavfilter/vf_super2xsai.c @@ -255,10 +255,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c index 0c8787e331..17ceb0dfa8 100644 --- a/libavfilter/vf_threshold.c +++ b/libavfilter/vf_threshold.c @@ -67,7 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c index 825e536e67..d81702b323 100644 --- a/libavfilter/vf_thumbnail.c +++ b/libavfilter/vf_thumbnail.c @@ -262,10 +262,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad thumbnail_inputs[] = { diff --git a/libavfilter/vf_thumbnail_cuda.c b/libavfilter/vf_thumbnail_cuda.c index ceac10f72f..d92c613d91 100644 --- a/libavfilter/vf_thumbnail_cuda.c +++ b/libavfilter/vf_thumbnail_cuda.c @@ -418,10 +418,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad thumbnail_cuda_inputs[] = { diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 40d8879871..6ab43b527d 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -103,10 +103,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, diff --git a/libavfilter/vf_tmidequalizer.c b/libavfilter/vf_tmidequalizer.c index 24e1d557e2..3516592ee4 100644 --- a/libavfilter/vf_tmidequalizer.c +++ b/libavfilter/vf_tmidequalizer.c @@ -93,7 +93,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void compute_contrast_function(const float *const histograms[256], diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index 4d04118eac..da6b4e235d 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -79,7 +79,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_transpose_npp.c b/libavfilter/vf_transpose_npp.c index 2a68a832ff..5c8226b71b 100644 --- a/libavfilter/vf_transpose_npp.c +++ b/libavfilter/vf_transpose_npp.c @@ -117,8 +117,7 @@ static int npptranspose_query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int init_stage(NPPTransposeStageContext *stage, AVBufferRef *device_ctx) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 0bf72169a9..e9f75a673f 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -208,10 +208,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const char *effect_type, int width) diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c index 7029963e29..0ed9abe92c 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -305,10 +305,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 692fa43c4d..d4bd5756da 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -247,10 +247,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->alpha ? alpha_pix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->alpha ? alpha_pix_fmts : pix_fmts); } #define DEFINE_REMAP1_LINE(bits, div) \ diff --git a/libavfilter/vf_vaguedenoiser.c b/libavfilter/vf_vaguedenoiser.c index 481fc774e5..b3a800e360 100644 --- a/libavfilter/vf_vaguedenoiser.c +++ b/libavfilter/vf_vaguedenoiser.c @@ -132,10 +132,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_vibrance.c b/libavfilter/vf_vibrance.c index cca677ee78..abbc25436f 100644 --- a/libavfilter/vf_vibrance.c +++ b/libavfilter/vf_vibrance.c @@ -309,13 +309,7 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 475d0381bc..cde6a5e709 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -93,10 +93,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index 79e62c1f58..342da0b26b 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -132,10 +132,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c index c21bd40f44..4d2381abcb 100644 --- a/libavfilter/vf_vif.c +++ b/libavfilter/vf_vif.c @@ -483,10 +483,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 91754306ae..ef67deb278 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -135,10 +135,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static double get_natural_factor(const VignetteContext *s, int x, int y) diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index 5edb826f0a..e8e55d5be3 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -101,10 +101,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void filter_simple_low(int32_t *work_line, diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 1300693bac..28642fa323 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -346,10 +346,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index 2e075cfb9a..c3e5f3df85 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -137,10 +137,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c index 168a5944db..c8ff37f797 100644 --- a/libavfilter/vf_xmedian.c +++ b/libavfilter/vf_xmedian.c @@ -86,10 +86,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 17269d6b96..41069a711c 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -284,10 +284,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c index 3380f7112a..c68edc815a 100644 --- a/libavfilter/vf_yaepblur.c +++ b/libavfilter/vf_yaepblur.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 9115c23dc4..8a350aa92a 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -341,10 +341,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 250c88c8da..0b5b131786 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -311,10 +311,7 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad cellauto_outputs[] = { diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index 904baf1360..c1962b1ed8 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -91,10 +91,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static uint32_t lerp_color(uint8_t c0[4], uint8_t c1[4], float x) diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index ca12f294b8..b954f855c7 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -416,7 +416,6 @@ static int query_formats(AVFilterContext *ctx) { LifeContext *life = ctx->priv; enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; if (life->mold || memcmp(life-> life_color, "\xff\xff\xff", 3) || memcmp(life->death_color, "\x00\x00\x00", 3)) { @@ -427,8 +426,7 @@ static int query_formats(AVFilterContext *ctx) life->draw = fill_picture_monoblack; } - fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad life_outputs[] = { diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 88c14f0d48..20ae55835b 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -153,10 +153,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 8aa75a24ac..0a6f3498b5 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -296,10 +296,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int request_frame(AVFilterLink *outlink) diff --git a/libavfilter/vsrc_sierpinski.c b/libavfilter/vsrc_sierpinski.c index 7db4852892..eec9e8c25d 100644 --- a/libavfilter/vsrc_sierpinski.c +++ b/libavfilter/vsrc_sierpinski.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int fill_sierpinski(SierpinskiContext *s, int x, int y) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 08686938db..56b46c6bd8 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -376,10 +376,7 @@ static int haldclutsrc_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int haldclutsrc_config_props(AVFilterLink *outlink) @@ -659,10 +656,7 @@ static int test_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = { @@ -1097,10 +1091,7 @@ static int rgbtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int rgbtest_config_props(AVFilterLink *outlink) @@ -1274,10 +1265,7 @@ static int yuvtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int yuvtest_config_props(AVFilterLink *outlink) @@ -1426,10 +1414,7 @@ static int smptebars_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad smptebars_outputs[] = { @@ -1759,10 +1744,7 @@ static int allyuv_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = { @@ -1836,10 +1818,7 @@ static int allrgb_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = { diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c index 0ac5711182..337c8d7d5a 100644 --- a/libavfilter/vulkan.c +++ b/libavfilter/vulkan.c @@ -594,11 +594,8 @@ int ff_vk_filter_query_formats(AVFilterContext *avctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_VULKAN, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } static int vulkan_filter_set_device(AVFilterContext *avctx, From patchwork Wed Aug 11 01:17: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: 29411 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp955837iod; Tue, 10 Aug 2021 18:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfglk72Hq051mSiwGciE8OJb4jKGyoG8Fn0TKAgx4Q1r77m6E3VtAdrzQU/ljleKJhrhPJ X-Received: by 2002:a17:906:1d41:: with SMTP id o1mr1252882ejh.232.1628644716636; Tue, 10 Aug 2021 18:18:36 -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 dz19si25242858edb.116.2021.08.10.18.18.35; Tue, 10 Aug 2021 18:18:36 -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=DwZYEVYZ; 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 A436268A3B7; Wed, 11 Aug 2021 04:18:23 +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-oln040092074082.outbound.protection.outlook.com [40.92.74.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2156A68A2B2 for ; Wed, 11 Aug 2021 04:18:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLgmJsKNsARoiRUU3e95/sh+gtoWnnA9lWv4m8vmXbqjJ7zsfEiOsSTvWJ4W/179phDGDwHHuYKDZm4EZfwjyY9Mo5r4f5UH3vcjGgS+IHY3FE5bgaf/iE7K1MTW7OfwgcyykwkZjRUNCiqb+WXSm4Jng8Q2SZI8uRYJpvooEpyOC1KwZQl0Ay5gFywTkWWf0bzGYtCkbwnpqo4yWC7Z3iwOVo2eYsj+pV+8ubozXZmR5c43kfvAL++d/mCwoa2PMnLQIlpUki2W8SzNC2DVf+j+mF/kgdLO7GXU1aORhciv9gUq9YqNnINrp/DYXHlTFPX0HgFi+8uxLbG9Ci7u0g== 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=YGuMtfOi9xQbBG3dfgzqhbyBStjQkBu7LMHsWiWg+J0=; b=e7A0w2VVakgSrc0B7ilCEWvnTXnY6CiUMTVA4yJNaWPDIwcaD3EdDG312LkIDLz44RFaBAT+INMBJWYPx43bBaJS8a8mVNMOcWIDUYU+b7VGRAthFEGLq35v//iI7/vmJ8bV5yIoPNw2rb3SBZycC9bqx/C2C0WGCeaV91WithCB4zEQ/9G8y6xCZBCWWTSvT5PjKQoW/gld9aBeb8j6BQGwxut1fd24kFlbHxBAmgC4c4GOiKoiqEAc4uB7Fk/Y3rQFz1yv+H9mhAsZ8/Y2guOBbC2Pj3iFL90Xx35atV+7ERWzKmUADnJnwk1n3gv8ufQYfXxInaOMGEOp+xPWoQ== 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=YGuMtfOi9xQbBG3dfgzqhbyBStjQkBu7LMHsWiWg+J0=; b=DwZYEVYZBXoSNIKtbW0Ym7MF5OjIgC+fotz2L5fOkIn/hkugAcFMG0QP1yOBVBMGJ0RtfHqzXddBlHy8yZv0try6IoW2O/RZC2slE0rQaLZdlQSus+/cPHcN/o1se6RQGvcSw3aJhZ5C+xtuabZAGoHIY4eayHFCCWQZ4bJXBo2qC7DHUrGEHVOnNwcttUGjzy6TnQYbIRhHVnNEIKgjSodHRXJCS/bFa/2QEOUtbhCX09SQ2QSV+QxHvHAEnIOqxclmPG1YPImN/Tjh91uCia5ey4D7HqhZG0wCDWIqolR+u78Aha6YRKTuPus7LQh9ECXuzdCou5HDi0HCOC5Few== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB6886.eurprd03.prod.outlook.com (2603:10a6:20b:23c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Wed, 11 Aug 2021 01:18:15 +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.4394.023; Wed, 11 Aug 2021 01:18:15 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:48 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [6+mH5vDlN2+SI1b7TMhbKGFiac/2zXLY] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c81ca61-12d6-4964-aa88-08d95c65e4d4 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVNZZwRrMzTbQcOlzes5P/phF1luC8e2uokYTwG5bTha04Q5QcnfatgJnI+XyW58HM6FutNIKpqpFRcQV8tbd26hzMZ5AVscT7bNymEvsDZRtfzCSRrBjW8eF7ro2z2NVwo0YJBSWZD17iAyEmOc/w2L8Vfq8I7LTF4IH609a5t1cjifv+C/d2lAzVpR1dfTaNDMHWlU/CunxR+sSDuIhJq1GbMWa2dirt7PkQU7qe+CI/yUybexR+y9O0H4fljX2zSRuFWzHgFZMhOxTRWUz9RIrUzekdxwM69hLIj/JTUdk3c+Qfq9CRPGYqV9Qs8XbSIw73CSEKU6diUajBdVFB/KWfw61dPe39wNGzRDkEUz6GHX1TT9DojBWXJgJ2mASYft68+KeeafieFR50uISVnQ1jliban6bOsN0moP55OZlDMmfY14o9CSQSJzFJ1c8+DmCKpe+mc5t7I/c7p9KQw3vYTKU2Pr6k++X4R2sh3URGNnpwNW0YWRrjm11ulmIy3U6Eph4q6+PdX4/s6dziT8MNZvCpF7ZWvFP3bDH01L+s3jUFCrzFPhV5CL/8+ykslQFF1bfFAMbD+YDWR5wf9oXMnHIap5ckgwtqtoEphALlbxyg+TAPTEp0dSvbzsJZIQ0AcCIX8tj64TSpRJ5CYqCn6Ojepn0Nnor6CSIZyNM9bzGjTj8zZeyXfYnO547A804x2GuhwGW8ddYCAxYQx5xRDZkzp4O0= X-MS-TrafficTypeDiagnostic: AS8PR03MB6886: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oByev7LgNsM6vZGdRm/wJWo6sZs0vYqmgKH7jHP6hu4n/VOvYc26t7OapCsuQNWwX43FWj2jDD+q6G2fvwpheiaFiPDrqPxmFMmPa01VNA05U2C2rMtzHeWa1P7Q8NituDHpIKvjNrp7Ld+YeN0cW2gc+83iDIPGKA10PEDMwJcWuBvXSJe77pGty7qAlhscbLS06iEVI0uetDX1ur/nOjVzll/kJuw7ZfBa19jd1KjxwHW04qZSp9NsS7HaPc2fMIQrHxDpMNwBhMn5eSYINbFOpC8RqlpsjQf1MV5Cfpzf7z1Gh4A979t94xc2zlgjRCf+BsePG1LwFtLrUoHZgLQ4P3hgOUQqVHhXGg7UPIIxGVua/D4uv244Rb++F/P0EFsS6GgldB0BCNhqVzW7t26L8+dRfZoIZ7ohMNJxWNGfGdycBS7TRtVGeCb5tsaD X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oPYHVtg48zoAEgvDGDjt0nvUHSX6iDMYo8UsQ7GQ+3s+zMaUn4oRrscwt3zGnIynw6hY3o9M6rQDvtFJLItNrPA2kXLr/noTC1NVQZIY6QfPI9itRdD3+ilDPpVrJpxBU+Wxsw7iokToMdxF1C151Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c81ca61-12d6-4964-aa88-08d95c65e4d4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:15.2570 (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: AS8PR03MB6886 Subject: [FFmpeg-devel] [PATCH 05/10] avfilter/af_loudnorm: Simplify setting common samplerates 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: 1rdC0jYvpO46 This filter has only one input and output, so what it does can be more easily achieved by using ff_set_common_samplerates(). Signed-off-by: Andreas Rheinhardt --- libavfilter/af_loudnorm.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index 54a58bb9a1..8bfb5ccc74 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -684,9 +684,6 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { LoudNormContext *s = ctx->priv; - AVFilterFormats *formats; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; static const int input_srate[] = {192000, -1}; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -701,13 +698,7 @@ static int query_formats(AVFilterContext *ctx) return ret; if (s->frame_type != LINEAR_MODE) { - formats = ff_make_format_list(input_srate); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_formats_ref(formats, &inlink->outcfg.samplerates); - if (ret < 0) - return ret; - ret = ff_formats_ref(formats, &outlink->incfg.samplerates); + ret = ff_set_common_samplerates_from_list(ctx, input_srate); if (ret < 0) return ret; } From patchwork Wed Aug 11 01:17:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29412 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp955926iod; Tue, 10 Aug 2021 18:18:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym90xbm4l9pndORcTDPloI7nZi4DFT2UfYaASQg3IoJiCqrw62tuZo3NJiwIDMV0DYiiV9 X-Received: by 2002:a17:906:eda3:: with SMTP id sa3mr1185590ejb.451.1628644726864; Tue, 10 Aug 2021 18:18:46 -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 u6si23117642eju.564.2021.08.10.18.18.46; Tue, 10 Aug 2021 18:18:46 -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=KZDzPjfR; 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 9F4E268A464; Wed, 11 Aug 2021 04:18:37 +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-oln040092074054.outbound.protection.outlook.com [40.92.74.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F19768A404 for ; Wed, 11 Aug 2021 04:18:31 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ck5u71BeG1DiRaS9GuwXpaJuvCjPn5crSLmZSXWS+62Y5nfhUC5C1dwjO9GMxUVbN4TkcM1tkeAH3wi3l2vnT2ccu4s2aCWisSCr6sZ2NfW3V3H/F63P8TBwXLlc2DlEgSMHiDeD6fyzAJ6ZiCbjJMT61uYnnBKhukBiR9STxvCb4wHJbIlj34D+oof80SjVnjChHVez419iQwD2uO6vJuB2i2XOlBIvCTdwGZFlUYvvn+HdUAGoMpKw3lOP2WeAnm+gwcX5w+OxvEK/r4VzfZUN2B7rAd8Z+8z6wkiXWqUbk8FW/21DtcLQaAPsjkVrp6MF06Y2XQxGI72pLAhC5w== 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=vwiTrB++L7WUarvTCqYOoSAOAkyIK90BcAnicbErNOI=; b=GzlVs3e0aHV5gW8Y/ewR5xt+Ci3YhIhKgk7gWZ9/hbsksM2SVkh4agq10ySPsxr3F1LhGbybfdsP3imcIoy/jUlDiESNMB8IOjhn2quRLQ6QDnUXMiQmRp9VgVnGiENWEzhpAGTR4f96384AaO1grJbFX8uPIzFh+KP/xVO8nGsfyNfqlqwXq7jKAVW5/UrwG/v3Fn7GJGg7iscXM1F6Qgwt+4sB6tFwTuVG08zTgbPXten0lGaY/DSdls/d01GIpG3G2sAkPJomLKX1oeoxhW7rc9jE3xgIUu9WbffCdhSqu3VxTzuSo3TH/lqInx4xhou8JkGASH6ire1sNcF6OA== 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=vwiTrB++L7WUarvTCqYOoSAOAkyIK90BcAnicbErNOI=; b=KZDzPjfRhjEMqDRGs6QzkVIOnZ4ywuP+MXpLgSmuwPqc69Gr4+lJROaQ5mWVv7Symfd4DzgYIHQIeAqhF/OkdjJzbkScEKh8SeDb/STPJupknNnhVih+chbpOjSHwh3kFUNP2MMM+TUs2ovL+H2QuTF5MfiuxaA8GBdqz8Gj34OCZ0IENWPqojl7OTsGfGoyNdT0mGtmsA+M+BmVUbI/7pZqUXo3X1zsdqzhjfWBi44Lf2xQOTP2wuOlM/Woa2WjlUy9GJ420S8w5KSBstB5Q1b30ZQ/l+5gvVOuXXau3Kt0bl4NY9UCJGib+YuoXjbgpAtRN6Aat28YP8qyLYX0JQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB6886.eurprd03.prod.outlook.com (2603:10a6:20b:23c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Wed, 11 Aug 2021 01:18:19 +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.4394.023; Wed, 11 Aug 2021 01:18:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:49 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [HZOee2JrVAbn4ui3lssDQYcQSWJAarC2] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76da6709-6010-41d3-c675-08d95c65e774 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiT4+P6zBac8zxhOSuRwKn5livLxJ7B0lLSF2v9q8pqtvH6PMMBS3GZE58rcVrvPrdC1PFI8kvYymUrsLGN/FZTJ6GiXb08y40uFn68If3US1NgmxQger9DpvEifzUakXAsKAgfcM41IFIGJRiRfv9jr1i/u0QiYFyAv7LsEa4Be9xx2puunGDDGy6Us/jZCX+MRKwjvFo0btNvVNWuEFmfSEZBnRSlqtEP7kcqyMVVrYuPq4HIXTG6SWbGkG/bG6rzRBRVhRcGNJa9/NsakK7Ywew02QxaIjJbbM9SmlZKW1rvtypDIGptAV10XzO1IxRVOpEWmesNKXsfPqUjff3O0EVrPYGO6umXzRFOnq/5pVCyAYS22YAgc3g5zqzI+1Di9xncXMq2fqDUzHSvVuwfVMu6hkGmPR/dCDlSc3Ei0LOiWlVOanp4gBq9icLHH+q/6RGCi8UKlIjJjEbar0EaUf4/CTRZVWBmHVamZdUgt1/Am4Rcf1377H8Bf6/dZFkt3BZbtidNRU7+/E9RbHBCp6D0SzEdF5suYcLgQPUI1ejl5EM8QwRg3MlRL+CVGtV8vnPR7VBmE4+f0FZnCRSj6ZGEut7clrUpcrJVmiKtsBNlFJitg5OolypcwIBb9hxlnLa/DkQ8MPHi4YbCbriefIIhnE+zyPnqMTBrtI0OPEYj7zESP3I7xoZ9Fai4mf8YbKw3C82RSSKBwq6028wDlXkB1jFnIYQnn1LqIwTzHSYNMnMpf00iDO9P3WDv2ClI= X-MS-TrafficTypeDiagnostic: AS8PR03MB6886: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0RDpoDcEyCb4liPpfpf1cHNHHc8cihugkZsQSGXy0gRvxB5Jg+sWjb/mnjT7MWN+aKBMW8zVclFoRHfdnA1mgq7IscS2CoZZjOCRL/XX+Gai82JHrh4/2EM2oeDISJfKoIeOByWwnuVqfiQo+AjCJQemVxfq+j1zY737jIaCj2+o0Yc2b0psqh61c7sn4lopXSLrMVNkPdl/Q6fqAmFa+5WWjXoXsbq5w7qmi4PzML9wMYtV9DdksoWy8C0hx7Jpy6MPxbcrH3EdpvOBk2Pxl96LkiTWsfSUc+w/53dVnFB9H5tHow43n/Nod7V60SaignYBnj1d6nqHg7iTuzVYD4B8x6bbGqbZYMQEELuaqezh2epcvkr9cIfjCRIsoExcsHZq+Mp29VUmqPmeSQb+Px13A2eviihwlKC52K9uB1t0aQYI0ZIQCeIiPW7BL1Z3 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B78JWe8BuhAz2xeB6xHT8gBKSdYaODymnBaq4OO4HBHQEe3k/0qdrpvKmozgqwx8vll7pxLxgcUUP17lifYGTKTwe3jsyLicFmYPWAugyK63LaYDwRTty96VanJnQgZfKCuV97UcprtB/U3hm2Vh9w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76da6709-6010-41d3-c675-08d95c65e774 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:19.6239 (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: AS8PR03MB6886 Subject: [FFmpeg-devel] [PATCH 06/10] avfilter: Avoid allocation of AVFilterGraphInternal 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: 9yPPBAJ8IVsv This can be achieved by allocating it together with AVFilterGraph, with the public AVFilterGraph as first element in the new structure. Given that said structure is now more than just the internal, it has been renamed to FFFilterGraph. Accessing it is not type-safe, so this unsafety has been confined to a single function. This breaks ABI due to the removal of the removal of the AVFilterGraph.internal pointer. Signed-off-by: Andreas Rheinhardt --- This one is fairly easy due to the internal not being used much; I also followed Nicolas suggestion to factor the unsafe code out into a dedicated function. libavfilter/avfilter.c | 6 +++--- libavfilter/avfilter.h | 7 ------- libavfilter/avfiltergraph.c | 21 +++++++-------------- libavfilter/internal.h | 10 ++++++++-- libavfilter/pthread.c | 20 +++++++++++--------- 5 files changed, 29 insertions(+), 35 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c04aefcaa8..7e48ff14c5 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -167,7 +167,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, link->type = src->output_pads[srcpad].type; av_assert0(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; - ff_framequeue_init(&link->fifo, &src->graph->internal->frame_queues); + ff_framequeue_init(&link->fifo, &filtergraph(src->graph)->frame_queues); return 0; } @@ -868,9 +868,9 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) if (ctx->filter->flags & AVFILTER_FLAG_SLICE_THREADS && ctx->thread_type & ctx->graph->thread_type & AVFILTER_THREAD_SLICE && - ctx->graph->internal->thread_execute) { + filtergraph(ctx->graph)->thread_execute) { ctx->thread_type = AVFILTER_THREAD_SLICE; - ctx->internal->execute = ctx->graph->internal->thread_execute; + ctx->internal->execute = filtergraph(ctx->graph)->thread_execute; } else { ctx->thread_type = 0; } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 360f63bc45..4436eb7d2d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -758,8 +758,6 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, */ const AVClass *avfilter_get_class(void); -typedef struct AVFilterGraphInternal AVFilterGraphInternal; - /** * A function pointer passed to the @ref AVFilterGraph.execute callback to be * executed multiple times, possibly in parallel. @@ -817,11 +815,6 @@ typedef struct AVFilterGraph { */ int nb_threads; - /** - * Opaque object for libavfilter internal use. - */ - AVFilterGraphInternal *internal; - /** * Opaque user data. May be set by the caller to an arbitrary value, e.g. to * be used from callbacks like @ref AVFilterGraph.execute. diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index f6bbcd8578..f8a2426c46 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -82,21 +82,15 @@ int ff_graph_thread_init(AVFilterGraph *graph) AVFilterGraph *avfilter_graph_alloc(void) { - AVFilterGraph *ret = av_mallocz(sizeof(*ret)); + FFFilterGraph *const ret = av_mallocz(sizeof(*ret)); if (!ret) return NULL; - ret->internal = av_mallocz(sizeof(*ret->internal)); - if (!ret->internal) { - av_freep(&ret); - return NULL; - } + ret->pub.av_class = &filtergraph_class; + av_opt_set_defaults(&ret->pub); + ff_framequeue_global_init(&ret->frame_queues); - ret->av_class = &filtergraph_class; - av_opt_set_defaults(ret); - ff_framequeue_global_init(&ret->internal->frame_queues); - - return ret; + return &ret->pub; } void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter) @@ -132,7 +126,6 @@ void avfilter_graph_free(AVFilterGraph **graph) av_freep(&(*graph)->scale_sws_opts); av_freep(&(*graph)->aresample_swr_opts); av_freep(&(*graph)->filters); - av_freep(&(*graph)->internal); av_freep(graph); } @@ -170,9 +163,9 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, { AVFilterContext **filters, *s; - if (graph->thread_type && !graph->internal->thread_execute) { + if (graph->thread_type && !filtergraph(graph)->thread_execute) { if (graph->execute) { - graph->internal->thread_execute = graph->execute; + filtergraph(graph)->thread_execute = graph->execute; } else { int ret = ff_graph_thread_init(graph); if (ret < 0) { diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 6c908690b4..2d1dab5788 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -122,11 +122,17 @@ struct AVFilterPad { int needs_writable; }; -struct AVFilterGraphInternal { +typedef struct FFFilterGraph { + AVFilterGraph pub; void *thread; avfilter_execute_func *thread_execute; FFFrameQueueGlobal frame_queues; -}; +} FFFilterGraph; + +static av_always_inline FFFilterGraph *filtergraph(AVFilterGraph *graph) +{ + return (FFFilterGraph*)graph; +} struct AVFilterInternal { avfilter_execute_func *execute; diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c index 34fc699505..0b8e98f60e 100644 --- a/libavfilter/pthread.c +++ b/libavfilter/pthread.c @@ -59,7 +59,7 @@ static void slice_thread_uninit(ThreadContext *c) static int thread_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { - ThreadContext *c = ctx->graph->internal->thread; + ThreadContext *const c = filtergraph(ctx->graph)->thread; if (nb_jobs <= 0) return 0; @@ -82,6 +82,7 @@ static int thread_init_internal(ThreadContext *c, int nb_threads) int ff_graph_thread_init(AVFilterGraph *graph) { + FFFilterGraph *const internal = filtergraph(graph); int ret; if (graph->nb_threads == 1) { @@ -89,27 +90,28 @@ int ff_graph_thread_init(AVFilterGraph *graph) return 0; } - graph->internal->thread = av_mallocz(sizeof(ThreadContext)); - if (!graph->internal->thread) + internal->thread = av_mallocz(sizeof(ThreadContext)); + if (!internal->thread) return AVERROR(ENOMEM); - ret = thread_init_internal(graph->internal->thread, graph->nb_threads); + ret = thread_init_internal(internal->thread, graph->nb_threads); if (ret <= 1) { - av_freep(&graph->internal->thread); + av_freep(&internal->thread); graph->thread_type = 0; graph->nb_threads = 1; return (ret < 0) ? ret : 0; } graph->nb_threads = ret; - graph->internal->thread_execute = thread_execute; + internal->thread_execute = thread_execute; return 0; } void ff_graph_thread_free(AVFilterGraph *graph) { - if (graph->internal->thread) - slice_thread_uninit(graph->internal->thread); - av_freep(&graph->internal->thread); + FFFilterGraph *const internal = filtergraph(graph); + if (internal->thread) + slice_thread_uninit(internal->thread); + av_freep(&internal->thread); } From patchwork Wed Aug 11 01:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29466 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:b707:0:0:0:0:0 with SMTP id t7csp4224148ybj; Tue, 10 Aug 2021 18:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyUApNT6biDzpvcL2OeLB9AtH1nojYkkWbbx0iyE8D6NE6zaXAJk0lq1ThTtWWRn1LZElF X-Received: by 2002:a17:906:d52:: with SMTP id r18mr1191986ejh.47.1628644760815; Tue, 10 Aug 2021 18:19:20 -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 cw26si5309435edb.32.2021.08.10.18.19.20; Tue, 10 Aug 2021 18:19:20 -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=Av+8IetX; 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 6479F68A477; Wed, 11 Aug 2021 04:18:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066053.outbound.protection.outlook.com [40.92.66.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8824668A3AF for ; Wed, 11 Aug 2021 04:18:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYLC2bOJdo+T094XKHkNwdLyAUxXzr8JIT3iFl8HB0QGtvWMtFejndDELsBA8YJlRL3ULBZPxlXH12gXCzSFj4K5xPfClzkMqQzk8ypoLUF3wAJv1U9fdHddZeFhemRHiiizdVdjnK7o24ikx+9hHWaZlUZ5xOR2rtxoz9qJRM9cXdkDwo8mHZ9DojslaKydxjYVZO/IUBxj33Z+F9WuekuaznIzLo7xbGunyYLIVW8dRoMuJffoh26dMIlBgBkQn9eNpvOVXU27ICFKMeZcjbEZ0WHt46hRhAABUzp/GVHdxYf3anCtKRXdE0uQnZ1walyNbnb/3q9O8azFu0UQpg== 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=QfTwTzX0AocC8PsfT5VKvYrBOCbfzYisM5xhDNpf/kU=; b=XJJDhzRasH5L2dgWek/BrDPrIu0sQMRrQ8rn43wsGfCYJ2TdGaZPIxJbQv+srJJSff5le1IbMC4jt7x/dgkROObvS4CDshNBt4KS1/GDWIz8yI0hzJiu/tFQH8PaT1upDx9O94xPeH8YTaOQUvlmdPGwGMi26fEkX205SNeTytZQh3TPeX8C4ED78SLOG1LtEWIMbliLTw3Fy0orqfYwZGlH4uVwWnsHNeBlN+IB9p9M008ovVUJY1QlA0+ga2g++9C9AQ2t4jH7QFSM6ftspDvl5OPD96i33PwcZ9orDo8uEgdk3nbzj0t2Nu/PuGkB3ZvDNPmfbZI6CXHNstSt8A== 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=QfTwTzX0AocC8PsfT5VKvYrBOCbfzYisM5xhDNpf/kU=; b=Av+8IetXusrkCProuQUPyjSA7uHuqkJw5TMdC8gpyiL3YpD+hV2TGjm7Ygg/FjN9wEsmqEy1RCq21165tz/WROtfoBsOiymOSL3wgbC4HUXotASqExTgfFU2DBEnvSFvf5byKe6/loaB0YFeNGItHFq/f0mYdXF3gmAjpSiWdjPAM3N5n6aHA4x4KOgdm8Uxy3U1MPD8FkcbMLgfv+IGLpTSFzAbX4y3BDhm6rrt6s5RH6QTXmkORZ0YX5Ub1RJlFMYHaLRadfvGkivDHvyshQE6zMosO2st+oD90FNjEnQjJE95c/jNxhYooERugDDUJz7JphT0eIRQ8yHrAv1y6w== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4613.eurprd03.prod.outlook.com (2603:10a6:20b:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 01:18:30 +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.4394.023; Wed, 11 Aug 2021 01:18:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:50 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [M3lP0ElVA+T5rqzlGVoYbvwji6S48PMi] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 924a44a7-90f2-4802-525c-08d95c65e81e X-MS-Exchange-SLBlob-MailProps: GjjEsbJCp86fDEzVeffD4qW5mJQCJQJCSZM7fV1aN2V9jib/jCh9YEPaJR069J9t70N5QuZ8+XcHbaiP2QV+b30mGdyDmPglrJFcS2e3RBynIVkT+puDCcUWvaVW/WOZQ8bU+X+1XzgZFaMfTdqwIEgXIwUAl0lz6h1D2LgsxcroUcp4O7u9OwKqgiCQ/EsXrM7gc6N2L+OpbqBnKfAIiJGQe9qB2VJsWgJNfYWIVZH3kIDXVXXtdDuWWgKS3H/vMbcpmaxkaVtq+aGMxsdJA5qB1IeK6r1q3K+SzJfBiueBypRxPbGPeaJsJIzvvR/3BUSU/9M3o5rt3Djicf0SVmYdoEuSD1c+WL59sDw4Faq0QhRItgLNVD6KYRg2BMSZwaiRA20QHdoiICmoFY+5C5VNKHKDIr+qVygzoTbzLhnYWnqhesKtOgEGshtJBVhsfVaNaqka/mf8FTbuhu1V0ELhFm79Vgi+CnvUrPlpA29tQKdjbNlHtPpRNd8dUyMMSHZj5VCRCa/ACwzAu5fuuvbnhneZ2gUDepQ3GYbnGU5wzKcklLbruG7wXwksf1modlqIUrGB6MkFNgxKMWu66rDOEr/zyIJAkH/3c7xpb5YAj0g+u5W6mIeW3YRwK8f1LPUwAjatYOzsN4eVXZIAXX0MSgtROYrnCFRpiGbQL+tXEqa3chb7FGNyB0Otx/GwJoVQh2gg7iN61wClDVYqswWgbgqUva1poiXsziEoU9oCBkHXAxHmd1Ia305DOMm9trfb0NmYub9MDNB6L0U817yZmP4cix9gFLAP9980n+DrgxQy46QfU5VyveyHelS5BqruTcfvxmCbZZDxP9qcO4y0VucZPkvj5LZ1vb65UJRR2B+B/RnnMA== X-MS-TrafficTypeDiagnostic: AM6PR03MB4613: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHG+s9st0NVx8kO/64DmMKfFTO2vZefTVZCQivt/qQNWuCDeHzJfZsn16IwM2cvupn+Mi3ZcOr7mOE1C0ts5g2FLoc3M1FNkP29QAPnFXaZBZWB7FevCnap9TfB1ygw7g23ux0JkOpBSvtrgnza7XoQ6HNHBDNDrLPr1w8z5IURdrvpN5dGhxL19jNQ3LH6ms5v49BtPt6s2iPjKlzy5hBH+zFBMJNcYo1plsUyGIxEmkNCVcIS++IzBb8sFmEMvGW//GJILmF5niYmICk8LX3belnSlgnDjxKPSdat8rCIVRlgsibcKLf7aLhbXM1cdaEwYpiYFF8BAj2XtZ549am6+KvKNgJ4o2aI9FcS3mequjXfW/ZLe9ZF4IX5H2fgINnAhF+NEj49lK+hfYA17fPxWtalWkJIpZ7iXTcR089/CU6KG6IvlnydAdWsFb5iQ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ps2vI8N/rpu0MfULGudL+9/IweV8pu5JYrFM2pBC7b6pLiwnqKq/ae2toBUXj6+9P6/Dj4rdRpgTXiJ6W8x/QD2a/GnOM8tWO2CVAz0K2mKGaZLTf+SNWXguhX6fcXuizbfe4MIkDERc6mziDjFX/g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 924a44a7-90f2-4802-525c-08d95c65e81e X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:21.0088 (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: AM6PR03MB4613 Subject: [FFmpeg-devel] [PATCH 07/10] avfilter/internal: Factor out executing a filter's execute_func 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: 20uCDWrP16HT Content-Length: 97132 The current way of doing it involves writing the ctx parameter twice. Signed-off-by: Andreas Rheinhardt --- libavfilter/af_acrossover.c | 2 +- libavfilter/af_adeclick.c | 2 +- libavfilter/af_adenorm.c | 2 +- libavfilter/af_aemphasis.c | 2 +- libavfilter/af_afftdn.c | 2 +- libavfilter/af_afir.c | 2 +- libavfilter/af_afreqshift.c | 2 +- libavfilter/af_afwtdn.c | 2 +- libavfilter/af_aiir.c | 2 +- libavfilter/af_anequalizer.c | 2 +- libavfilter/af_anlmdn.c | 2 +- libavfilter/af_anlms.c | 2 +- libavfilter/af_arnndn.c | 2 +- libavfilter/af_asoftclip.c | 4 ++-- libavfilter/af_astats.c | 2 +- libavfilter/af_asubboost.c | 2 +- libavfilter/af_asupercut.c | 2 +- libavfilter/af_biquads.c | 2 +- libavfilter/af_crystalizer.c | 2 +- libavfilter/af_headphone.c | 4 ++-- libavfilter/af_sofalizer.c | 4 ++-- libavfilter/af_surround.c | 4 ++-- libavfilter/avf_showspatial.c | 2 +- libavfilter/avf_showspectrum.c | 10 +++++----- libavfilter/internal.h | 6 ++++++ libavfilter/vf_amplify.c | 2 +- libavfilter/vf_atadenoise.c | 2 +- libavfilter/vf_avgblur.c | 4 ++-- libavfilter/vf_blackdetect.c | 2 +- libavfilter/vf_blend.c | 2 +- libavfilter/vf_bm3d.c | 2 +- libavfilter/vf_bwdif.c | 2 +- libavfilter/vf_cas.c | 2 +- libavfilter/vf_chromakey.c | 2 +- libavfilter/vf_chromanr.c | 2 +- libavfilter/vf_chromashift.c | 2 +- libavfilter/vf_colorbalance.c | 2 +- libavfilter/vf_colorchannelmixer.c | 2 +- libavfilter/vf_colorconstancy.c | 8 ++++---- libavfilter/vf_colorcontrast.c | 2 +- libavfilter/vf_colorcorrect.c | 2 +- libavfilter/vf_colorize.c | 2 +- libavfilter/vf_colorkey.c | 2 +- libavfilter/vf_colorlevels.c | 2 +- libavfilter/vf_colormatrix.c | 8 ++++---- libavfilter/vf_colorspace.c | 2 +- libavfilter/vf_colortemperature.c | 2 +- libavfilter/vf_convolution.c | 2 +- libavfilter/vf_convolve.c | 14 +++++++------- libavfilter/vf_curves.c | 2 +- libavfilter/vf_datascope.c | 2 +- libavfilter/vf_dctdnoiz.c | 2 +- libavfilter/vf_deband.c | 2 +- libavfilter/vf_dedot.c | 6 +++--- libavfilter/vf_despill.c | 2 +- libavfilter/vf_epx.c | 2 +- libavfilter/vf_estdif.c | 2 +- libavfilter/vf_exposure.c | 2 +- libavfilter/vf_fade.c | 8 ++++---- libavfilter/vf_framerate.c | 2 +- libavfilter/vf_gblur.c | 6 +++--- libavfilter/vf_geq.c | 2 +- libavfilter/vf_guided.c | 12 ++++++------ libavfilter/vf_hflip.c | 2 +- libavfilter/vf_hqdn3d.c | 2 +- libavfilter/vf_hqx.c | 2 +- libavfilter/vf_identity.c | 2 +- libavfilter/vf_lagfun.c | 2 +- libavfilter/vf_lenscorrection.c | 2 +- libavfilter/vf_lensfun.c | 4 ++-- libavfilter/vf_limiter.c | 2 +- libavfilter/vf_lumakey.c | 2 +- libavfilter/vf_lut.c | 8 ++++---- libavfilter/vf_lut2.c | 4 ++-- libavfilter/vf_lut3d.c | 4 ++-- libavfilter/vf_maskedclamp.c | 2 +- libavfilter/vf_maskedmerge.c | 2 +- libavfilter/vf_maskedminmax.c | 2 +- libavfilter/vf_maskedthreshold.c | 2 +- libavfilter/vf_maskfun.c | 2 +- libavfilter/vf_median.c | 2 +- libavfilter/vf_mix.c | 4 ++-- libavfilter/vf_monochrome.c | 4 ++-- libavfilter/vf_neighbor.c | 2 +- libavfilter/vf_nlmeans.c | 2 +- libavfilter/vf_nnedi.c | 2 +- libavfilter/vf_noise.c | 2 +- libavfilter/vf_overlay.c | 2 +- libavfilter/vf_perspective.c | 2 +- libavfilter/vf_photosensitivity.c | 4 ++-- libavfilter/vf_premultiply.c | 2 +- libavfilter/vf_pseudocolor.c | 2 +- libavfilter/vf_psnr.c | 2 +- libavfilter/vf_readeia608.c | 2 +- libavfilter/vf_remap.c | 2 +- libavfilter/vf_removegrain.c | 2 +- libavfilter/vf_rotate.c | 2 +- libavfilter/vf_scroll.c | 2 +- libavfilter/vf_selectivecolor.c | 2 +- libavfilter/vf_shear.c | 2 +- libavfilter/vf_shufflepixels.c | 2 +- libavfilter/vf_signalstats.c | 8 ++++---- libavfilter/vf_ssim.c | 2 +- libavfilter/vf_stack.c | 2 +- libavfilter/vf_stereo3d.c | 2 +- libavfilter/vf_super2xsai.c | 2 +- libavfilter/vf_threshold.c | 2 +- libavfilter/vf_tonemap.c | 2 +- libavfilter/vf_transpose.c | 2 +- libavfilter/vf_unsharp.c | 2 +- libavfilter/vf_v360.c | 4 ++-- libavfilter/vf_vibrance.c | 2 +- libavfilter/vf_vif.c | 14 +++++++------- libavfilter/vf_w3fdif.c | 2 +- libavfilter/vf_waveform.c | 2 +- libavfilter/vf_weave.c | 2 +- libavfilter/vf_xbr.c | 2 +- libavfilter/vf_xfade.c | 2 +- libavfilter/vf_xmedian.c | 4 ++-- libavfilter/vf_yadif.c | 2 +- libavfilter/vf_yaepblur.c | 6 +++--- libavfilter/vsrc_gradients.c | 2 +- libavfilter/vsrc_sierpinski.c | 2 +- 123 files changed, 183 insertions(+), 177 deletions(-) diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index 2e4cd367c7..f511a59b7f 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -517,7 +517,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) goto fail; s->input_frame = in; - ctx->internal->execute(ctx, s->filter_channels, NULL, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, s->filter_channels, NULL, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); for (i = 0; i < ctx->nb_outputs; i++) { diff --git a/libavfilter/af_adeclick.c b/libavfilter/af_adeclick.c index cda83bbb67..3b59c856ff 100644 --- a/libavfilter/af_adeclick.c +++ b/libavfilter/af_adeclick.c @@ -576,7 +576,7 @@ static int filter_frame(AVFilterLink *inlink) goto fail; td.out = out; - ret = ctx->internal->execute(ctx, filter_channel, &td, NULL, inlink->channels); + ret = ff_filter_execute(ctx, filter_channel, &td, NULL, inlink->channels); if (ret < 0) goto fail; diff --git a/libavfilter/af_adenorm.c b/libavfilter/af_adenorm.c index 5c604bcbd7..2dc87ddbbd 100644 --- a/libavfilter/af_adenorm.c +++ b/libavfilter/af_adenorm.c @@ -250,7 +250,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->level = exp(s->level_db / 20. * M_LN10); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); s->in_samples += in->nb_samples; diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c index 9fbf8bbb73..1be332218b 100644 --- a/libavfilter/af_aemphasis.c +++ b/libavfilter/af_aemphasis.c @@ -143,7 +143,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (in != out) diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index 38bd474c80..c595a0eddb 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -1224,7 +1224,7 @@ static int output_frame(AVFilterLink *inlink) s->block_count++; td.in = in; - ctx->internal->execute(ctx, filter_channel, &td, NULL, + ff_filter_execute(ctx, filter_channel, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); out = ff_get_audio_buffer(outlink, s->sample_advance); diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index e60bdc4f6f..3ff6c22284 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -225,7 +225,7 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink) if (s->pts == AV_NOPTS_VALUE) s->pts = in->pts; s->in = in; - ctx->internal->execute(ctx, fir_channels, out, NULL, FFMIN(outlink->channels, + ff_filter_execute(ctx, fir_channels, out, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); out->pts = s->pts; diff --git a/libavfilter/af_afreqshift.c b/libavfilter/af_afreqshift.c index c2fa2cedfc..59a8d787df 100644 --- a/libavfilter/af_afreqshift.c +++ b/libavfilter/af_afreqshift.c @@ -329,7 +329,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); s->in_samples += in->nb_samples; diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c index 6a25c98d7a..6d717536aa 100644 --- a/libavfilter/af_afwtdn.c +++ b/libavfilter/af_afwtdn.c @@ -1060,7 +1060,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_channel, &td, NULL, inlink->channels); + ff_filter_execute(ctx, s->filter_channel, &td, NULL, inlink->channels); if (s->need_profile) s->got_profile = 1; diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 7ff49aab4d..803a44698d 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -1401,7 +1401,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->iir_channel, &td, NULL, outlink->channels); + ff_filter_execute(ctx, s->iir_channel, &td, NULL, outlink->channels); for (ch = 0; ch < outlink->channels; ch++) { if (s->iir[ch].clippings > 0) diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c index faa0e2a230..041fffd4b4 100644 --- a/libavfilter/af_anequalizer.c +++ b/libavfilter/af_anequalizer.c @@ -730,7 +730,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) AVFilterLink *outlink = ctx->outputs[0]; if (!ctx->is_disabled) - ctx->internal->execute(ctx, filter_channels, buf, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, filter_channels, buf, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (s->draw_curves) { diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c index 0ed49bb630..f0c78ffcfe 100644 --- a/libavfilter/af_anlmdn.c +++ b/libavfilter/af_anlmdn.c @@ -309,7 +309,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (ret < 0) break; - ctx->internal->execute(ctx, filter_channel, out, NULL, inlink->channels); + ff_filter_execute(ctx, filter_channel, out, NULL, inlink->channels); av_audio_fifo_drain(s->fifo, s->H); diff --git a/libavfilter/af_anlms.c b/libavfilter/af_anlms.c index fb9c8cef4c..b3364eaafc 100644 --- a/libavfilter/af_anlms.c +++ b/libavfilter/af_anlms.c @@ -203,7 +203,7 @@ static int activate(AVFilterContext *ctx) return AVERROR(ENOMEM); } - ctx->internal->execute(ctx, process_channels, out, NULL, FFMIN(ctx->outputs[0]->channels, + ff_filter_execute(ctx, process_channels, out, NULL, FFMIN(ctx->outputs[0]->channels, ff_filter_get_nb_threads(ctx))); out->pts = s->frame[0]->pts; diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c index 0a227b35ac..15a3e531ea 100644 --- a/libavfilter/af_arnndn.c +++ b/libavfilter/af_arnndn.c @@ -1441,7 +1441,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->pts = in->pts; td.in = in; td.out = out; - ctx->internal->execute(ctx, rnnoise_channels, &td, NULL, FFMIN(outlink->channels, + ff_filter_execute(ctx, rnnoise_channels, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); diff --git a/libavfilter/af_asoftclip.c b/libavfilter/af_asoftclip.c index 44071d8dae..b4096c7e53 100644 --- a/libavfilter/af_asoftclip.c +++ b/libavfilter/af_asoftclip.c @@ -400,7 +400,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = s->frame; td.nb_samples = av_sample_fmt_is_planar(in->format) ? ret : ret * in->channels; td.channels = channels; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(channels, ff_filter_get_nb_threads(ctx))); ret = swr_convert(s->down_ctx, (uint8_t**)out->extended_data, out->nb_samples, @@ -419,7 +419,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.nb_samples = nb_samples; td.channels = channels; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(channels, ff_filter_get_nb_threads(ctx))); } diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 67e7aaf69f..a84e2f7bb1 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -632,7 +632,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) s->nb_frames++; } - ctx->internal->execute(ctx, filter_channel, buf, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channel, buf, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (s->metadata) set_metadata(s, metadata); diff --git a/libavfilter/af_asubboost.c b/libavfilter/af_asubboost.c index 4ec7cf64e0..9d3b3a035e 100644 --- a/libavfilter/af_asubboost.c +++ b/libavfilter/af_asubboost.c @@ -169,7 +169,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) diff --git a/libavfilter/af_asupercut.c b/libavfilter/af_asupercut.c index c6f5b0d1bd..d7b18df2cf 100644 --- a/libavfilter/af_asupercut.c +++ b/libavfilter/af_asupercut.c @@ -299,7 +299,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index 8ccdbf4fe2..184282b8c6 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -797,7 +797,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) td.in = buf; td.out = out_buf; - ctx->internal->execute(ctx, filter_channel, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channel, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); for (ch = 0; ch < outlink->channels; ch++) { if (s->cache[ch].clippings > 0) diff --git a/libavfilter/af_crystalizer.c b/libavfilter/af_crystalizer.c index 50c3c812a4..ec4fff1cb1 100644 --- a/libavfilter/af_crystalizer.c +++ b/libavfilter/af_crystalizer.c @@ -398,7 +398,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.channels = in->channels; td.mult = ctx->is_disabled ? 0.f : s->mult; td.clip = s->clip; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(inlink->channels, + ff_filter_execute(ctx, s->filter, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 1b7dd51d64..596049852e 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -341,9 +341,9 @@ static int headphone_frame(HeadphoneContext *s, AVFrame *in, AVFilterLink *outli td.temp_afft = s->temp_afft; if (s->type == TIME_DOMAIN) { - ctx->internal->execute(ctx, headphone_convolute, &td, NULL, 2); + ff_filter_execute(ctx, headphone_convolute, &td, NULL, 2); } else { - ctx->internal->execute(ctx, headphone_fast_convolute, &td, NULL, 2); + ff_filter_execute(ctx, headphone_fast_convolute, &td, NULL, 2); } emms_c(); diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index 0412bc5dda..9708aab634 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -604,9 +604,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.temp_afft = s->temp_afft; if (s->type == TIME_DOMAIN) { - ctx->internal->execute(ctx, sofalizer_convolute, &td, NULL, 2); + ff_filter_execute(ctx, sofalizer_convolute, &td, NULL, 2); } else if (s->type == FREQUENCY_DOMAIN) { - ctx->internal->execute(ctx, sofalizer_fast_convolute, &td, NULL, 2); + ff_filter_execute(ctx, sofalizer_fast_convolute, &td, NULL, 2); } emms_c(); diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index 8d6eebe2e5..d81908f5aa 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -1586,7 +1586,7 @@ static int filter_frame(AVFilterLink *inlink) if (ret < 0) return ret; - ctx->internal->execute(ctx, fft_channel, NULL, NULL, inlink->channels); + ff_filter_execute(ctx, fft_channel, NULL, NULL, inlink->channels); s->filter(ctx); @@ -1594,7 +1594,7 @@ static int filter_frame(AVFilterLink *inlink) if (!out) return AVERROR(ENOMEM); - ctx->internal->execute(ctx, ifft_channel, out, NULL, outlink->channels); + ff_filter_execute(ctx, ifft_channel, out, NULL, outlink->channels); out->pts = s->pts; if (s->pts != AV_NOPTS_VALUE) diff --git a/libavfilter/avf_showspatial.c b/libavfilter/avf_showspatial.c index 82d202a817..3e1d4bd70e 100644 --- a/libavfilter/avf_showspatial.c +++ b/libavfilter/avf_showspatial.c @@ -318,7 +318,7 @@ static int spatial_activate(AVFilterContext *ctx) av_assert0(fin->nb_samples == s->win_size); - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, 2); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, 2); ret = draw_spatial(inlink, fin); diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index 1c94a06e3f..9cecd3d299 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -1369,7 +1369,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) /* initialize buffer for combining to black */ clear_combine_buffer(s, z); - ctx->internal->execute(ctx, s->plot_channel, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, s->plot_channel, NULL, NULL, s->nb_display_channels); for (y = 0; y < z * 3; y++) { for (x = 0; x < s->nb_display_channels; x++) { @@ -1543,13 +1543,13 @@ static int activate(AVFilterContext *ctx) av_assert0(fin->nb_samples == s->win_size); - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); if (s->data == D_MAGNITUDE) - ctx->internal->execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); if (s->data == D_PHASE) - ctx->internal->execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); ret = plot_spectrum_column(inlink, fin); @@ -1746,7 +1746,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) } } - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); acalc_magnitudes(s); consumed += spf; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 2d1dab5788..48a911f082 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -138,6 +138,12 @@ struct AVFilterInternal { avfilter_execute_func *execute; }; +static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, + void *arg, int *ret, int nb_jobs) +{ + return ctx->internal->execute(ctx, func, arg, ret, nb_jobs); +} + /** * Tell if an integer is contained in the provided -1-terminated list of integers. * This is useful for determining (for instance) if an AVPixelFormat is in an diff --git a/libavfilter/vf_amplify.c b/libavfilter/vf_amplify.c index 2640b61be8..49f62bc306 100644 --- a/libavfilter/vf_amplify.c +++ b/libavfilter/vf_amplify.c @@ -264,7 +264,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, amplify_frame, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, amplify_frame, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); } else { out = av_frame_clone(s->frames[s->radius]); if (!out) diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c index ad99c7a797..e39670d982 100644 --- a/libavfilter/vf_atadenoise.c +++ b/libavfilter/vf_atadenoise.c @@ -488,7 +488,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) } td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, + ff_filter_execute(ctx, s->filter_slice, &td, NULL, FFMIN3(s->planeheight[1], s->planeheight[2], ff_filter_get_nb_threads(ctx))); diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c index f6d36abb50..cbfcb13136 100644 --- a/libavfilter/vf_avgblur.c +++ b/libavfilter/vf_avgblur.c @@ -216,10 +216,10 @@ static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int pl td.height = height; td.ptr = in->data[plane]; td.linesize = in->linesize[plane]; - ctx->internal->execute(ctx, s->filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, s->filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); td.ptr = out->data[plane]; td.linesize = out->linesize[plane]; - ctx->internal->execute(ctx, s->filter_vertically, &td, NULL, FFMIN(width, nb_threads)); + ff_filter_execute(ctx, s->filter_vertically, &td, NULL, FFMIN(width, nb_threads)); } static int query_formats(AVFilterContext *ctx) diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index e7fa5ce3ab..6d24682ef0 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -188,7 +188,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) BlackDetectContext *s = ctx->priv; double picture_black_ratio = 0; - ctx->internal->execute(ctx, black_counter, picref, NULL, + ff_filter_execute(ctx, black_counter, picref, NULL, FFMIN(inlink->h, s->nb_threads)); for (int i = 0; i < s->nb_threads; i++) diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 5eed52a5d8..80ff23f1fd 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -624,7 +624,7 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf, .w = outw, .h = outh, .param = param, .plane = plane, .inlink = inlink }; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); } if (!s->tblend) diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index 96bf8b671a..49a52ecc18 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -763,7 +763,7 @@ static int filter_frame(AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFram td.ref = ref->data[p]; td.ref_linesize = ref->linesize[p]; td.plane = p; - ctx->internal->execute(ctx, filter_slice, &td, NULL, nb_jobs); + ff_filter_execute(ctx, filter_slice, &td, NULL, nb_jobs); s->do_output(s, (*out)->data[p], (*out)->linesize[p], p, nb_jobs); } diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index d63976b70b..a676bba7f5 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -279,7 +279,7 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, td.h = h; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); } if (yadif->current_field == YADIF_FIELD_END) { yadif->current_field = YADIF_FIELD_NORMAL; diff --git a/libavfilter/vf_cas.c b/libavfilter/vf_cas.c index 4378ccd5eb..00c77b0fcb 100644 --- a/libavfilter/vf_cas.c +++ b/libavfilter/vf_cas.c @@ -193,7 +193,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); s->in = in; - ctx->internal->execute(ctx, s->do_slice, out, NULL, + ff_filter_execute(ctx, s->do_slice, out, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); s->in = NULL; diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c index 61a1ab53f9..a21a136b33 100644 --- a/libavfilter/vf_chromakey.c +++ b/libavfilter/vf_chromakey.c @@ -260,7 +260,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ChromakeyContext *ctx = avctx->priv; int res; - if (res = avctx->internal->execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + if (res = ff_filter_execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; return ff_filter_frame(avctx->outputs[0], frame); diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 006d6410b7..227eb698bb 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -208,7 +208,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); s->out = out; - ctx->internal->execute(ctx, s->filter_slice, in, NULL, + ff_filter_execute(ctx, s->filter_slice, in, NULL, FFMIN3(s->planeheight[1], s->planeheight[2], ff_filter_get_nb_threads(ctx))); diff --git a/libavfilter/vf_chromashift.c b/libavfilter/vf_chromashift.c index 8079196862..42ea697b6b 100644 --- a/libavfilter/vf_chromashift.c +++ b/libavfilter/vf_chromashift.c @@ -359,7 +359,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) in->data[0], in->linesize[0], s->linesize[0], s->height[0]); } - ctx->internal->execute(ctx, s->filter_slice, out, NULL, + ff_filter_execute(ctx, s->filter_slice, out, NULL, FFMIN3(s->height[1], s->height[2], ff_filter_get_nb_threads(ctx))); diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index 1da1a643eb..51278cf949 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -411,7 +411,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->color_balance, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->color_balance, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); diff --git a/libavfilter/vf_colorchannelmixer.c b/libavfilter/vf_colorchannelmixer.c index e259fa3028..66b761db87 100644 --- a/libavfilter/vf_colorchannelmixer.c +++ b/libavfilter/vf_colorchannelmixer.c @@ -753,7 +753,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_slice[pl], &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice[pl], &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c index 0cef043bcd..8ba84a7f7d 100644 --- a/libavfilter/vf_colorconstancy.c +++ b/libavfilter/vf_colorconstancy.c @@ -366,7 +366,7 @@ get_deriv(AVFilterContext *ctx, ThreadData *td, int ord, int dir, td->meta_data[INDEX_DIR] = dir; td->meta_data[INDEX_SRC] = src; td->meta_data[INDEX_DST] = dst; - ctx->internal->execute(ctx, slice_get_derivative, td, NULL, FFMIN(dim, nb_threads)); + ff_filter_execute(ctx, slice_get_derivative, td, NULL, FFMIN(dim, nb_threads)); } /** @@ -500,10 +500,10 @@ static int filter_grey_edge(AVFilterContext *ctx, AVFrame *in) } get_derivative(ctx, &td); if (difford > 0) { - ctx->internal->execute(ctx, slice_normalize, &td, NULL, nb_jobs); + ff_filter_execute(ctx, slice_normalize, &td, NULL, nb_jobs); } - ctx->internal->execute(ctx, filter_slice_grey_edge, &td, NULL, nb_jobs); + ff_filter_execute(ctx, filter_slice_grey_edge, &td, NULL, nb_jobs); if (!minknorm) { for (plane = 0; plane < NUM_PLANES; ++plane) { white[plane] = 0; // All values are absolute @@ -631,7 +631,7 @@ static void chromatic_adaptation(AVFilterContext *ctx, AVFrame *in, AVFrame *out td.in = in; td.out = out; - ctx->internal->execute(ctx, diagonal_transformation, &td, NULL, nb_jobs); + ff_filter_execute(ctx, diagonal_transformation, &td, NULL, nb_jobs); } static int query_formats(AVFilterContext *ctx) diff --git a/libavfilter/vf_colorcontrast.c b/libavfilter/vf_colorcontrast.c index 8aae031745..003287f8d6 100644 --- a/libavfilter/vf_colorcontrast.c +++ b/libavfilter/vf_colorcontrast.c @@ -303,7 +303,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ColorContrastContext *s = ctx->priv; int res; - if (res = ctx->internal->execute(ctx, s->do_slice, frame, NULL, + if (res = ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return res; diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c index d4567d2a30..135813ec83 100644 --- a/libavfilter/vf_colorcorrect.c +++ b/libavfilter/vf_colorcorrect.c @@ -135,7 +135,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFilterContext *ctx = inlink->dst; ColorCorrectContext *s = ctx->priv; - ctx->internal->execute(ctx, s->do_slice, frame, NULL, + ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_colorize.c b/libavfilter/vf_colorize.c index 1dc99681ce..776a4add9c 100644 --- a/libavfilter/vf_colorize.c +++ b/libavfilter/vf_colorize.c @@ -203,7 +203,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) hsl2rgb(s->hue, s->saturation, s->lightness, &c[0], &c[1], &c[2]); rgb2yuv(c[0], c[1], c[2], &s->c[0], &s->c[1], &s->c[2], s->depth); - ctx->internal->execute(ctx, do_slice, frame, NULL, + ff_filter_execute(ctx, do_slice, frame, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c index 93e69b712c..779094d72d 100644 --- a/libavfilter/vf_colorkey.c +++ b/libavfilter/vf_colorkey.c @@ -138,7 +138,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) if (res = av_frame_make_writable(frame)) return res; - if (res = avctx->internal->execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + if (res = ff_filter_execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; return ff_filter_frame(avctx->outputs[0], frame); diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c index b17bb9f11f..d54f6510c8 100644 --- a/libavfilter/vf_colorlevels.c +++ b/libavfilter/vf_colorlevels.c @@ -286,7 +286,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) break; } - ctx->internal->execute(ctx, s->colorlevels_slice, &td, NULL, + ff_filter_execute(ctx, s->colorlevels_slice, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index 0686ca068b..c16169f324 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -470,16 +470,16 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) td.c7 = color->yuv_convert[color->mode][2][2]; if (in->format == AV_PIX_FMT_YUV444P) - ctx->internal->execute(ctx, process_slice_yuv444p, &td, NULL, + ff_filter_execute(ctx, process_slice_yuv444p, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); else if (in->format == AV_PIX_FMT_YUV422P) - ctx->internal->execute(ctx, process_slice_yuv422p, &td, NULL, + ff_filter_execute(ctx, process_slice_yuv422p, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); else if (in->format == AV_PIX_FMT_YUV420P) - ctx->internal->execute(ctx, process_slice_yuv420p, &td, NULL, + ff_filter_execute(ctx, process_slice_yuv420p, &td, NULL, FFMIN(in->height / 2, ff_filter_get_nb_threads(ctx))); else - ctx->internal->execute(ctx, process_slice_uyvy422, &td, NULL, + ff_filter_execute(ctx, process_slice_uyvy422, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index 65e072d137..5053f6495e 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -873,7 +873,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) return res; } } else { - ctx->internal->execute(ctx, convert, &td, NULL, + ff_filter_execute(ctx, convert, &td, NULL, FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx))); } av_frame_free(&in); diff --git a/libavfilter/vf_colortemperature.c b/libavfilter/vf_colortemperature.c index ad288e3b84..c8c2bc7087 100644 --- a/libavfilter/vf_colortemperature.c +++ b/libavfilter/vf_colortemperature.c @@ -270,7 +270,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) kelvin2rgb(s->temperature, s->color); - ctx->internal->execute(ctx, s->do_slice, frame, NULL, + ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c index db92f5aa0b..e889f51fee 100644 --- a/libavfilter/vf_convolution.c +++ b/libavfilter/vf_convolution.c @@ -736,7 +736,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN3(s->planeheight[1], s->planewidth[1], s->nb_threads)); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN3(s->planeheight[1], s->planewidth[1], s->nb_threads)); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_convolve.c b/libavfilter/vf_convolve.c index fd0f3ca404..489ed91369 100644 --- a/libavfilter/vf_convolve.c +++ b/libavfilter/vf_convolve.c @@ -472,8 +472,8 @@ static int do_convolve(FFFrameSync *fs) td.hdata = s->fft_hdata[plane]; td.vdata = s->fft_vdata[plane]; - ctx->internal->execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); if ((!s->impulse && !s->got_impulse[plane]) || s->impulse) { if (s->depth == 8) { @@ -498,8 +498,8 @@ static int do_convolve(FFFrameSync *fs) td.hdata = s->fft_hdata_impulse[plane]; td.vdata = s->fft_vdata_impulse[plane]; - ctx->internal->execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); s->got_impulse[plane] = 1; } @@ -507,13 +507,13 @@ static int do_convolve(FFFrameSync *fs) td.hdata = input; td.vdata = filter; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); td.hdata = s->fft_hdata[plane]; td.vdata = s->fft_vdata[plane]; - ctx->internal->execute(ctx, ifft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, ifft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, ifft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, ifft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); get_output(s, s->fft_hdata[plane], mainpic, w, h, n, plane, 1.f / (n * n)); } diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 457fd77184..d5d718f7f4 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -739,7 +739,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, curves->filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, curves->filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c index 63c93fd98d..f3c06286e7 100644 --- a/libavfilter/vf_datascope.c +++ b/libavfilter/vf_datascope.c @@ -370,7 +370,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out, td.yoff = xmaxlen, td.xoff = ymaxlen, td.PP = PP; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); + ff_filter_execute(ctx, s->filter, &td, NULL, FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c index 8c0691c07f..d1bb7bf96b 100644 --- a/libavfilter/vf_dctdnoiz.c +++ b/libavfilter/vf_dctdnoiz.c @@ -745,7 +745,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .src = s->cbuf[0][plane], .dst = s->cbuf[1][plane], }; - ctx->internal->execute(ctx, filter_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, filter_slice, &td, NULL, s->nb_threads); } s->color_correlation(out->data, out->linesize[0], s->cbuf[1], s->p_linesize, diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c index 767f1c7687..8a9b63be39 100644 --- a/libavfilter/vf_deband.c +++ b/libavfilter/vf_deband.c @@ -422,7 +422,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, s->deband, &td, NULL, FFMIN3(s->planeheight[1], + ff_filter_execute(ctx, s->deband, &td, NULL, FFMIN3(s->planeheight[1], s->planeheight[2], ff_filter_get_nb_threads(ctx))); diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c index 8660eb08b4..050b2368c7 100644 --- a/libavfilter/vf_dedot.c +++ b/libavfilter/vf_dedot.c @@ -296,17 +296,17 @@ static int activate(AVFilterContext *ctx) ret = av_frame_make_writable(out); if (ret >= 0) { if (s->m & 1) - ctx->internal->execute(ctx, s->dedotcrawl, out, NULL, + ff_filter_execute(ctx, s->dedotcrawl, out, NULL, FFMIN(s->planeheight[0], ff_filter_get_nb_threads(ctx))); if (s->m & 2) { ThreadData td; td.out = out; td.plane = 1; - ctx->internal->execute(ctx, s->derainbow, &td, NULL, + ff_filter_execute(ctx, s->derainbow, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); td.plane = 2; - ctx->internal->execute(ctx, s->derainbow, &td, NULL, + ff_filter_execute(ctx, s->derainbow, &td, NULL, FFMIN(s->planeheight[2], ff_filter_get_nb_threads(ctx))); } diff --git a/libavfilter/vf_despill.c b/libavfilter/vf_despill.c index 315104638b..307879fa26 100644 --- a/libavfilter/vf_despill.c +++ b/libavfilter/vf_despill.c @@ -97,7 +97,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) if (ret = av_frame_make_writable(frame)) return ret; - if (ret = ctx->internal->execute(ctx, do_despill_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) + if (ret = ff_filter_execute(ctx, do_despill_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return ret; return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_epx.c b/libavfilter/vf_epx.c index f33be65095..53416cad30 100644 --- a/libavfilter/vf_epx.c +++ b/libavfilter/vf_epx.c @@ -247,7 +247,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in, td.out = out; - ctx->internal->execute(ctx, s->epx_slice, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->epx_slice, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_estdif.c b/libavfilter/vf_estdif.c index 92b1c77806..6b65f62df4 100644 --- a/libavfilter/vf_estdif.c +++ b/libavfilter/vf_estdif.c @@ -441,7 +441,7 @@ static int filter(AVFilterContext *ctx, int is_second, AVFrame *in) out->pts = s->pts; td.out = out; td.in = in; - ctx->internal->execute(ctx, deinterlace_slice, &td, NULL, + ff_filter_execute(ctx, deinterlace_slice, &td, NULL, FFMIN(s->planeheight[1] / 2, s->nb_threads)); if (s->mode) diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c index 135a9a0e03..42297c1a02 100644 --- a/libavfilter/vf_exposure.c +++ b/libavfilter/vf_exposure.c @@ -69,7 +69,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) ExposureContext *s = ctx->priv; s->scale = 1.f / (exp2f(-s->exposure) - s->black); - ctx->internal->execute(ctx, s->do_slice, frame, NULL, + ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index 05ab762ec8..e1259f8fbe 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -493,19 +493,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) if (s->factor < UINT16_MAX) { if (s->alpha) { - ctx->internal->execute(ctx, s->filter_slice_alpha, frame, NULL, + ff_filter_execute(ctx, s->filter_slice_alpha, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_rgb && !s->black_fade) { - ctx->internal->execute(ctx, filter_slice_rgb, frame, NULL, + ff_filter_execute(ctx, filter_slice_rgb, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } else { /* luma, or rgb plane in case of black */ - ctx->internal->execute(ctx, s->filter_slice_luma, frame, NULL, + ff_filter_execute(ctx, s->filter_slice_luma, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); if (frame->data[1] && frame->data[2] && !s->is_rgb) { /* chroma planes */ - ctx->internal->execute(ctx, s->filter_slice_chroma, frame, NULL, + ff_filter_execute(ctx, s->filter_slice_chroma, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } } diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index e8f6b5b8c5..ab69e4034a 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -146,7 +146,7 @@ static int blend_frames(AVFilterContext *ctx, int interpolate) av_frame_copy_props(s->work, s->f0); ff_dlog(ctx, "blend_frames() INTERPOLATE to create work frame\n"); - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx))); return 1; } return 0; diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index 1def5b049b..8d347695e0 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -196,9 +196,9 @@ static void gaussianiir2d(AVFilterContext *ctx, int plane) td.width = width; td.height = height; - ctx->internal->execute(ctx, filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); - ctx->internal->execute(ctx, filter_vertically, &td, NULL, FFMIN(width, nb_threads)); - ctx->internal->execute(ctx, filter_postscale, &td, NULL, FFMIN(width * height, nb_threads)); + ff_filter_execute(ctx, filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, filter_vertically, &td, NULL, FFMIN(width, nb_threads)); + ff_filter_execute(ctx, filter_postscale, &td, NULL, FFMIN(width * height, nb_threads)); } static int query_formats(AVFilterContext *ctx) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index 4162476f41..97fea280c3 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -449,7 +449,7 @@ static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in) if (geq->needs_sum[plane]) calculate_sums(geq, plane, width, height); - ctx->internal->execute(ctx, slice_geq_filter, &td, NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, slice_geq_filter, &td, NULL, FFMIN(height, nb_threads)); } av_frame_free(&geq->picref); diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 83976cbcae..3dcba39759 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -250,16 +250,16 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s, t.dstStride = w; \ t.src = I; \ t.dst = meanI; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = II; \ t.dst = meanII; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = P; \ t.dst = meanP; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = IP; \ t.dst = meanIP; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ \ for (int i = 0;i < h;i++) { \ for (int j = 0;j < w;j++) { \ @@ -273,10 +273,10 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s, \ t.src = A; \ t.dst = meanA; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = B; \ t.dst = meanB; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ \ for (int i = 0;i < height;i++) { \ for (int j = 0;j < width;j++) { \ diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 2a0defda6c..7d35eb1d6f 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -221,7 +221,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) memcpy(out->data[1], in->data[1], AVPALETTE_SIZE); td.in = in, td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index 99c43593cd..885ae02f74 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -337,7 +337,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.direct = direct; /* one thread per plane */ - ctx->internal->execute(ctx, do_denoise, &td, NULL, 3); + ff_filter_execute(ctx, do_denoise, &td, NULL, 3); if (ctx->is_disabled) { av_frame_free(&out); diff --git a/libavfilter/vf_hqx.c b/libavfilter/vf_hqx.c index b6c3893b66..301230e594 100644 --- a/libavfilter/vf_hqx.c +++ b/libavfilter/vf_hqx.c @@ -499,7 +499,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; td.rgbtoyuv = hqx->rgbtoyuv; - ctx->internal->execute(ctx, hqx->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, hqx->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_identity.c b/libavfilter/vf_identity.c index f5dcdfc906..284541f215 100644 --- a/libavfilter/vf_identity.c +++ b/libavfilter/vf_identity.c @@ -196,7 +196,7 @@ static int do_identity(FFFrameSync *fs) td.planeheight[c] = s->planeheight[c]; } - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, s->filter_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); for (int j = 0; j < s->nb_threads; j++) { for (int c = 0; c < s->nb_components; c++) diff --git a/libavfilter/vf_lagfun.c b/libavfilter/vf_lagfun.c index 0f4f38e0ed..f57b3f39d5 100644 --- a/libavfilter/vf_lagfun.c +++ b/libavfilter/vf_lagfun.c @@ -173,7 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, s->lagfun, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lagfun, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c index 9d89f79101..209067d103 100644 --- a/libavfilter/vf_lenscorrection.c +++ b/libavfilter/vf_lenscorrection.c @@ -315,7 +315,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(rect->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(rect->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c index ffe81b9bc2..8b6b068fa6 100644 --- a/libavfilter/vf_lensfun.c +++ b/libavfilter/vf_lensfun.c @@ -461,7 +461,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .modifier = lensfun->modifier }; - ctx->internal->execute(ctx, + ff_filter_execute(ctx)(ctx, vignetting_filter_slice, &vignetting_thread_data, NULL, @@ -489,7 +489,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .interpolation_type = lensfun->interpolation_type }; - ctx->internal->execute(ctx, + ff_filter_execute(ctx)(ctx, distortion_correction_filter_slice, &distortion_correction_thread_data, NULL, diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c index 3bf1b371cf..d5921365e0 100644 --- a/libavfilter/vf_limiter.c +++ b/libavfilter/vf_limiter.c @@ -219,7 +219,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, filter_slice, &td, NULL, + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c index 8b2a102369..dcf5b84ad1 100644 --- a/libavfilter/vf_lumakey.c +++ b/libavfilter/vf_lumakey.c @@ -138,7 +138,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) if (ret = av_frame_make_writable(frame)) return ret; - if (ret = ctx->internal->execute(ctx, s->do_lumakey_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) + if (ret = ff_filter_execute(ctx, s->do_lumakey_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return ret; return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 78f0955446..c08c3bfaf8 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -538,22 +538,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (s->is_rgb && s->is_16bit && !s->is_planar) { /* packed, 16-bit */ PACKED_THREAD_DATA - ctx->internal->execute(ctx, lut_packed_16bits, &td, NULL, + ff_filter_execute(ctx, lut_packed_16bits, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_rgb && !s->is_planar) { /* packed 8 bits */ PACKED_THREAD_DATA - ctx->internal->execute(ctx, lut_packed_8bits, &td, NULL, + ff_filter_execute(ctx, lut_packed_8bits, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_16bit) { /* planar >8 bit depth */ PLANAR_THREAD_DATA - ctx->internal->execute(ctx, lut_planar_16bits, &td, NULL, + ff_filter_execute(ctx, lut_planar_16bits, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else { /* planar 8bit depth */ PLANAR_THREAD_DATA - ctx->internal->execute(ctx, lut_planar_8bits, &td, NULL, + ff_filter_execute(ctx, lut_planar_8bits, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c index 85669a2e2d..3ea782e5ba 100644 --- a/libavfilter/vf_lut2.c +++ b/libavfilter/vf_lut2.c @@ -316,7 +316,7 @@ static int process_frame(FFFrameSync *fs) td.out = out; td.srcx = srcx; td.srcy = srcy; - ctx->internal->execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -613,7 +613,7 @@ static int tlut2_filter_frame(AVFilterLink *inlink, AVFrame *frame) td.out = out; td.srcx = frame; td.srcy = s->prev_frame; - ctx->internal->execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); } av_frame_free(&s->prev_frame); s->prev_frame = frame; diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index b81ef46b48..48a5a75061 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -1231,7 +1231,7 @@ static AVFrame *apply_lut(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -2229,7 +2229,7 @@ static AVFrame *apply_1d_lut(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, lut1d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut1d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c index 2cd1ec88c7..cd62a819a0 100644 --- a/libavfilter/vf_maskedclamp.c +++ b/libavfilter/vf_maskedclamp.c @@ -159,7 +159,7 @@ static int process_frame(FFFrameSync *fs) td.m = bright; td.d = out; - ctx->internal->execute(ctx, maskedclamp_slice, &td, NULL, FFMIN(s->height[0], + ff_filter_execute(ctx, maskedclamp_slice, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c index 6a15a907c5..fd2b24c3d4 100644 --- a/libavfilter/vf_maskedmerge.c +++ b/libavfilter/vf_maskedmerge.c @@ -134,7 +134,7 @@ static int process_frame(FFFrameSync *fs) td.base = base; td.overlay = overlay; td.mask = mask; - ctx->internal->execute(ctx, filter_slice, &td, NULL, + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); diff --git a/libavfilter/vf_maskedminmax.c b/libavfilter/vf_maskedminmax.c index 6ad5ddb1de..d2e35dabe5 100644 --- a/libavfilter/vf_maskedminmax.c +++ b/libavfilter/vf_maskedminmax.c @@ -221,7 +221,7 @@ static int process_frame(FFFrameSync *fs) td.f2 = f2; td.dst = out; - ctx->internal->execute(ctx, maskedminmax_slice, &td, NULL, FFMIN(s->planeheight[0], + ff_filter_execute(ctx, maskedminmax_slice, &td, NULL, FFMIN(s->planeheight[0], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); diff --git a/libavfilter/vf_maskedthreshold.c b/libavfilter/vf_maskedthreshold.c index e80d383f9d..4f526fa5b5 100644 --- a/libavfilter/vf_maskedthreshold.c +++ b/libavfilter/vf_maskedthreshold.c @@ -191,7 +191,7 @@ static int process_frame(FFFrameSync *fs) td.ref = ref; td.dst = out; - ctx->internal->execute(ctx, threshold_slice, &td, NULL, FFMIN(s->planeheight[2], + ff_filter_execute(ctx, threshold_slice, &td, NULL, FFMIN(s->planeheight[2], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); diff --git a/libavfilter/vf_maskfun.c b/libavfilter/vf_maskfun.c index 70198c66bc..5ac6e367b7 100644 --- a/libavfilter/vf_maskfun.c +++ b/libavfilter/vf_maskfun.c @@ -105,7 +105,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(outlink, out); } - ctx->internal->execute(ctx, s->maskfun, frame, NULL, + ff_filter_execute(ctx, s->maskfun, frame, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, frame); diff --git a/libavfilter/vf_median.c b/libavfilter/vf_median.c index e02629a5ca..9d92f1543b 100644 --- a/libavfilter/vf_median.c +++ b/libavfilter/vf_median.c @@ -230,7 +230,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, filter_slice, &td, NULL, s->nb_threads); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index 0ca60d5522..677ca1e8ba 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -226,7 +226,7 @@ static int process_frame(FFFrameSync *fs) td.in = in; td.out = out; - ctx->internal->execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } @@ -412,7 +412,7 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c index 870811d4d4..ea9248a807 100644 --- a/libavfilter/vf_monochrome.c +++ b/libavfilter/vf_monochrome.c @@ -214,9 +214,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFilterContext *ctx = inlink->dst; MonochromeContext *s = ctx->priv; - ctx->internal->execute(ctx, s->do_slice, frame, NULL, + ff_filter_execute(ctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, s->clear_uv, frame, NULL, + ff_filter_execute(ctx, s->clear_uv, frame, NULL, FFMIN(frame->height >> s->subh, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c index ea6449830c..31d2e11d48 100644 --- a/libavfilter/vf_neighbor.c +++ b/libavfilter/vf_neighbor.c @@ -328,7 +328,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 95cdad780e..e85df1a979 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -455,7 +455,7 @@ static int nlmeans_plane(AVFilterContext *ctx, int w, int h, int p, int r, compute_ssd_integral_image(&s->dsp, s->ii, s->ii_lz_32, src, src_linesize, offx, offy, e, w, h); - ctx->internal->execute(ctx, nlmeans_slice, &td, NULL, + ff_filter_execute(ctx, nlmeans_slice, &td, NULL, FFMIN(td.endy - td.starty, ff_filter_get_nb_threads(ctx))); } } diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index cffb23d37c..0805fcf2af 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -671,7 +671,7 @@ static int get_frame(AVFilterContext *ctx, int is_second) dst->interlaced_frame = 0; dst->pts = s->pts; - ctx->internal->execute(ctx, filter_slice, dst, NULL, FFMIN(s->planeheight[1] / 2, s->nb_threads)); + ff_filter_execute(ctx, filter_slice, dst, NULL, FFMIN(s->planeheight[1] / 2, s->nb_threads)); if (s->field == -2 || s->field > 1) s->field_n = !s->field_n; diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c index 73e88063e9..6f9bd2b716 100644 --- a/libavfilter/vf_noise.c +++ b/libavfilter/vf_noise.c @@ -272,7 +272,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) } td.in = inpicref; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ff_filter_get_nb_threads(ctx))); emms_c(); if (inpicref != out) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 8fec1f554c..cd421b8aa0 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -1029,7 +1029,7 @@ static int do_blend(FFFrameSync *fs) td.dst = mainpic; td.src = second; - ctx->internal->execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMAX(1, FFMIN3(s->y + second->height, FFMIN(second->height, mainpic->height), mainpic->height - s->y)), + ff_filter_execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMAX(1, FFMIN3(s->y + second->height, FFMIN(second->height, mainpic->height), mainpic->height - s->y)), ff_filter_get_nb_threads(ctx))); } return ff_filter_frame(ctx->outputs[0], mainpic); diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c index eb8e5e2414..55544d872f 100644 --- a/libavfilter/vf_perspective.c +++ b/libavfilter/vf_perspective.c @@ -476,7 +476,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) .h = s->height[plane], .hsub = hsub, .vsub = vsub }; - ctx->internal->execute(ctx, s->perspective, &td, NULL, FFMIN(td.h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->perspective, &td, NULL, FFMIN(td.h, ff_filter_get_nb_threads(ctx))); } av_frame_free(&frame); diff --git a/libavfilter/vf_photosensitivity.c b/libavfilter/vf_photosensitivity.c index c28d06b08a..fb343b0c79 100644 --- a/libavfilter/vf_photosensitivity.c +++ b/libavfilter/vf_photosensitivity.c @@ -143,7 +143,7 @@ static void convert_frame(AVFilterContext *ctx, AVFrame *in, PhotosensitivityFra td.in = in; td.out = out; td.skip = skip; - ctx->internal->execute(ctx, convert_frame_partial, &td, NULL, FFMIN(NUM_CELLS, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, convert_frame_partial, &td, NULL, FFMIN(NUM_CELLS, ff_filter_get_nb_threads(ctx))); } typedef struct ThreadData_blend_frame @@ -182,7 +182,7 @@ static void blend_frame(AVFilterContext *ctx, AVFrame *target, AVFrame *source, td.target = target; td.source = source; td.s_mul = (uint16_t)(factor * 0x100); - ctx->internal->execute(ctx, blend_frame_partial, &td, NULL, FFMIN(ctx->outputs[0]->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, blend_frame_partial, &td, NULL, FFMIN(ctx->outputs[0]->h, ff_filter_get_nb_threads(ctx))); } static int get_badness(PhotosensitivityFrame *a, PhotosensitivityFrame *b) diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index 1dde273eae..305a6d67fa 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -635,7 +635,7 @@ static int filter_frame(AVFilterContext *ctx, td.d = *out; td.a = alpha; td.m = base; - ctx->internal->execute(ctx, premultiply_slice, &td, NULL, FFMIN(s->height[0], + ff_filter_execute(ctx, premultiply_slice, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); } diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c index 35b9a10519..9d4d1651be 100644 --- a/libavfilter/vf_pseudocolor.c +++ b/libavfilter/vf_pseudocolor.c @@ -869,7 +869,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.out = out, td.in = in; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index 715230142b..0b00a9c1b8 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -189,7 +189,7 @@ static int do_psnr(FFFrameSync *fs) td.planeheight[c] = s->planeheight[c]; } - ctx->internal->execute(ctx, compute_images_mse, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, compute_images_mse, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); for (int j = 0; j < s->nb_threads; j++) { for (int c = 0; c < s->nb_components; c++) diff --git a/libavfilter/vf_readeia608.c b/libavfilter/vf_readeia608.c index fe4a8c4648..60d6c0704e 100644 --- a/libavfilter/vf_readeia608.c +++ b/libavfilter/vf_readeia608.c @@ -471,7 +471,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ReadEIA608Context *s = ctx->priv; int nb_found; - ctx->internal->execute(ctx, extract_lines, in, NULL, FFMIN(FFMAX(s->end - s->start + 1, 1), + ff_filter_execute(ctx, extract_lines, in, NULL, FFMIN(FFMAX(s->end - s->start + 1, 1), ff_filter_get_nb_threads(ctx))); nb_found = 0; diff --git a/libavfilter/vf_remap.c b/libavfilter/vf_remap.c index 5ab6199d71..c1b90ca8bd 100644 --- a/libavfilter/vf_remap.c +++ b/libavfilter/vf_remap.c @@ -302,7 +302,7 @@ static int process_frame(FFFrameSync *fs) td.nb_planes = s->nb_planes; td.nb_components = s->nb_components; td.step = s->step; - ctx->internal->execute(ctx, s->remap_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->remap_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c index 2fde9a954c..d50e0b6133 100644 --- a/libavfilter/vf_removegrain.c +++ b/libavfilter/vf_removegrain.c @@ -615,7 +615,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) memcpy(dst, src, s->planewidth[i]); td.in = in; td.out = out; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->planeheight[i], ff_filter_get_nb_threads(ctx))); src = in->data[i] + (s->planeheight[i] - 1) * in->linesize[i]; diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index 654a7171a9..f08ed9bdb3 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -549,7 +549,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .plane = plane, .c = c, .s = s }; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); } av_frame_free(&in); diff --git a/libavfilter/vf_scroll.c b/libavfilter/vf_scroll.c index 77d8db51bc..1f72c7595d 100644 --- a/libavfilter/vf_scroll.c +++ b/libavfilter/vf_scroll.c @@ -128,7 +128,7 @@ static void scroll(AVFilterContext *ctx, AVFrame *in, AVFrame *out) s->pos_h[0] = s->pos_h[3] = h_pos * s->bytes; td.in = in; td.out = out; - ctx->internal->execute(ctx, scroll_slice, &td, NULL, + ff_filter_execute(ctx, scroll_slice, &td, NULL, FFMIN(out->height, ff_filter_get_nb_threads(ctx))); s->h_pos += s->h_speed * in->width; diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c index af6e8b2518..92a81ed0ac 100644 --- a/libavfilter/vf_selectivecolor.c +++ b/libavfilter/vf_selectivecolor.c @@ -441,7 +441,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, funcs[s->is_16bit][direct][s->correction_method], + ff_filter_execute(ctx, funcs[s->is_16bit][direct][s->correction_method], &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); if (!direct) diff --git a/libavfilter/vf_shear.c b/libavfilter/vf_shear.c index 849592ccde..acabef3732 100644 --- a/libavfilter/vf_shear.c +++ b/libavfilter/vf_shear.c @@ -243,7 +243,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, 0, outlink->w, outlink->h); td.in = in, td.out = out; - ctx->internal->execute(ctx, s->filter_slice[s->interp], &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice[s->interp], &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_shufflepixels.c b/libavfilter/vf_shufflepixels.c index 051be44bf3..6df830a3e4 100644 --- a/libavfilter/vf_shufflepixels.c +++ b/libavfilter/vf_shufflepixels.c @@ -387,7 +387,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, s->shuffle_pixels, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->shuffle_pixels, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(ctx->outputs[0], out); diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 49a2996b5c..b91aa0012e 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -596,7 +596,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } - ctx->internal->execute(ctx, compute_sat_hue_metrics8, &td_huesat, + ff_filter_execute(ctx, compute_sat_hue_metrics8, &td_huesat, NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); // Calculate luma histogram and difference with previous frame or field. @@ -645,7 +645,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) .out = out != in && s->outfilter == fil ? out : NULL, }; memset(s->jobs_rets, 0, s->nb_jobs * sizeof(*s->jobs_rets)); - ctx->internal->execute(ctx, filters_def[fil].process8, + ff_filter_execute(ctx, filters_def[fil].process8, &td, s->jobs_rets, s->nb_jobs); for (i = 0; i < s->nb_jobs; i++) filtot[fil] += s->jobs_rets[i]; @@ -818,7 +818,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } - ctx->internal->execute(ctx, compute_sat_hue_metrics16, &td_huesat, + ff_filter_execute(ctx, compute_sat_hue_metrics16, &td_huesat, NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); // Calculate luma histogram and difference with previous frame or field. @@ -867,7 +867,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) .out = out != in && s->outfilter == fil ? out : NULL, }; memset(s->jobs_rets, 0, s->nb_jobs * sizeof(*s->jobs_rets)); - ctx->internal->execute(ctx, filters_def[fil].process16, + ff_filter_execute(ctx, filters_def[fil].process16, &td, s->jobs_rets, s->nb_jobs); for (i = 0; i < s->nb_jobs; i++) filtot[fil] += s->jobs_rets[i]; diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index 618b24c010..6479d45d0a 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -359,7 +359,7 @@ static int do_ssim(FFFrameSync *fs) td.planeheight[n] = s->planeheight[n]; } - ctx->internal->execute(ctx, s->ssim_plane, &td, NULL, FFMIN((s->planeheight[1] + 3) >> 2, s->nb_threads)); + ff_filter_execute(ctx, s->ssim_plane, &td, NULL, FFMIN((s->planeheight[1] + 3) >> 2, s->nb_threads)); for (i = 0; i < s->nb_components; i++) { for (int j = 0; j < s->nb_threads; j++) diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 3368e25c9c..2dc04dc2ac 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -179,7 +179,7 @@ static int process_frame(FFFrameSync *fs) ff_fill_rectangle(&s->draw, &s->color, out->data, out->linesize, 0, 0, outlink->w, outlink->h); - ctx->internal->execute(ctx, process_slice, out, NULL, FFMIN(s->nb_inputs, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice, out, NULL, FFMIN(s->nb_inputs, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index 099dd5724b..ba67156688 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -937,7 +937,7 @@ copy: ThreadData td; td.ileft = ileft; td.iright = iright; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->out.height, ff_filter_get_nb_threads(ctx))); } break; diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c index d6371644e6..1c93f77f8e 100644 --- a/libavfilter/vf_super2xsai.c +++ b/libavfilter/vf_super2xsai.c @@ -331,7 +331,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->height = outlink->h; td.in = in, td.out = out; - ctx->internal->execute(ctx, super2xsai, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, super2xsai, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c index 17ceb0dfa8..4517b8da33 100644 --- a/libavfilter/vf_threshold.c +++ b/libavfilter/vf_threshold.c @@ -146,7 +146,7 @@ static int process_frame(FFFrameSync *fs) td.threshold = threshold; td.min = min; td.max = max; - ctx->internal->execute(ctx, filter_slice, &td, NULL, + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); } diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index da6b4e235d..ef2c34def6 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -275,7 +275,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) td.in = in; td.desc = desc; td.peak = peak; - ctx->internal->execute(ctx, tonemap_slice, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, tonemap_slice, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); /* copy/generate alpha if needed */ if (desc->flags & AV_PIX_FMT_FLAG_ALPHA && odesc->flags & AV_PIX_FMT_FLAG_ALPHA) { diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 6affbed0a6..6d51126589 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -352,7 +352,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in, td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); } diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index e9f75a673f..b4f358ddc5 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -164,7 +164,7 @@ static int apply_unsharp_c(AVFilterContext *ctx, AVFrame *in, AVFrame *out) td.height = plane_h[i]; td.dst_stride = out->linesize[i]; td.src_stride = in->linesize[i]; - ctx->internal->execute(ctx, s->unsharp_slice, &td, NULL, FFMIN(plane_h[i], s->nb_threads)); + ff_filter_execute(ctx, s->unsharp_slice, &td, NULL, FFMIN(plane_h[i], s->nb_threads)); } return 0; } diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index d4bd5756da..4bba7140ba 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -4887,7 +4887,7 @@ static int config_output(AVFilterLink *outlink) set_mirror_modifier(s->h_flip, s->v_flip, s->d_flip, s->output_mirror_modifier); - ctx->internal->execute(ctx, v360_slice, NULL, NULL, s->nb_threads); + ff_filter_execute(ctx, v360_slice, NULL, NULL, s->nb_threads); return 0; } @@ -4910,7 +4910,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->remap_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, s->remap_slice, &td, NULL, s->nb_threads); av_frame_free(&in); return ff_filter_frame(outlink, out); diff --git a/libavfilter/vf_vibrance.c b/libavfilter/vf_vibrance.c index abbc25436f..bc4cf2578c 100644 --- a/libavfilter/vf_vibrance.c +++ b/libavfilter/vf_vibrance.c @@ -285,7 +285,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) VibranceContext *s = avctx->priv; int res; - if (res = avctx->internal->execute(avctx, s->do_slice, frame, NULL, + if (res = ff_filter_execute(avctx, s->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c index 4d2381abcb..e1b51aae3f 100644 --- a/libavfilter/vf_vif.c +++ b/libavfilter/vf_vif.c @@ -331,12 +331,12 @@ static int compute_vif2(AVFilterContext *ctx, td.src_stride = curr_ref_stride; td.dst_stride = w; td.temp = temp; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = curr_main_scale; td.dst = mu2; td.src_stride = curr_main_stride; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_dec2(mu1, ref_scale, buf_valid_w, buf_valid_h, w, w); vif_dec2(mu2, main_scale, buf_valid_w, buf_valid_h, w, w); @@ -361,12 +361,12 @@ static int compute_vif2(AVFilterContext *ctx, td.src_stride = curr_ref_stride; td.dst_stride = w; td.temp = temp; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = curr_main_scale; td.dst = mu2; td.src_stride = curr_main_stride; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_xx_yy_xy(mu1, mu2, mu1_sq, mu2_sq, mu1_mu2, w, h); @@ -375,16 +375,16 @@ static int compute_vif2(AVFilterContext *ctx, td.src = ref_sq; td.dst = ref_sq_filt; td.src_stride = w; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = main_sq; td.dst = main_sq_filt; td.src_stride = w; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = ref_main; td.dst = ref_main_filt; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_statistic(mu1_sq, mu2_sq, mu1_mu2, ref_sq_filt, main_sq_filt, ref_main_filt, &num, &den, w, h); diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index e8e55d5be3..9c10874606 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -504,7 +504,7 @@ static int filter(AVFilterContext *ctx, int is_second) adj = s->field ? s->next : s->prev; td.out = out; td.cur = s->cur; td.adj = adj; - ctx->internal->execute(ctx, deinterlace_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, deinterlace_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); if (s->mode) s->field = !s->field; diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c index 977ebad9ce..57b429d28d 100644 --- a/libavfilter/vf_waveform.c +++ b/libavfilter/vf_waveform.c @@ -3416,7 +3416,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.component = k; td.offset_y = offset_y; td.offset_x = offset_x; - ctx->internal->execute(ctx, s->waveform_slice, &td, NULL, ff_filter_get_nb_threads(ctx)); + ff_filter_execute(ctx, s->waveform_slice, &td, NULL, ff_filter_get_nb_threads(ctx)); switch (s->filter) { case LOWPASS: if (s->bits <= 8) diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c index 98b8d0bd06..ea6cd8db97 100644 --- a/libavfilter/vf_weave.c +++ b/libavfilter/vf_weave.c @@ -150,7 +150,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.out = out, td.in = in; - ctx->internal->execute(ctx, weave_slice, &td, NULL, FFMIN(s->planeheight[1], + ff_filter_execute(ctx, weave_slice, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); out->pts = s->double_weave ? s->prev->pts : in->pts / 2; diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 28642fa323..f025061888 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -367,7 +367,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; td.rgbtoyuv = s->rgbtoyuv; - ctx->internal->execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); out->width = outlink->w; out->height = outlink->h; diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index c3e5f3df85..8bbe3a1955 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -1830,7 +1830,7 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame *a, AVFrame *b) av_frame_copy_props(out, a); td.xf[0] = a, td.xf[1] = b, td.out = out, td.progress = progress; - ctx->internal->execute(ctx, xfade_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, xfade_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); out->pts = s->pts; diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c index c8ff37f797..0e387fe960 100644 --- a/libavfilter/vf_xmedian.c +++ b/libavfilter/vf_xmedian.c @@ -253,7 +253,7 @@ static int process_frame(FFFrameSync *fs) if (!ctx->is_disabled) { td.in = in; td.out = out; - ctx->internal->execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); } return ff_filter_frame(outlink, out); @@ -440,7 +440,7 @@ static int tmedian_filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 41069a711c..084d766d18 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -249,7 +249,7 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, td.h = h; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); } emms_c(); diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c index c68edc815a..ef49bf442c 100644 --- a/libavfilter/vf_yaepblur.c +++ b/libavfilter/vf_yaepblur.c @@ -253,12 +253,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.height = s->planeheight[plane]; td.src = in->data[plane]; td.src_linesize = in->linesize[plane]; - ctx->internal->execute(ctx, s->pre_calculate_row, &td, NULL, FFMIN(td.height, nb_threads)); - ctx->internal->execute(ctx, pre_calculate_col, &td, NULL, FFMIN(td.width, nb_threads)); + ff_filter_execute(ctx, s->pre_calculate_row, &td, NULL, FFMIN(td.height, nb_threads)); + ff_filter_execute(ctx, pre_calculate_col, &td, NULL, FFMIN(td.width, nb_threads)); td.dst = out->data[plane]; td.dst_linesize = out->linesize[plane]; - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, FFMIN(td.height, nb_threads)); + ff_filter_execute(ctx, s->filter_slice, &td, NULL, FFMIN(td.height, nb_threads)); } if (out != in) diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index c1962b1ed8..2705b1ab93 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -277,7 +277,7 @@ static int activate(AVFilterContext *ctx) frame->sample_aspect_ratio = (AVRational) {1, 1}; frame->pts = s->pts++; - ctx->internal->execute(ctx, s->draw_slice, frame, NULL, + ff_filter_execute(ctx, s->draw_slice, frame, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, frame); diff --git a/libavfilter/vsrc_sierpinski.c b/libavfilter/vsrc_sierpinski.c index eec9e8c25d..5160fa52b2 100644 --- a/libavfilter/vsrc_sierpinski.c +++ b/libavfilter/vsrc_sierpinski.c @@ -191,7 +191,7 @@ static void draw_sierpinski(AVFilterContext *ctx, AVFrame *frame) s->pos_y--; } - ctx->internal->execute(ctx, s->draw_slice, frame, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->draw_slice, frame, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); } static int sierpinski_request_frame(AVFilterLink *link) From patchwork Wed Aug 11 01:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29413 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp956047iod; Tue, 10 Aug 2021 18:18:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpWtPtdLS22UhK61JWGg2KMR7DFtS+0eIEWFBsI+g+LRruCE6ymCxDLAYcr72eP0hqKGrY X-Received: by 2002:a05:6402:1add:: with SMTP id ba29mr8301849edb.145.1628644737839; Tue, 10 Aug 2021 18:18:57 -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 h8si2183650ejj.750.2021.08.10.18.18.57; Tue, 10 Aug 2021 18:18:57 -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="jug/AwhJ"; 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 D5B4B68A47F; Wed, 11 Aug 2021 04:18:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066053.outbound.protection.outlook.com [40.92.66.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2408168A404 for ; Wed, 11 Aug 2021 04:18:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CRKLg9OFHG3wAU2tSSM+6FwwjSSBnN5gQ8NY5TwNqjcsktq3HmeUPk/t9lPVarEtaKiQ0oKNZeZ3lfDd/3/wZ8fHLHUqtGWneIiLyBw5+XtzXkkzaePaGBxOe4QxQvzlgB6Y4imIf7faN6k4UWoeYSGNC+ubbUZEkJsMnHXxZKWvNoNsle0XUNfSmd7Y4OwM8PVzYSGwtHgHF3FTQcRv/5Q18SQyTXe9JlhFRhCNQTa9Xn2vogpkEwVqz1d2+GPoDGtoMb0qxR26NhtvWNxMtKCW0f49dzRrkKwW8LDbpyShrbRXinmdB+OBPoyrFqAOcgyXK1URe136grIXNc6WLQ== 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=7Nx1g5QeIwJjY9r92E+1KsqwapwMzbm7hznfg6PvMQk=; b=PXZDQmHLkufmjisNqS9H2l6PY3GjeqT1zvs7TRRIaY/9e63QYB7G11TZXp2hpra4xMqNlFo78Ortu2MU+EZMtWEijvigpp+Kc2XtAPVHzzP4CC4P2OExDHsA3kYSlQSEPq+LDNZcE0lICIrgs4CUkyXuYb9sxHpGA+B4KWCs4oouDvbf0Vit7r3gsErtpTPqC1p7QCUXcagYuT6qEcK0gOcWONXngPHxUJQJFhwSxcuPBkh5mOv16UO6eK+CAgjR3Wue9crKGC4aXdkoJy8UGR6oKnSvEECEiKdOwq2y+2Cw7N7cWuNdDZv/sbJJpEFiKQz4V9F4fc2YynnWATGugw== 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=7Nx1g5QeIwJjY9r92E+1KsqwapwMzbm7hznfg6PvMQk=; b=jug/AwhJDMum70HVONGYEp+0CrajfPhyeYyj++dmkiPp06xK3zz4ql9hRdLZ3vBKU+CHUvepNcDFEWsVrB3kk17e/ii1yYehuttBC1pJGlNk3K8jD56WFjGWaF02BB3ejEiZikJSkb4Xa8U8x9NZ4Z9OMrbIwhUdZCaF0J4VMPoZbQJnu9N/jqRJWqxOvjqJu9tRWLoAuc/6GHY/epNOngDNFp8omLqxIKoduFxfT3iZ+d/1E2E1/t/jJQvgKVkS32+WPKanYkbzL75/UEqDPV8zNN94W/8BWm7JGxUrZGWYWX3Px0Un/wMLD071dkhDMSnJWL7jmVd7Xt6QiBiU2w== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4613.eurprd03.prod.outlook.com (2603:10a6:20b:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 01:18:31 +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.4394.023; Wed, 11 Aug 2021 01:18:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:51 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [4REfFXG8wls2k7qDK0E6qUeW2ARmzNMz] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac38091e-5248-4b82-8437-08d95c65e8d7 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiT4+P6zBac8zxhOSuRwKn5lWpt03MHkLQa13aJNDWF4qPFOP8kBO3RQjPVOeJ+FYi+1tvd177C8TbBE5jHX6+2cNVMx0/n8B+7o8Ig5L30goyDDm2MJAlkVaZkwNL/rC/z/5cUcKMS8L5IjAGFxiHvGNSlXGbcUZ3Id4RBHueMklBIHDDbylocXp6JGWELVQdRnhnNOfMXZT6dj7TcyH0UIWrJjlKZA9UU6JTCqgj4d+o+D1t38LqtgWu7Smp64b6hN/nFLCd7SYw9gXxoSy1OFC06/ObEMj63sFScJp2ROCM4qP/Q5HPk5YJqMMzfU9kBfxHRx6vkIDkJ7CPytFmNQc6ow0baODEBq8PP8JIWfHSIZ7Aa1OSBVRRTCMXaFKqUfUEvpV4y+lPfw/ZGFmInh/ojyh2u+3P4L9FsNsZMqcBD61x1DHxxhmXTgwzn6ZaChSJ/BB+QO3qmvPjrqHAM19wbv5twEBd+1EDZ4FKOZLfH90J3dIkKNKmyeAHy6kPC5CxRSof0DIJ7606pzwpocYb5HA0N6HGGpZTri0wPxkxLsp9uBJs0WWKV0MwL6o29FIc3kkOoHmibt/z3hv3aJoMoZxvX3os8FOb76o5hqsCnuwbPWY+emCXP+yZggEtW5MqmDHGwwSZ+UBd/67WFR0MCpPHHl9V0WGjJxiGdkWJR1bX34TciiEqL33KbYcYayX47h2SPFs6oUxfWxcvUg/yn9pkqzk9BtqU8HsSMKRuGwdbswW/zjql/wNGpvxVU= X-MS-TrafficTypeDiagnostic: AM6PR03MB4613: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NThxST2A8puFr9eGqCXdFFTJwSf/unNoBSRm3UXvP4LpeNqtsFmsYOT376vNtnWmSp+dq2n/L2PaLbODz/qc2cVhk1p9uJXGn7Kjn22+Vu3dmSMs9iz/JM1CGwYBI0rD2PQc2QuvhS2f/QCR8Txb+ho/V8JXTJtZSbLC+SBajL6rmA0HLUNu37RdZ7MWpJ7IKMvEmvJ0tDUVCfv8Utr43QSWSWiqV/3WvvZsO01jMxItOKZbWj3iYCEWcAv9GzNNyVfdmJkOEpqhWLro3yaXxKMLvkslx1cn4X6Dq02fRqTuLSMyLez4xqU2iX8fCIqoNJfBdRIZb0DXXnwv8DGdycuRaApY95sF94IUncZJ7LJ5I+2SGcUvGgm/7RuC0GhbQHVBBWXmySxovbBk4RpaiiKhOsSbRYrJRiEwCPhVU09PW4KpcYgwUWYnYl5+YdtR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2wd0x8v68XRhUDXBzRTo97dijcjAkAxfB3GExXXcAPAox1qEYZLaEArBGdTEn4/3hImFYh64wt3ZYnFKh/gt6L+JF+5HRmxjjqtGeOyonAnHsCAlM1UHLAH7to6PEn9AXeaSe8S1LVVNkFomkKo7Rw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac38091e-5248-4b82-8437-08d95c65e8d7 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:21.9298 (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: AM6PR03MB4613 Subject: [FFmpeg-devel] [PATCH 08/10] avfilter: Avoid allocation of AVFilterInternal 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: BeyGvbpPRkyB This can be achieved by allocating it together with AVFilterContext, with the public AVFilterContext as first element in the new structure. Given that said structure is now more than just the internal, it has been renamed to FFFilterContext. Accessing it is not type-safe, so this unsafety has been confined to a single function. This break ABI due to the removal of the AVFilterContext.internal pointer. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 15 ++++++--------- libavfilter/avfilter.h | 7 ------- libavfilter/internal.h | 12 +++++++++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7e48ff14c5..6925d99659 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -623,14 +623,16 @@ static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, voi AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) { AVFilterContext *ret; + FFFilterContext *ctx; int preinited = 0; if (!filter) return NULL; - ret = av_mallocz(sizeof(AVFilterContext)); - if (!ret) + ctx = av_mallocz(sizeof(*ctx)); + if (!ctx) return NULL; + ret = &ctx->pub; ret->av_class = &avfilter_class; ret->filter = filter; @@ -652,10 +654,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) av_opt_set_defaults(ret->priv); } - ret->internal = av_mallocz(sizeof(*ret->internal)); - if (!ret->internal) - goto err; - ret->internal->execute = default_execute; + ctx->execute = default_execute; ret->nb_inputs = avfilter_pad_count(filter->inputs); if (ret->nb_inputs ) { @@ -695,7 +694,6 @@ err: av_freep(&ret->priv); } av_opt_free(ret); - av_freep(&ret->internal); av_free(ret); return NULL; } @@ -759,7 +757,6 @@ void avfilter_free(AVFilterContext *filter) av_expr_free(filter->enable); filter->enable = NULL; av_freep(&filter->var_values); - av_freep(&filter->internal); av_free(filter); } @@ -870,7 +867,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ctx->thread_type & ctx->graph->thread_type & AVFILTER_THREAD_SLICE && filtergraph(ctx->graph)->thread_execute) { ctx->thread_type = AVFILTER_THREAD_SLICE; - ctx->internal->execute = filtergraph(ctx->graph)->thread_execute; + filtercontext(ctx)->execute = filtergraph(ctx->graph)->thread_execute; } else { ctx->thread_type = 0; } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 4436eb7d2d..26a849f955 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -327,8 +327,6 @@ typedef struct AVFilter { */ #define AVFILTER_THREAD_SLICE (1 << 0) -typedef struct AVFilterInternal AVFilterInternal; - /** An instance of a filter */ struct AVFilterContext { const AVClass *av_class; ///< needed for av_log() and filters common options @@ -367,11 +365,6 @@ struct AVFilterContext { */ int thread_type; - /** - * An opaque struct for libavfilter internal use. - */ - AVFilterInternal *internal; - struct AVFilterCommand *command_queue; char *enable_str; ///< enable expression string diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 48a911f082..040ce6dee8 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -134,14 +134,20 @@ static av_always_inline FFFilterGraph *filtergraph(AVFilterGraph *graph) return (FFFilterGraph*)graph; } -struct AVFilterInternal { +typedef struct FFFilterContext { + AVFilterContext pub; avfilter_execute_func *execute; -}; +} FFFilterContext; + +static av_always_inline FFFilterContext *filtercontext(AVFilterContext *ctx) +{ + return (FFFilterContext*)ctx; +} static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { - return ctx->internal->execute(ctx, func, arg, ret, nb_jobs); + return filtercontext(ctx)->execute(ctx, func, arg, ret, nb_jobs); } /** From patchwork Wed Aug 11 01:17:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29415 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp956107iod; Tue, 10 Aug 2021 18:19:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh9wAtRntwc5kE837wwUVfb2/69fYGcta8cVj+yepY+WaoTr3u+BTkFldv7YrrQ3aRIJ04 X-Received: by 2002:a05:6402:35d2:: with SMTP id z18mr8458107edc.282.1628644748085; Tue, 10 Aug 2021 18:19:08 -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 q7si21116293eja.751.2021.08.10.18.19.07; Tue, 10 Aug 2021 18:19:08 -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=jzkB0kDi; 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 2A8C668A4C3; Wed, 11 Aug 2021 04:18:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066053.outbound.protection.outlook.com [40.92.66.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D49868A3AF for ; Wed, 11 Aug 2021 04:18:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iYBvxirvknk6290Y0OwqDZDf2pmUaKM2nmAu2pF9TjdYVtqrtTDpfqRhmnEYoTDiIrDQ9OV9YuXapfASZjA1GLEowmJVBFrzqh4F2mIG/vHhDnh0us7xQMZTPAoOjFVJqDY7pi3lV70tpuf0Mt1UgSDiT84wm8u8caxzyxg0gah6HKV7xHwgZJHn6wDCzi16Xs6X1xsi5YI/gGD7sh/SdSxGaWteADFn7aE9go5fICe7iZkQCkqAqdcMhzSKwqckwNtd8crkb3/OBpBHnVJZnB0YWDC4Ka21oFJ4yOH7xeNnM+D6cn5Y7z2Zu1vOIyl7WFGfI7z8B3ShFAgX1k4TFg== 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=ROqJc2cNTMWfSgS4aX6rlgpiJ/qjyhJPvSPRU0Po+Jk=; b=k0uK3yG77gJaXreWuc7D7rd68yZiggNuNfvz9e3P9vhmd42hFkf5prP871aOBuNTysk/OfgcWtMFbHj5sRqA75AGW3Eg828KxXj3M8ZEwC0YEa80KhM7Pzv89yfda94voAOuSwAzdNA+9mqNsYbOuNA2Xz++Pm5JrzoUUG92DO58BQJg5DqJfoeuwlu6AzKfEjekrjqVyBkOY06hBcskxft4F7T2dWvhnLXbvxe14arvltAEI1l3qmFw/p+E7ROhNLlqStxwHL4Iya6tp5FaGRKlnDh9dBo+RiK9Y+vZLZQoR6ey1b+FrkOGryl1wtgybWfYm/B5Ymsk7jGY05F1Ag== 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=ROqJc2cNTMWfSgS4aX6rlgpiJ/qjyhJPvSPRU0Po+Jk=; b=jzkB0kDi8cAw1f7Q7bbe1mn6+B6w2xqwG/aI8FNNABc89ke8nsKxDaVyxzoxe/qirHVn/V9eWWPygeP2Ak8zX9Duo8D2CUIeDbH8Ak/mzapInjorNQGIyL5NzZpyA7Iu5vOat6yEvezfIQ0a8tpmTYHfWCmJ4GRQTawA/MOSYGVhX3677py09B4Nxwwg5VivYWBx4BeWr2jvjZkjuUVvvU9idq8BbaIelKRFsGGmVOAGln7qrFKtvrmvG2e/oVy/JSSpwqBfAgwhrAybH+S1Wt1Qwq3ypt/Yq7FBu1p3deIYtbZAR4qRlNQXEpV0xG2zxSg06LnXnfYH0SmpZKXNBA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4613.eurprd03.prod.outlook.com (2603:10a6:20b:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 01:18:31 +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.4394.023; Wed, 11 Aug 2021 01:18:31 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:52 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [ASqNnhF/jPTH1sJ3cYs05D1rutZ+UW/4] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ddb2c00-d380-477e-c0d6-08d95c65e95c X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UL9mvhPTGbvw8IrM5N7Tagt+IMR0WNbyHX9p1JBrFL8w3obZr1U82+Eqa7RowLyiVaUQumEMRCne+/DGGnfXUYEtVyS8Copvfigeyyz2BjMa1f14DZVH4srmR8n7obGpO5pUCmEBNMLVdQz12SznBIX7CX6vVfZczJVYum5I4neGESp6kOQj1PTEBUN1fy3xSjSFV5BiECtDLcHM/9nCkQcGOe1iVwwxGogGlNK4d1qa/clSn4d1I3UG245Znw3ULMzzs4+kluMFBgptIUck4vKOBedeXw3LY3ZsYmf5vwhIgzThsjJHpcJMMtlMktWXllBVT9n0U5++9beSI2m7sKRfWQG/kGlvcMeREDPtks9ZBgCrFD15lqyDMRlIdI2kTve9TvUcQz0bR7APGQ7DIj6RsyG5Fd/vFkJNip0Ys+30gtwgLvO3ENSPklEVn9uniiYqOi/XqnrDnaLt3Sew5Qyicw+yH7olZbOsKYpu11TkmRWh1jlau1x02such6S9AKMsV0ayvfR+xHNhBsuINq2MHWyOC6+V8cEWraTswLbDj4WAr4D/xduodYUHjW9uHv+xkewVHSp8tglveVOPhPRnDT6yh0sy6V8IUOAtjHqQAAyafJ7RXR6evHO8jkbwPk7N8MbvuWYXc9Df9YmroWD7309tRA/D/PkZLRcHj7A2JHaTp0dQFUbyWbj6MLjxx858FHIlRZ2dg== X-MS-TrafficTypeDiagnostic: AM6PR03MB4613: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qG2swwYPqGltpQlXdMFtfPj1lyBqpKgIWwLp/nUvQGWLf/RepVvUqduK0Xa1x9vwwk11VkhqdJkkPsgnWN7F1Tu00q7RhrV56h9fL9/AAhwezjZ6EvfMZDUMMcClqRTNZafZ3tA3y+jv/rEcfRFWEMHT1JohGuqMCKao5EMW/cKF7IHzODfyIZhz6Ui9pbS8kQA+C4XBl0ovFpU/5k2MgI9hhEVoe1rMetqiBP9TMGeqd9D//bYoTF8ZWVUsOEs4omtCgwW4BG3YOxV0Cy5JginU71f4Om8NVzlK6iNTAdkvU29Ij/gHlkQJ8BocId5uzIZ/Z3n/KxVG+SfSHlc7xeJtvWqVmZo7Lp6R8OSKXdkmU8PZ4Dnl+c6nVg3b52ztM9Z8k/GoUwDfAOUsNyIoeaik8moDLe5hqbJFhW1R4NrT2BNDi/Bj3WRf8qH1i7z2 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rMBuCiL3H4srW+WEn6/J9oBK/CdbxpFpgCdo253ereK8qs5hvd4IjtU6ixSddlT1dsFnHJnEtMwDt8dAQUZGRfj/1dhrRFqGalO4jAuAYk88C/rYv0eBs9fKc4PeT4c/S9/HiRZ/Lo8yMUBKXuK50Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ddb2c00-d380-477e-c0d6-08d95c65e95c X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:22.8886 (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: AM6PR03MB4613 Subject: [FFmpeg-devel] [PATCH 09/10] avfilter/avfilter: Make ff_update_link_current_pts static 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: DpFG3bIWU17k Only used here. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 10 ++++++---- libavfilter/internal.h | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 6925d99659..ef049fe9b6 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -47,6 +47,8 @@ #include "libavutil/ffversion.h" const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION; +static void update_link_current_pts(AVFilterLink *link, int64_t pts); + void ff_tlog_ref(void *ctx, AVFrame *ref, int end) { av_unused char buf[16]; @@ -220,7 +222,7 @@ void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts av_assert0(!link->status_out); link->status_out = status; if (pts != AV_NOPTS_VALUE) - ff_update_link_current_pts(link, pts); + update_link_current_pts(link, pts); filter_unblock(link->dst); ff_filter_set_ready(link->src, 200); } @@ -513,7 +515,7 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr) return 0; } -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts) +static void update_link_current_pts(AVFilterLink *link, int64_t pts) { if (pts == AV_NOPTS_VALUE) return; @@ -1340,7 +1342,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts if (!link->status_in) return *rstatus = 0; *rstatus = link->status_out = link->status_in; - ff_update_link_current_pts(link, link->status_in_pts); + update_link_current_pts(link, link->status_in_pts); *rpts = link->current_pts; return 1; } @@ -1369,7 +1371,7 @@ int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min) static void consume_update(AVFilterLink *link, const AVFrame *frame) { - ff_update_link_current_pts(link, frame->pts); + update_link_current_pts(link, frame->pts); ff_inlink_process_commands(link, frame); link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); link->frame_count_out++; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 040ce6dee8..505d2d4952 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -199,8 +199,6 @@ av_warn_unused_result int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx); -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts); - /** * Set the status field of a link from the source filter. * The pts should reflect the timestamp of the status change, From patchwork Wed Aug 11 01:17:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29414 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp956298iod; Tue, 10 Aug 2021 18:19:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsu9WoVs6hO1FA5PRwwSYb66XpyGhkLpBy+GCsp1nLzIQLHi6Nnc8hkL12ofYCUh3OuOcz X-Received: by 2002:aa7:c1cf:: with SMTP id d15mr8202994edp.201.1628644773651; Tue, 10 Aug 2021 18:19:33 -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 l33si26526532ede.457.2021.08.10.18.19.33; Tue, 10 Aug 2021 18:19:33 -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="OW4d3/WS"; 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 ED54C68A4E5; Wed, 11 Aug 2021 04:18:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066053.outbound.protection.outlook.com [40.92.66.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C9E3468A497 for ; Wed, 11 Aug 2021 04:18:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZhtTr8HkSfwmmY4BdiKJdLHNXYmdBSaKkOAyYZUusLRmMZYxk3PPu+dMAHSJUScs487ajvFNv1mt6yekB9AlqmaKCorJ6eS6TdFByhhDWoocRi6RyrBvGaiMkbG0JzINqLtY5KCdmI8sFgPTzM8WWepAuV9cSu7yuM4chKUiO0ia+tZ4zH/9q+Uwi0QzW2a9WKWQDkjgf7FuAHq97YHZdrrMgHfPaK3gxBIZGOPh9ciFN9EW6t5O9YB1Kfm4M1ulic9y3txdMznVHWeNVQAqAFQqOpmMtzYbiMIWhlec3KSw2brjIud75dcl/xWI0reMP4giskFICj34qjWs2dBfg== 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=/46pu4prnroH67ZSoIa9A+yOvkttmfK4fnPLnKmr0yA=; b=RzJKLUVanTprX5T1XNLDO/ZtxhGyS8C1dsYXK9BOOQuXgyrZV9k2g3LkC5ljylujmi7tGJEHPMHWk/58n+u5DA5aSGzEyuyJOLksCQVwl7b5Gl/USHKtrKqNw9/EUetk9G5SL7PthxnGiBBC1puu3niseV+AIvlWQ2g4ZuknB8zjcjlI69FQ0fEYeVcZQ1R67B4BxuvPs9jioZKWW09vHZlHAq2GaphkF0nLEb3nrk0RhGn33oj8htjTjiyMGJBRYHz0fqY/iR6OO4xr/F1r9aYPYxzgZckS71yXevvIqpdVoQVS1lbDNg626DjWhHil7ymIkhl94Vrb/6v6fmCa5g== 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=/46pu4prnroH67ZSoIa9A+yOvkttmfK4fnPLnKmr0yA=; b=OW4d3/WSOgitsG28fZ9YfCIMehx+cLznkaHZF6LzfcQo4n7MXerqZJ/+Ir0sT+rZOKNjOBZxmSa18u960RCR4wmlEK83CVzsJrShH6iXSZUrZkBWvZEdLLxcxOpjmLYqvWHUVm6I20ESqoMxaMG+HBfqG7s3nDBMyXMX3DTsXj4vGKAQOM5cQy+LydZA2roNXLjERiUJtGR/mmX+ZFZqLJn7VqfxGtIZkbxRNRsI2OVrkB9DcjNlbTtUy03YcuoNgiXUJ5TzO+1Q8YfBuIJajJL2rSDCT4xB4zQkAIGk2c1gBbQYdC/ihZpOHj7jTsmpLxH6qDNiUATwMoQCuQjZtA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4613.eurprd03.prod.outlook.com (2603:10a6:20b:11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 01:18:31 +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.4394.023; Wed, 11 Aug 2021 01:18:31 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Aug 2021 03:17:53 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [BqAM3gPpz/fuicmDNITkD/5NtYjeZWhB] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210811011753.739659-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.102) by FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 01:18:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82c818bb-c982-4b58-4742-08d95c65e9d1 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVNZZwRrMzTbQcOlzes5P/p+CaVQiBRZQywzTQO+wpbbbkTjoYqfZT+Kd9No3hN9W6ToxcpXS8M3aEHtNdludkNiPoYzoaxR/HDgbkjiGEUAMa75vbfLSP9q5p/DQPDVHiUL6E6Z23L0mET0vV09ssmGfNV4UY/l4H/afOq4s6GkjBIRzIbIy2Pcd23r5F1Ib88kiefbh/pVmOU0fgsETGkfEm8W4FL5aT7FvHJrzjUb2OPBsC4Hck1BTIB6YURfojY09qKN1gfH8/egneoO+KINZhRktqkOFPGxdUqK5xQmSfbXODWM0bsTsX+zHgi4o8964LsHGZt5dpfcTR3UKUOujpvG1DlwL6DyV+518lgqsO8rIsUpfchgkD52NDHZ8XjdBj+KY9+SJDUToLTAV+Hi6vZ/Vw0kKqXNRJ5MACPtGjLKUugHPrljPQ4dzMrrVJuQJXLJRVSaUD/cMXiMCZ/zHTnvTsRpv4DEx/dbtcKmoWlVmDDXp+hbplfUG67MJeMQ0gSwbAztFE62cicBj/p6wPDgOJwgxF+BZRc+IG6medCFRtvDyEkQDDoGqSPYRYVuYHhPyyl8LHNsjiPuCr0dq4ikbBtxOxYwxmJR4+vIwLgqod8BBO5qHG7jv599gXDitEiQw4Zrcla9CPVXtuO9sr+p8/XgsmAs4/8ujww3TC7gxlHPsyvVRQx+t+lqwarm6xhwRfmTcE2Pz8xwc/widSA/q+DsEk= X-MS-TrafficTypeDiagnostic: AM6PR03MB4613: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WhxGmTeofAFEFiN90MvIxMG5XOmkbhKnPkR6xwLNZiPDdFTjZvTwhfXc5LiIuJAJLga9OOrSJMqd4w6kqs8HtOfBCpCCASOsqmhnSOAcDlf5uA+DR1pUR1CThoGTfYZPe9cA6iBmolwBckjllbU5GE/RHU7pwChudUW6nN68+phNd00XsDOPGZZJwTTdZ1hX66GJEAJVofp7cv2WLgD0RyeZOrtgtGQyZDXuiozfQABrZmS5odkw32gICNG1N5636PxPC+TnVIy/qLX7uxFz1ZTuvUdnCozDRHavk6Dh/C/hc9Gj8vnwU7QmAadsZ9laWx5Ycs7/F6icBY0HSprpxjZ+2N3tUMxwvMgHdSrl6YDKTZJ/mN7wrqLCrusNvquPuHFbJ/6nz0jAtFPbvASA11hPOQlEuW+YE60F3fIx+De6D9EaUoXretTOCP5YUipz X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8q2lSEdZ3y4DRvXHoxirIA7ejPGErhjQfzPfOJ69cw8ZYYvZbCjplZ3ajmFQtJvW2dQjsAO+LPSdPBtc69AjcPMIjqm/7Lleeg7rkneIx8qR0n/pKuZmWgB4VUxh5FC7QlFGrHRimd1GguIABXoJRA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82c818bb-c982-4b58-4742-08d95c65e9d1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 01:18:23.6881 (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: AM6PR03MB4613 Subject: [FFmpeg-devel] [PATCH 10/10] avfilter/avfilter: Hide most internal AVFilterLink fields 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: kQc1vXV7BCc0 AVFilterLink does not have a separate structure for its internal fields. Instead these fields are in the public avfilter.h header together with a typical public/private separation line. But because one of these fields (not a pointer) has a non-public type, they are #ifdef'ed away and need to be made visible by a magic define. This is very ugly. This commit changes this: Most of these internal fields are moved to a new structure which also contains the public AVFilterLink as its first member, so that they can be allocated together. The fields that have been moved are those for which most uses happen in the libavfilter core and not in the filters themselves. The latter will be dealt with later. Signed-off-by: Andreas Rheinhardt --- I have not found a truely good way of moving the other fields without using filterlink() everywhere; I try to concentrate this as much as possible in libavfilter's core files (as opposed to the actual filters). libavfilter/af_firequalizer.c | 6 +- libavfilter/af_loudnorm.c | 9 +- libavfilter/af_lv2.c | 2 +- libavfilter/af_replaygain.c | 4 +- libavfilter/audio.c | 23 ++-- libavfilter/avf_aphasemeter.c | 4 +- libavfilter/avfilter.c | 211 ++++++++++++++++++---------------- libavfilter/avfilter.h | 106 ----------------- libavfilter/avfiltergraph.c | 58 +++++----- libavfilter/buffersink.c | 9 +- libavfilter/f_ebur128.c | 4 +- libavfilter/f_graphmonitor.c | 13 ++- libavfilter/f_sendcmd.c | 2 +- libavfilter/f_zmq.c | 2 +- libavfilter/filters.h | 2 +- libavfilter/internal.h | 110 +++++++++++++++++- libavfilter/tests/filtfmts.c | 5 +- libavfilter/video.c | 19 +-- 18 files changed, 311 insertions(+), 278 deletions(-) diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index b8ec20f5ae..463276a8ee 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -823,8 +823,10 @@ static int config_input(AVFilterLink *inlink) av_log(ctx, AV_LOG_DEBUG, "sample_rate = %d, channels = %d, analysis_rdft_len = %d, rdft_len = %d, fir_len = %d, nsamples_max = %d.\n", inlink->sample_rate, inlink->channels, s->analysis_rdft_len, s->rdft_len, s->fir_len, s->nsamples_max); - if (s->fixed) - inlink->min_samples = inlink->max_samples = s->nsamples_max; + if (s->fixed) { + FFFilterLink *const link = filterlink(inlink); + link->min_samples = link->max_samples = s->nsamples_max; + } return generate_kernel(ctx, SELECT_GAIN(s), SELECT_GAIN_ENTRY(s)); } diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index 8bfb5ccc74..24c24bad3d 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -503,8 +503,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->pts += out->nb_samples = - inlink->min_samples = - inlink->max_samples = subframe_length; + filterlink(inlink)->min_samples = + filterlink(inlink)->max_samples = subframe_length; s->frame_type = INNER_FRAME; break; @@ -741,8 +741,9 @@ static int config_input(AVFilterLink *inlink) init_gaussian_filter(s); if (s->frame_type != LINEAR_MODE) { - inlink->min_samples = - inlink->max_samples = frame_size(inlink->sample_rate, 3000); + FFFilterLink *const link = filterlink(inlink); + link->min_samples = + link->max_samples = frame_size(inlink->sample_rate, 3000); } s->pts = AV_NOPTS_VALUE; diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index e39efa5c41..fac3cae786 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -378,7 +378,7 @@ static int config_output(AVFilterLink *outlink) (lilv_plugin_has_feature(s->plugin, s->powerOf2BlockLength) || lilv_plugin_has_feature(s->plugin, s->fixedBlockLength) || lilv_plugin_has_feature(s->plugin, s->boundedBlockLength))) { - AVFilterLink *inlink = ctx->inputs[0]; + FFFilterLink *const inlink = filterlink(ctx->inputs[0]); inlink->min_samples = inlink->max_samples = 4096; } diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c index fd642297f8..8cd225242d 100644 --- a/libavfilter/af_replaygain.c +++ b/libavfilter/af_replaygain.c @@ -359,8 +359,8 @@ static int config_input(AVFilterLink *inlink) s->yule_hist_i = 20; s->butter_hist_i = 4; - inlink->min_samples = - inlink->max_samples = inlink->sample_rate / 20; + filterlink(inlink)->min_samples = + filterlink(inlink)->max_samples = inlink->sample_rate / 20; return 0; } diff --git a/libavfilter/audio.c b/libavfilter/audio.c index 0deed5683b..29ac54f824 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -36,16 +36,18 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples) return ff_get_audio_buffer(link->dst->outputs[0], nb_samples); } -AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) +AVFrame *ff_default_get_audio_buffer(AVFilterLink *avlink, int nb_samples) { + FFFilterLink *const link = filterlink(avlink); AVFrame *frame = NULL; - int channels = link->channels; + int channels = link->pub.channels; + int layout_nb_channels = av_get_channel_layout_nb_channels(link->pub.channel_layout); - av_assert0(channels == av_get_channel_layout_nb_channels(link->channel_layout) || !av_get_channel_layout_nb_channels(link->channel_layout)); + av_assert0(channels == layout_nb_channels || !layout_nb_channels); if (!link->frame_pool) { link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, BUFFER_ALIGN); + nb_samples, link->pub.format, BUFFER_ALIGN); if (!link->frame_pool) return NULL; } else { @@ -61,11 +63,11 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) } if (pool_channels != channels || pool_nb_samples < nb_samples || - pool_format != link->format || pool_align != BUFFER_ALIGN) { + pool_format != link->pub.format || pool_align != BUFFER_ALIGN) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); + ff_frame_pool_uninit(&link->frame_pool); link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, BUFFER_ALIGN); + nb_samples, link->pub.format, BUFFER_ALIGN); if (!link->frame_pool) return NULL; } @@ -76,10 +78,11 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) return NULL; frame->nb_samples = nb_samples; - frame->channel_layout = link->channel_layout; - frame->sample_rate = link->sample_rate; + frame->channel_layout = link->pub.channel_layout; + frame->sample_rate = link->pub.sample_rate; - av_samples_set_silence(frame->extended_data, 0, nb_samples, channels, link->format); + av_samples_set_silence(frame->extended_data, 0, nb_samples, + channels, link->pub.format); return frame; } diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c index a31805f204..db9aa007fe 100644 --- a/libavfilter/avf_aphasemeter.c +++ b/libavfilter/avf_aphasemeter.c @@ -130,9 +130,9 @@ static int config_input(AVFilterLink *inlink) s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); if (s->do_video) { + FFFilterLink *const link = filterlink(inlink); nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num)); - inlink->min_samples = - inlink->max_samples = nb_samples; + link->min_samples = link->max_samples = nb_samples; } return 0; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ef049fe9b6..0c8de5c5fe 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -34,7 +34,6 @@ #include "libavutil/samplefmt.h" #include "libavutil/thread.h" -#define FF_INTERNAL_FIELDS 1 #include "framequeue.h" #include "audio.h" @@ -47,8 +46,6 @@ #include "libavutil/ffversion.h" const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -static void update_link_current_pts(AVFilterLink *link, int64_t pts); - void ff_tlog_ref(void *ctx, AVFrame *ref, int end) { av_unused char buf[16]; @@ -94,6 +91,17 @@ const char *avfilter_license(void) return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1]; } +static void update_link_current_pts(FFFilterLink *link, int64_t pts) +{ + if (pts == AV_NOPTS_VALUE) + return; + link->current_pts = pts; + link->current_pts_us = av_rescale_q(pts, link->pub.time_base, AV_TIME_BASE_Q); + /* TODO use duration */ + if (link->graph && link->age_index >= 0) + ff_avfilter_graph_update_heap(link->graph, link); +} + void ff_command_queue_pop(AVFilterContext *filter) { AVFilterCommand *c= filter->command_queue; @@ -138,6 +146,7 @@ int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { + FFFilterLink *fflink; AVFilterLink *link; av_assert0(src->graph); @@ -156,9 +165,10 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, return AVERROR(EINVAL); } - link = av_mallocz(sizeof(*link)); - if (!link) + fflink = av_mallocz(sizeof(*fflink)); + if (!fflink) return AVERROR(ENOMEM); + link = &fflink->pub; src->outputs[srcpad] = dst->inputs[dstpad] = link; @@ -169,20 +179,22 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, link->type = src->output_pads[srcpad].type; av_assert0(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; - ff_framequeue_init(&link->fifo, &filtergraph(src->graph)->frame_queues); + ff_framequeue_init(&fflink->fifo, &filtergraph(src->graph)->frame_queues); return 0; } -void avfilter_link_free(AVFilterLink **link) +void avfilter_link_free(AVFilterLink **linkp) { - if (!*link) + FFFilterLink *link = filterlink(*linkp); + + if (!link) return; - ff_framequeue_free(&(*link)->fifo); - ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool); + ff_framequeue_free(&link->fifo); + ff_frame_pool_uninit(&link->frame_pool); - av_freep(link); + av_freep(linkp); } void ff_filter_set_ready(AVFilterContext *filter, unsigned priority) @@ -199,12 +211,13 @@ static void filter_unblock(AVFilterContext *filter) unsigned i; for (i = 0; i < filter->nb_outputs; i++) - filter->outputs[i]->frame_blocked_in = 0; + filterlink(filter->outputs[i])->frame_blocked_in = 0; } -void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts) +void ff_avfilter_link_set_in_status(AVFilterLink *avlink, int status, int64_t pts) { + FFFilterLink *const link = filterlink(avlink); if (link->status_in == status) return; av_assert0(!link->status_in); @@ -212,19 +225,20 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts) link->status_in_pts = pts; link->frame_wanted_out = 0; link->frame_blocked_in = 0; - filter_unblock(link->dst); - ff_filter_set_ready(link->dst, 200); + filter_unblock(link->pub.dst); + ff_filter_set_ready(link->pub.dst, 200); } -void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts) +void ff_avfilter_link_set_out_status(AVFilterLink *avlink, int status, int64_t pts) { + FFFilterLink *const link = filterlink(avlink); av_assert0(!link->frame_wanted_out); av_assert0(!link->status_out); link->status_out = status; if (pts != AV_NOPTS_VALUE) update_link_current_pts(link, pts); - filter_unblock(link->dst); - ff_filter_set_ready(link->src, 200); + filter_unblock(link->pub.dst); + ff_filter_set_ready(link->pub.src, 200); } int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, @@ -272,6 +286,7 @@ int avfilter_config_links(AVFilterContext *filter) for (i = 0; i < filter->nb_inputs; i ++) { AVFilterLink *link = filter->inputs[i]; + FFFilterLink *const fflink = filterlink(link); AVFilterLink *inlink; if (!link) continue; @@ -282,17 +297,17 @@ int avfilter_config_links(AVFilterContext *filter) } inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL; - link->current_pts = - link->current_pts_us = AV_NOPTS_VALUE; + fflink->current_pts = + fflink->current_pts_us = AV_NOPTS_VALUE; - switch (link->init_state) { + switch (fflink->init_state) { case AVLINK_INIT: continue; case AVLINK_STARTINIT: av_log(filter, AV_LOG_INFO, "circular filter chain detected\n"); return 0; case AVLINK_UNINIT: - link->init_state = AVLINK_STARTINIT; + fflink->init_state = AVLINK_STARTINIT; if ((ret = avfilter_config_links(link->src)) < 0) return ret; @@ -363,7 +378,7 @@ int avfilter_config_links(AVFilterContext *filter) return ret; } - link->init_state = AVLINK_INIT; + fflink->init_state = AVLINK_INIT; } } @@ -394,62 +409,66 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end) } } -int ff_request_frame(AVFilterLink *link) +int ff_request_frame(AVFilterLink *avlink) { - FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); + FFFilterLink *const link = filterlink(avlink); + + FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, &link->pub, 1); - av_assert1(!link->dst->filter->activate); + av_assert1(!link->pub.dst->filter->activate); if (link->status_out) return link->status_out; if (link->status_in) { if (ff_framequeue_queued_frames(&link->fifo)) { av_assert1(!link->frame_wanted_out); - av_assert1(link->dst->ready >= 300); + av_assert1(link->pub.dst->ready >= 300); return 0; } else { /* Acknowledge status change. Filters using ff_request_frame() will handle the change automatically. Filters can also check the status directly but none do yet. */ - ff_avfilter_link_set_out_status(link, link->status_in, link->status_in_pts); + ff_avfilter_link_set_out_status(&link->pub, link->status_in, link->status_in_pts); return link->status_out; } } link->frame_wanted_out = 1; - ff_filter_set_ready(link->src, 100); + ff_filter_set_ready(link->pub.src, 100); return 0; } static int64_t guess_status_pts(AVFilterContext *ctx, int status, AVRational link_time_base) { + FFFilterLink **inputs = (FFFilterLink**)ctx->inputs; unsigned i; int64_t r = INT64_MAX; for (i = 0; i < ctx->nb_inputs; i++) - if (ctx->inputs[i]->status_out == status) - r = FFMIN(r, av_rescale_q(ctx->inputs[i]->current_pts, ctx->inputs[i]->time_base, link_time_base)); + if (inputs[i]->status_out == status) + r = FFMIN(r, av_rescale_q(inputs[i]->current_pts, inputs[i]->pub.time_base, link_time_base)); if (r < INT64_MAX) return r; av_log(ctx, AV_LOG_WARNING, "EOF timestamp not reliable\n"); for (i = 0; i < ctx->nb_inputs; i++) - r = FFMIN(r, av_rescale_q(ctx->inputs[i]->status_in_pts, ctx->inputs[i]->time_base, link_time_base)); + r = FFMIN(r, av_rescale_q(inputs[i]->status_in_pts, inputs[i]->pub.time_base, link_time_base)); if (r < INT64_MAX) return r; return AV_NOPTS_VALUE; } -static int ff_request_frame_to_filter(AVFilterLink *link) +static int request_frame_to_filter(FFFilterLink *fflink) { + AVFilterLink *const link = &fflink->pub; int ret = -1; FF_TPRINTF_START(NULL, request_frame_to_filter); ff_tlog_link(NULL, link, 1); /* Assume the filter is blocked, let the method clear it if not */ - link->frame_blocked_in = 1; + fflink->frame_blocked_in = 1; if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) ret = ff_request_frame(link->src->inputs[0]); if (ret < 0) { - if (ret != AVERROR(EAGAIN) && ret != link->status_in) + if (ret != AVERROR(EAGAIN) && ret != fflink->status_in) ff_avfilter_link_set_in_status(link, ret, guess_status_pts(link->src, ret, link->time_base)); if (ret == AVERROR_EOF) ret = 0; @@ -515,17 +534,6 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr) return 0; } -static void update_link_current_pts(AVFilterLink *link, int64_t pts) -{ - if (pts == AV_NOPTS_VALUE) - return; - link->current_pts = pts; - link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q); - /* TODO use duration */ - if (link->graph && link->age_index >= 0) - ff_avfilter_graph_update_heap(link->graph, link); -} - int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags) { if(!strcmp(cmd, "ping")){ @@ -947,9 +955,10 @@ static int default_filter_frame(AVFilterLink *link, AVFrame *frame) return ff_filter_frame(link->dst->outputs[0], frame); } -static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) +static int filter_frame_framed(FFFilterLink *fflink, AVFrame *frame) { int (*filter_frame)(AVFilterLink *, AVFrame *); + AVFilterLink *const link = &fflink->pub; AVFilterContext *dstctx = link->dst; AVFilterPad *dst = link->dstpad; int ret; @@ -980,6 +989,7 @@ fail: int ff_filter_frame(AVFilterLink *link, AVFrame *frame) { + FFFilterLink *const fflink = filterlink(link); int ret; FF_TPRINTF_START(NULL, filter_frame); ff_tlog_link(NULL, link, 1); ff_tlog(NULL, " "); ff_tlog_ref(NULL, frame, 1); @@ -1013,11 +1023,11 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) } } - link->frame_blocked_in = link->frame_wanted_out = 0; + fflink->frame_blocked_in = fflink->frame_wanted_out = 0; link->frame_count_in++; - link->sample_count_in += frame->nb_samples; + fflink->sample_count_in += frame->nb_samples; filter_unblock(link->dst); - ret = ff_framequeue_add(&link->fifo, frame); + ret = ff_framequeue_add(&fflink->fifo, frame); if (ret < 0) { av_frame_free(&frame); return ret; @@ -1030,14 +1040,14 @@ error: return AVERROR_PATCHWELCOME; } -static int samples_ready(AVFilterLink *link, unsigned min) +static int samples_ready(FFFilterLink *link, unsigned min) { return ff_framequeue_queued_frames(&link->fifo) && (ff_framequeue_queued_samples(&link->fifo) >= min || link->status_in); } -static int take_samples(AVFilterLink *link, unsigned min, unsigned max, +static int take_samples(FFFilterLink *link, unsigned min, unsigned max, AVFrame **rframe) { AVFrame *frame0, *frame, *buf; @@ -1067,7 +1077,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, frame = ff_framequeue_peek(&link->fifo, nb_frames); } - buf = ff_get_audio_buffer(link, nb_samples); + buf = ff_get_audio_buffer(&link->pub, nb_samples); if (!buf) return AVERROR(ENOMEM); ret = av_frame_copy_props(buf, frame0); @@ -1081,7 +1091,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, for (i = 0; i < nb_frames; i++) { frame = ff_framequeue_take(&link->fifo); av_samples_copy(buf->extended_data, frame->extended_data, p, 0, - frame->nb_samples, link->channels, link->format); + frame->nb_samples, link->pub.channels, link->pub.format); p += frame->nb_samples; av_frame_free(&frame); } @@ -1089,24 +1099,24 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, unsigned n = nb_samples - p; frame = ff_framequeue_peek(&link->fifo, 0); av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n, - link->channels, link->format); - ff_framequeue_skip_samples(&link->fifo, n, link->time_base); + link->pub.channels, link->pub.format); + ff_framequeue_skip_samples(&link->fifo, n, link->pub.time_base); } *rframe = buf; return 0; } -static int ff_filter_frame_to_filter(AVFilterLink *link) +static int filter_frame_to_filter(FFFilterLink *link) { AVFrame *frame = NULL; - AVFilterContext *dst = link->dst; + AVFilterContext *dst = link->pub.dst; int ret; av_assert1(ff_framequeue_queued_frames(&link->fifo)); ret = link->min_samples ? - ff_inlink_consume_samples(link, link->min_samples, link->max_samples, &frame) : - ff_inlink_consume_frame(link, &frame); + ff_inlink_consume_samples(&link->pub, link->min_samples, link->max_samples, &frame) : + ff_inlink_consume_frame(&link->pub, &frame); av_assert1(ret); if (ret < 0) { av_assert1(!frame); @@ -1116,11 +1126,11 @@ static int ff_filter_frame_to_filter(AVFilterLink *link) produce one or more: unblock its outputs. */ filter_unblock(dst); /* AVFilterPad.filter_frame() expect frame_count_out to have the value - before the frame; ff_filter_frame_framed() will re-increment it. */ - link->frame_count_out--; - ret = ff_filter_frame_framed(link, frame); + before the frame; filter_frame_framed() will re-increment it. */ + link->pub.frame_count_out--; + ret = filter_frame_framed(link, frame); if (ret < 0 && ret != link->status_out) { - ff_avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE); + ff_avfilter_link_set_out_status(&link->pub, ret, AV_NOPTS_VALUE); } else { /* Run once again, to see if several frames were available, or if the input status has also changed, or any other reason. */ @@ -1129,7 +1139,7 @@ static int ff_filter_frame_to_filter(AVFilterLink *link) return ret; } -static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) +static int forward_status_change(AVFilterContext *filter, FFFilterLink *in) { unsigned out = 0, progress = 0; int ret; @@ -1140,9 +1150,10 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) return 0; } while (!in->status_out) { - if (!filter->outputs[out]->status_in) { + FFFilterLink *const *const outputs = (FFFilterLink**)filter->outputs; + if (!outputs[out]->status_in) { progress++; - ret = ff_request_frame_to_filter(filter->outputs[out]); + ret = request_frame_to_filter(outputs[out]); if (ret < 0) return ret; } @@ -1150,7 +1161,7 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) if (!progress) { /* Every output already closed: input no longer interesting (example: overlay in shortest mode, other input closed). */ - ff_avfilter_link_set_out_status(in, in->status_in, in->status_in_pts); + ff_avfilter_link_set_out_status(&in->pub, in->status_in, in->status_in_pts); return 0; } progress = 0; @@ -1163,23 +1174,25 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) static int ff_filter_activate_default(AVFilterContext *filter) { + FFFilterLink **links = (FFFilterLink**)filter->inputs; unsigned i; for (i = 0; i < filter->nb_inputs; i++) { - if (samples_ready(filter->inputs[i], filter->inputs[i]->min_samples)) { - return ff_filter_frame_to_filter(filter->inputs[i]); + if (samples_ready(links[i], links[i]->min_samples)) { + return filter_frame_to_filter(links[i]); } } for (i = 0; i < filter->nb_inputs; i++) { - if (filter->inputs[i]->status_in && !filter->inputs[i]->status_out) { - av_assert1(!ff_framequeue_queued_frames(&filter->inputs[i]->fifo)); - return forward_status_change(filter, filter->inputs[i]); + if (links[i]->status_in && !links[i]->status_out) { + av_assert1(!ff_framequeue_queued_frames(&links[i]->fifo)); + return forward_status_change(filter, links[i]); } } + links = (FFFilterLink**)filter->outputs; for (i = 0; i < filter->nb_outputs; i++) { - if (filter->outputs[i]->frame_wanted_out && - !filter->outputs[i]->frame_blocked_in) { - return ff_request_frame_to_filter(filter->outputs[i]); + if (links[i]->frame_wanted_out && + !links[i]->frame_blocked_in) { + return request_frame_to_filter(links[i]); } } return FFERROR_NOT_READY; @@ -1332,8 +1345,9 @@ int ff_filter_activate(AVFilterContext *filter) return ret; } -int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts) +int ff_inlink_acknowledge_status(AVFilterLink *avlink, int *rstatus, int64_t *rpts) { + FFFilterLink *const link = filterlink(avlink); *rpts = link->current_pts; if (ff_framequeue_queued_frames(&link->fifo)) return *rstatus = 0; @@ -1349,46 +1363,48 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts size_t ff_inlink_queued_frames(AVFilterLink *link) { - return ff_framequeue_queued_frames(&link->fifo); + return ff_framequeue_queued_frames(&filterlink(link)->fifo); } int ff_inlink_check_available_frame(AVFilterLink *link) { - return ff_framequeue_queued_frames(&link->fifo) > 0; + return ff_framequeue_queued_frames(&filterlink(link)->fifo) > 0; } int ff_inlink_queued_samples(AVFilterLink *link) { - return ff_framequeue_queued_samples(&link->fifo); + return ff_framequeue_queued_samples(&filterlink(link)->fifo); } -int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min) +int ff_inlink_check_available_samples(AVFilterLink *avlink, unsigned min) { + FFFilterLink *const link = filterlink(avlink); uint64_t samples = ff_framequeue_queued_samples(&link->fifo); av_assert1(min); return samples >= min || (link->status_in && samples); } -static void consume_update(AVFilterLink *link, const AVFrame *frame) +static void consume_update(FFFilterLink *link, const AVFrame *frame) { update_link_current_pts(link, frame->pts); - ff_inlink_process_commands(link, frame); - link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); - link->frame_count_out++; + ff_inlink_process_commands(&link->pub, frame); + link->pub.dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(&link->pub, frame); + link->pub.frame_count_out++; link->sample_count_out += frame->nb_samples; } -int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe) +int ff_inlink_consume_frame(AVFilterLink *avlink, AVFrame **rframe) { + FFFilterLink *const link = filterlink(avlink); AVFrame *frame; *rframe = NULL; - if (!ff_inlink_check_available_frame(link)) + if (!ff_inlink_check_available_frame(&link->pub)) return 0; if (link->fifo.samples_skipped) { frame = ff_framequeue_peek(&link->fifo, 0); - return ff_inlink_consume_samples(link, frame->nb_samples, frame->nb_samples, rframe); + return ff_inlink_consume_samples(&link->pub, frame->nb_samples, frame->nb_samples, rframe); } frame = ff_framequeue_take(&link->fifo); @@ -1397,15 +1413,16 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe) return 1; } -int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, +int ff_inlink_consume_samples(AVFilterLink *avlink, unsigned min, unsigned max, AVFrame **rframe) { + FFFilterLink *const link = filterlink(avlink); AVFrame *frame; int ret; av_assert1(min); *rframe = NULL; - if (!ff_inlink_check_available_samples(link, min)) + if (!ff_inlink_check_available_samples(&link->pub, min)) return 0; if (link->status_in) min = FFMIN(min, ff_framequeue_queued_samples(&link->fifo)); @@ -1419,7 +1436,7 @@ int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx) { - return ff_framequeue_peek(&link->fifo, idx); + return ff_framequeue_peek(&filterlink(link)->fifo, idx); } int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe) @@ -1495,21 +1512,23 @@ int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *fram return fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) >= 0.5; } -void ff_inlink_request_frame(AVFilterLink *link) +void ff_inlink_request_frame(AVFilterLink *avlink) { + FFFilterLink *const link = filterlink(avlink); av_assert1(!link->status_in); av_assert1(!link->status_out); link->frame_wanted_out = 1; - ff_filter_set_ready(link->src, 100); + ff_filter_set_ready(link->pub.src, 100); } -void ff_inlink_set_status(AVFilterLink *link, int status) +void ff_inlink_set_status(AVFilterLink *avlink, int status) { + FFFilterLink *const link = filterlink(avlink); if (link->status_out) return; link->frame_wanted_out = 0; link->frame_blocked_in = 0; - ff_avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE); + ff_avfilter_link_set_out_status(&link->pub, status, AV_NOPTS_VALUE); while (ff_framequeue_queued_frames(&link->fifo)) { AVFrame *frame = ff_framequeue_take(&link->fifo); av_frame_free(&frame); @@ -1520,7 +1539,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status) int ff_outlink_get_status(AVFilterLink *link) { - return link->status_in; + return filterlink(link)->status_in; } const AVClass *avfilter_get_class(void) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 26a849f955..61b689e19c 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -499,35 +499,6 @@ struct AVFilterLink { */ AVFilterFormatsConfig outcfg; - /** stage of the initialization of the link properties (dimensions, etc) */ - enum { - AVLINK_UNINIT = 0, ///< not started - AVLINK_STARTINIT, ///< started, but incomplete - AVLINK_INIT ///< complete - } init_state; - - /** - * Graph the filter belongs to. - */ - struct AVFilterGraph *graph; - - /** - * Current timestamp of the link, as defined by the most recent - * frame(s), in link time_base units. - */ - int64_t current_pts; - - /** - * Current timestamp of the link, as defined by the most recent - * frame(s), in AV_TIME_BASE units. - */ - int64_t current_pts_us; - - /** - * Index in the age array. - */ - int age_index; - /** * Frame rate of the stream on the link, or 1/0 if unknown or variable; * if left to 0/0, will be automatically copied from the first input @@ -541,21 +512,6 @@ struct AVFilterLink { */ AVRational frame_rate; - /** - * Minimum number of samples to filter at once. If filter_frame() is - * called with fewer samples, it will accumulate them in fifo. - * This field and the related ones must not be changed after filtering - * has started. - * If 0, all related fields are ignored. - */ - int min_samples; - - /** - * Maximum number of samples to filter at once. If filter_frame() is - * called with more samples, it will split them. - */ - int max_samples; - /** * Number of channels. */ @@ -566,73 +522,11 @@ struct AVFilterLink { */ int64_t frame_count_in, frame_count_out; - /** - * Number of past samples sent through the link. - */ - int64_t sample_count_in, sample_count_out; - - /** - * A pointer to a FFFramePool struct. - */ - void *frame_pool; - - /** - * True if a frame is currently wanted on the output of this filter. - * Set when ff_request_frame() is called by the output, - * cleared when a frame is filtered. - */ - int frame_wanted_out; - /** * For hwaccel pixel formats, this should be a reference to the * AVHWFramesContext describing the frames. */ AVBufferRef *hw_frames_ctx; - -#ifndef FF_INTERNAL_FIELDS - - /** - * Internal structure members. - * The fields below this limit are internal for libavfilter's use - * and must in no way be accessed by applications. - */ - char reserved[0xF000]; - -#else /* FF_INTERNAL_FIELDS */ - - /** - * Queue of frames waiting to be filtered. - */ - FFFrameQueue fifo; - - /** - * If set, the source filter can not generate a frame as is. - * The goal is to avoid repeatedly calling the request_frame() method on - * the same link. - */ - int frame_blocked_in; - - /** - * Link input status. - * If not zero, all attempts of filter_frame will fail with the - * corresponding code. - */ - int status_in; - - /** - * Timestamp of the input status change. - */ - int64_t status_in_pts; - - /** - * Link output status. - * If not zero, all attempts of request_frame will fail with the - * corresponding code. - */ - int status_out; - -#endif /* FF_INTERNAL_FIELDS */ - }; /** diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index f8a2426c46..812d6c71bb 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -33,7 +33,6 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" -#define FF_INTERNAL_FIELDS 1 #include "framequeue.h" #include "avfilter.h" @@ -104,7 +103,7 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter filter->graph = NULL; for (j = 0; jnb_outputs; j++) if (filter->outputs[j]) - filter->outputs[j]->graph = NULL; + filterlink(filter->outputs[j])->graph = NULL; return; } @@ -1166,18 +1165,21 @@ static int graph_config_pointers(AVFilterGraph *graph, { unsigned i, j; int sink_links_count = 0, n = 0; - AVFilterContext *f; AVFilterLink **sinks; for (i = 0; i < graph->nb_filters; i++) { - f = graph->filters[i]; + AVFilterContext *const f = graph->filters[i]; + FFFilterLink **links; + + links = (FFFilterLink**)f->inputs; for (j = 0; j < f->nb_inputs; j++) { - f->inputs[j]->graph = graph; - f->inputs[j]->age_index = -1; + links[j]->graph = graph; + links[j]->age_index = -1; } + links = (FFFilterLink**)f->outputs; for (j = 0; j < f->nb_outputs; j++) { - f->outputs[j]->graph = graph; - f->outputs[j]->age_index= -1; + links[j]->graph = graph; + links[j]->age_index= -1; } if (!f->nb_outputs) { if (f->nb_inputs > INT_MAX - sink_links_count) @@ -1189,11 +1191,11 @@ static int graph_config_pointers(AVFilterGraph *graph, if (!sinks) return AVERROR(ENOMEM); for (i = 0; i < graph->nb_filters; i++) { - f = graph->filters[i]; + AVFilterContext *const f = graph->filters[i]; if (!f->nb_outputs) { for (j = 0; j < f->nb_inputs; j++) { sinks[n] = f->inputs[j]; - f->inputs[j]->age_index = n++; + filterlink(f->inputs[j])->age_index = n++; } } } @@ -1283,9 +1285,9 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const } static void heap_bubble_up(AVFilterGraph *graph, - AVFilterLink *link, int index) + FFFilterLink *link, int index) { - AVFilterLink **links = graph->sink_links; + FFFilterLink **links = (FFFilterLink**)graph->sink_links; av_assert0(index >= 0); @@ -1302,9 +1304,9 @@ static void heap_bubble_up(AVFilterGraph *graph, } static void heap_bubble_down(AVFilterGraph *graph, - AVFilterLink *link, int index) + FFFilterLink *link, int index) { - AVFilterLink **links = graph->sink_links; + FFFilterLink **links = (FFFilterLink**)graph->sink_links; av_assert0(index >= 0); @@ -1325,7 +1327,7 @@ static void heap_bubble_down(AVFilterGraph *graph, link->age_index = index; } -void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link) +void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FFFilterLink *link) { heap_bubble_up (graph, link, link->age_index); heap_bubble_down(graph, link, link->age_index); @@ -1333,43 +1335,43 @@ void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link) int avfilter_graph_request_oldest(AVFilterGraph *graph) { - AVFilterLink *oldest = graph->sink_links[0]; + FFFilterLink *oldest = filterlink(graph->sink_links[0]); int64_t frame_count; int r; while (graph->sink_links_count) { - oldest = graph->sink_links[0]; - if (oldest->dst->filter->activate) { + oldest = filterlink(graph->sink_links[0]); + if (oldest->pub.dst->filter->activate) { /* For now, buffersink is the only filter implementing activate. */ - r = av_buffersink_get_frame_flags(oldest->dst, NULL, + r = av_buffersink_get_frame_flags(oldest->pub.dst, NULL, AV_BUFFERSINK_FLAG_PEEK); if (r != AVERROR_EOF) return r; } else { - r = ff_request_frame(oldest); + r = ff_request_frame(&oldest->pub); } if (r != AVERROR_EOF) break; - av_log(oldest->dst, AV_LOG_DEBUG, "EOF on sink link %s:%s.\n", - oldest->dst->name, - oldest->dstpad->name); + av_log(oldest->pub.dst, AV_LOG_DEBUG, "EOF on sink link %s:%s.\n", + oldest->pub.dst->name, + oldest->pub.dstpad->name); /* EOF: remove the link from the heap */ if (oldest->age_index < --graph->sink_links_count) - heap_bubble_down(graph, graph->sink_links[graph->sink_links_count], + heap_bubble_down(graph, filterlink(graph->sink_links[graph->sink_links_count]), oldest->age_index); oldest->age_index = -1; } if (!graph->sink_links_count) return AVERROR_EOF; - av_assert1(!oldest->dst->filter->activate); + av_assert1(!oldest->pub.dst->filter->activate); av_assert1(oldest->age_index >= 0); - frame_count = oldest->frame_count_out; - while (frame_count == oldest->frame_count_out) { + frame_count = oldest->pub.frame_count_out; + while (frame_count == oldest->pub.frame_count_out) { r = ff_filter_graph_run_once(graph); if (r == AVERROR(EAGAIN) && !oldest->frame_wanted_out && !oldest->frame_blocked_in && !oldest->status_in) - ff_request_frame(oldest); + ff_request_frame(&oldest->pub); else if (r < 0) return r; } diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 07c4812f29..678999553e 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -29,7 +29,6 @@ #include "libavutil/internal.h" #include "libavutil/opt.h" -#define FF_INTERNAL_FIELDS 1 #include "framequeue.h" #include "audio.h" @@ -127,7 +126,7 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i return status; } else if ((flags & AV_BUFFERSINK_FLAG_NO_REQUEST)) { return AVERROR(EAGAIN); - } else if (inlink->frame_wanted_out) { + } else if (filterlink(inlink)->frame_wanted_out) { ret = ff_filter_graph_run_once(ctx->graph); if (ret < 0) return ret; @@ -139,7 +138,7 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags) { - return get_frame_internal(ctx, frame, flags, ctx->inputs[0]->min_samples); + return get_frame_internal(ctx, frame, flags, filterlink(ctx->inputs[0])->min_samples); } int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, @@ -183,7 +182,7 @@ static int activate(AVFilterContext *ctx) BufferSinkContext *buf = ctx->priv; if (buf->warning_limit && - ff_framequeue_queued_frames(&ctx->inputs[0]->fifo) >= buf->warning_limit) { + ff_framequeue_queued_frames(&filterlink(ctx->inputs[0])->fifo) >= buf->warning_limit) { av_log(ctx, AV_LOG_WARNING, "%d buffers queued in %s, something may be wrong.\n", buf->warning_limit, @@ -197,7 +196,7 @@ static int activate(AVFilterContext *ctx) void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size) { - AVFilterLink *inlink = ctx->inputs[0]; + FFFilterLink *inlink = filterlink(ctx->inputs[0]); inlink->min_samples = inlink->max_samples = frame_size; } diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 47ea9b59d7..ca1ad4de63 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -412,8 +412,8 @@ static int config_audio_input(AVFilterLink *inlink) * can be more complex to integrate in the one-sample loop of * filter_frame()). */ if (ebur128->metadata || (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS)) - inlink->min_samples = - inlink->max_samples = inlink->sample_rate / 10; + filterlink(inlink)->min_samples = + filterlink(inlink)->max_samples = inlink->sample_rate / 10; return 0; } diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c index 90e93a4ac3..b4c9ef27dc 100644 --- a/libavfilter/f_graphmonitor.c +++ b/libavfilter/f_graphmonitor.c @@ -178,6 +178,7 @@ static void draw_items(AVFilterContext *ctx, AVFrame *out, AVFilterLink *l, size_t frames) { + FFFilterLink *const link = filterlink(l); GraphMonitorContext *s = ctx->priv; char buffer[1024] = { 0 }; @@ -234,22 +235,26 @@ static void draw_items(AVFilterContext *ctx, AVFrame *out, xpos += strlen(buffer) * 8; } if (s->flags & MODE_SCIN) { - snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); + snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, + link->sample_count_in); drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; } if (s->flags & MODE_SCOUT) { - snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); + snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, + link->sample_count_out); drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; } if (s->flags & MODE_PTS) { - snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(l->current_pts_us)); + snprintf(buffer, sizeof(buffer)-1, " | pts: %s", + av_ts2str(link->current_pts_us)); drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; } if (s->flags & MODE_TIME) { - snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(l->current_pts_us, &AV_TIME_BASE_Q)); + snprintf(buffer, sizeof(buffer)-1, " | time: %s", + av_ts2timestr(link->current_pts_us, &AV_TIME_BASE_Q)); drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; } diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c index 71b0a5c411..4fdbc72745 100644 --- a/libavfilter/f_sendcmd.c +++ b/libavfilter/f_sendcmd.c @@ -548,7 +548,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref) av_log(ctx, AV_LOG_VERBOSE, "Processing command #%d target:%s command:%s arg:%s\n", cmd->index, cmd->target, cmd->command, cmd_arg); - ret = avfilter_graph_send_command(inlink->graph, + ret = avfilter_graph_send_command(filterlink(inlink)->graph, cmd->target, cmd->command, cmd_arg, buf, sizeof(buf), AVFILTER_CMD_FLAG_ONE); diff --git a/libavfilter/f_zmq.c b/libavfilter/f_zmq.c index 774a890871..1595d0e69c 100644 --- a/libavfilter/f_zmq.c +++ b/libavfilter/f_zmq.c @@ -174,7 +174,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref) av_log(ctx, AV_LOG_VERBOSE, "Processing command #%d target:%s command:%s arg:%s\n", zmq->command_count, cmd.target, cmd.command, cmd.arg); - ret = avfilter_graph_send_command(inlink->graph, + ret = avfilter_graph_send_command(filterlink(inlink)->graph, cmd.target, cmd.command, cmd.arg, cmd_buf, sizeof(cmd_buf), AVFILTER_CMD_FLAG_ONE); diff --git a/libavfilter/filters.h b/libavfilter/filters.h index 1157755403..5ca61ffefd 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -171,7 +171,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status); */ static inline int ff_outlink_frame_wanted(AVFilterLink *link) { - return link->frame_wanted_out; + return filterlink(link)->frame_wanted_out; } /** diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 505d2d4952..18b3b4b9bd 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -39,10 +39,118 @@ typedef struct AVFilterCommand { struct AVFilterCommand *next; } AVFilterCommand; +/** + * The real AVFilterLink. + * @todo move the other internal fields of AVFilterLink to this struct. + */ +typedef struct FFFilterLink { + /** + * The public AVFilterLink. + */ + AVFilterLink pub; + + /** + * Graph the filter belongs to. + */ + struct AVFilterGraph *graph; + + /** stage of the initialization of the link properties (dimensions, etc) */ + enum { + AVLINK_UNINIT = 0, ///< not started + AVLINK_STARTINIT, ///< started, but incomplete + AVLINK_INIT ///< complete + } init_state; + + /** + * Index in the age array. + */ + int age_index; + + /** + * Current timestamp of the link, as defined by the most recent + * frame(s), in link time_base units. + */ + int64_t current_pts; + + /** + * Current timestamp of the link, as defined by the most recent + * frame(s), in AV_TIME_BASE units. + */ + int64_t current_pts_us; + + /** + * Number of past samples sent through the link. + */ + int64_t sample_count_in, sample_count_out; + + /** + * Minimum number of samples to filter at once. If filter_frame() is + * called with fewer samples, it will accumulate them in fifo. + * This field and the related ones must not be changed after filtering + * has started. + * If 0, all related fields are ignored. + */ + int min_samples; + + /** + * Maximum number of samples to filter at once. If filter_frame() is + * called with more samples, it will split them. + */ + int max_samples; + + /** + * A pool of frames to allow reusing frame buffers. + */ + struct FFFramePool *frame_pool; + + /** + * Queue of frames waiting to be filtered. + */ + FFFrameQueue fifo; + + /** + * If set, the source filter can not generate a frame as is. + * The goal is to avoid repeatedly calling the request_frame() method on + * the same link. + */ + int frame_blocked_in; + + /** + * Link input status. + * If not zero, all attempts of filter_frame will fail with the + * corresponding code. + */ + int status_in; + + /** + * Timestamp of the input status change. + */ + int64_t status_in_pts; + + /** + * True if a frame is currently wanted on the output of this filter. + * Set when ff_request_frame() is called by the output, + * cleared when a frame is filtered. + */ + int frame_wanted_out; + + /** + * Link output status. + * If not zero, all attempts of request_frame will fail with the + * corresponding code. + */ + int status_out; +} FFFilterLink; + +static av_always_inline FFFilterLink *filterlink(AVFilterLink *link) +{ + return (FFFilterLink*)link; +} + /** * Update the position of a link in the age heap. */ -void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link); +void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FFFilterLink *link); /** * A filter pad used for either input or output. diff --git a/libavfilter/tests/filtfmts.c b/libavfilter/tests/filtfmts.c index 356f467331..5cc899ddf8 100644 --- a/libavfilter/tests/filtfmts.c +++ b/libavfilter/tests/filtfmts.c @@ -25,7 +25,6 @@ #include "libavutil/pixdesc.h" #include "libavutil/samplefmt.h" -#define FF_INTERNAL_FIELDS 1 #include "libavfilter/framequeue.h" #include "libavfilter/avfilter.h" @@ -117,7 +116,7 @@ int main(int argc, char **argv) /* create a link for each of the input pads */ for (i = 0; i < filter_ctx->nb_inputs; i++) { - AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); + AVFilterLink *link = av_mallocz(sizeof(FFFilterLink)); if (!link) { fprintf(stderr, "Unable to allocate memory for filter input link\n"); ret = 1; @@ -127,7 +126,7 @@ int main(int argc, char **argv) filter_ctx->inputs[i] = link; } for (i = 0; i < filter_ctx->nb_outputs; i++) { - AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); + AVFilterLink *link = av_mallocz(sizeof(FFFilterLink)); if (!link) { fprintf(stderr, "Unable to allocate memory for filter output link\n"); ret = 1; diff --git a/libavfilter/video.c b/libavfilter/video.c index 810cc87f52..60f0e3fb48 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -40,23 +40,24 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h) return ff_get_video_buffer(link->dst->outputs[0], w, h); } -AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) +AVFrame *ff_default_get_video_buffer(AVFilterLink *avlink, int w, int h) { + FFFilterLink *const link = filterlink(avlink); AVFrame *frame = NULL; int pool_width = 0; int pool_height = 0; int pool_align = 0; enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; - if (link->hw_frames_ctx && - ((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { + if (avlink->hw_frames_ctx && + ((AVHWFramesContext*)avlink->hw_frames_ctx->data)->format == avlink->format) { int ret; AVFrame *frame = av_frame_alloc(); if (!frame) return NULL; - ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); + ret = av_hwframe_get_buffer(avlink->hw_frames_ctx, frame, 0); if (ret < 0) av_frame_free(&frame); @@ -65,7 +66,7 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) if (!link->frame_pool) { link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, BUFFER_ALIGN); + avlink->format, BUFFER_ALIGN); if (!link->frame_pool) return NULL; } else { @@ -76,11 +77,11 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) } if (pool_width != w || pool_height != h || - pool_format != link->format || pool_align != BUFFER_ALIGN) { + pool_format != avlink->format || pool_align != BUFFER_ALIGN) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); + ff_frame_pool_uninit(&link->frame_pool); link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, BUFFER_ALIGN); + avlink->format, BUFFER_ALIGN); if (!link->frame_pool) return NULL; } @@ -90,7 +91,7 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) if (!frame) return NULL; - frame->sample_aspect_ratio = link->sample_aspect_ratio; + frame->sample_aspect_ratio = avlink->sample_aspect_ratio; return frame; }