From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 364EC48669 for ; Wed, 14 Feb 2024 17:24:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8A2668D226; Wed, 14 Feb 2024 19:24:18 +0200 (EET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AFB7F68D213 for ; Wed, 14 Feb 2024 19:24:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrgsPlCMVHbD7tQ79Cj6gyr7AlNiPthNi89GkifmWO5uS6nRMMzYuVGXNHkKFfrJCbSDBabhZeJhB9NVgrzgutFjBj02c4VhR/l3ve7mM5+qI++Y4h76jDS/vxbZm0bjjoGs4ppqWbf/HIvMcyS0IWLSl0+02IUjH//OdiBnUUo0XmumIjq36hGnFusY8/UHvP5Oh/dcwtY6sCIY1noRcuRkumIdZ4YeRC5wQjZShXvXN6NGYUbYdYRsUVh9bdTPOrj8Rdp2qZIsg+aU+V/Kyh31B4caXuEI52aQ1Bb++txxHn2GQPE4+rBiB/PjZ2I0e3RMQuqr6kVW0b7I4pfReg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZUjqTB9B/R+4lz2wB8qiFVE0dtThgbbmev0noFpYJFc=; b=FNQSLucOgznZNItYd5v0mb6IsQ0EEZYFGwxLkjEK+bS+MRR9ssTsEYafVCnq025nTRbKsikyGdCkL+BvDHVRI1bzZOwspBGya4/CJmZwOoFPA6vLEVFGJdtRoMH1vpD3hhlZwG7K2X7GZec5EfhFVT3KPYmozkBH2pmTu3uzEDLQYtok4gXmJQc6Iu/Io8uf2VQBh7gZuIrXhsOK665aoR/54ywIm2nKnV3isjW+pkqQXyIjyV5ggvkjhItSBJo0AuVoNHvnEqtWowS0IXfELkn0EegMU7hONatTA0M5nthXDiUuB71F5ss78jPOL2oMz3zaL2lUMZZuiy00VjVh+A== 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=ZUjqTB9B/R+4lz2wB8qiFVE0dtThgbbmev0noFpYJFc=; b=CIkj8ekA6BmgxaX0sbXMS2Q1EjvEbeDhmCVrdffDuwogpA6HDWWjmyOBTxagXuhyCq5GHPnnfdsB15noexNNKTuDxxeCeJ/JuNJ4JHuJhFGUoCbEofkOxWosB+PKuMz4W9Bnyz64cRJE+h8Gyo0rFUZUdRkLLVsZeg7PCA/mdyCYAC/VUVgy7zC/UmAosQ6cu4OQSYg00H606Po5geOE4LlJeO+1N9Ig8bZBFRYQ1xtUSuLpF9Egt2nQiHkDUAkuwWBncw1ee3WP12AES+YFd0oTDLeoZEBgXmOLR25gPTvwGmXDRycP2emPeM0cPtCl2ELXljz57E62NQqk7m1AUA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:57 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:56 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:37 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [SwcdsXtRiCaC+1U/T7glutnIEuMu93L9KQHRQERqvNA=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dc787bc-400f-4223-1694-08dc2d81b973 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: htbyp9nKVC7cx45VPKYJF4JUVpj1sP4cF2GJ7R8B5Et1FF/st3Jx5xjkPBuWsJXd47yz8tkL2iH+mWdpSKAk3615oAiIDSnv03rDK66HK5ySvAigvEVW1g2AZnS1B99BujwWYZnlZ9EricYcVNcLdk53Z/L2EnU0p5j1jXW7Ly39oxJ27skur9GfA9I0vNn38oHgZWRdsexCm2GXhBOhinyLS4TmCj55eR5PBPhTxrMN+t3Ig8E3rzwyNF54JnVguSJzQzYunJ7vVOCl/+TYUSnMGLgJzjq74CKlM5C0vvHR3Alc7sGRIUpEc0wxDgccO7uwD7G7IsBQp45gqBnzWZvzGsLyDPk+w1/CIyBiWqAAd1w2KxHYi0u/jRsFxRQ1Nk3o/iCI0bFvLwX047+G4O73wmiBCPOYEBqnG7mMGJfH/czYu27TNcrjiqK6matK3ytpyczzMG8ig6CebgR8bTcDCfYnjFY0ssFEZqiyyQM1ved0On5Bu0K03OnR5xYWeSsVxkhM+8U1tG9mFRlbjgXljrHPy0+ekDEYJLdHB2yPGCx6YkaeJcU18arQ8YciMd+ApO1JOxQbJOiYcwSiwkQb2rdnveciLrd8IhK3K1MAEzDA506Wu+weprgQnKET X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XljsUgaJu7Ge68Co7YV3iFExoLEKVyarkoPSSHSV+oll3w0esGojMuh0IaHr?= =?us-ascii?Q?pCpFA/g6SbPrqXrcPC8HZhlLPRdG5IePHbov/8XwrQUTcBm2qYRQLqqLr1t7?= =?us-ascii?Q?ATUJoqmzsqgQ3EsbZ/Q3lNlmR9ywLho3IIxH40tqOrpFtDa+3ZqnWBoKK5Ce?= =?us-ascii?Q?JjKnDUy3nJl8jbKqozQoeHaWI/T2lsnFzeg5r5YroE/mt3PgG9FGJUh+LAUo?= =?us-ascii?Q?HHLwc9V2sUm5iA4h/lknBA1y81MXfiHe1KDIXhilqDQSYtLw19DPjAwrp2ax?= =?us-ascii?Q?OC+NW+VGXSAKN5xQELaewS95yOu6lxAkLqQj7MrawKMDZrvpTfQS1pAOeJsQ?= =?us-ascii?Q?fjJW/pM58o+l4l3fKMCwgwVS3U16s0UfusswYxouHvJQI2kK71rPUSDXVISz?= =?us-ascii?Q?F40le3ufb2TOG33UO2hibK/zpsyxOsgK4SVni9ns+0Mkx9qjyLv8832E7NZ2?= =?us-ascii?Q?lF22preZu2Yquutl8OIe6f3EFHKzfVxNFuQBNrjBh3Wyx2el3KpSFU5yaAJM?= =?us-ascii?Q?wIq0O3TipwL982H7SVatgOLo0Nx4Lb8YLyX4loxzoYPr2KXYwwJX/3Qpxjah?= =?us-ascii?Q?kUvKOCX8j4qusNQNS7/MCYySnJZqZHnBiufT2J6R6+gaudLpa678pu5PoVK+?= =?us-ascii?Q?MMofA+My3XMeGu1J4ITzp/y/tGBX0rthag0zKWcnqTYa8dq8727MTFLfT7s6?= =?us-ascii?Q?L7Zoq9+acR9tbDO4tZZ4R2sBucpOfptT+K/iuHBXDZGr5ty/Oa8KLfuypEyq?= =?us-ascii?Q?h3ZxBZzSxrPTdUDBCZOMpf/uwQXhcrgcWehKHzHKM8mc1OT1gD9VwHjQd8W4?= =?us-ascii?Q?KKGPLNuE8uuiIQOV1KOFbgqlgay4it5sd7sbiSfafTS++hBVtG1DeEEGM3gq?= =?us-ascii?Q?NPlay2dv3G1x3L83zcQFVxFpyaj8WQeKA4aKOR6c3zIRc+NVKZhw2w6hLTvc?= =?us-ascii?Q?JOeu+SZIn0XJs/p7Kyt65si/zYVwE+NzghDr+S0YWLbGDE4KOpPP9Gb0CxSI?= =?us-ascii?Q?Co62mZDEKyMtEssTURNqOVUY/Zd0Ax2XL9e/VL+KFq9jZWrv7Kd78kgqerBH?= =?us-ascii?Q?eegiAHJ5E4n9sR8yMoJyvyXK6wkHLXeeh6BinMEG0hXv/c0Ieby2jJwJmEgL?= =?us-ascii?Q?FAlkwO4VF1xLBWk6v7RrubVqbyCJaFWAhyVo0YIfhY3FmfrzcOBdK7NyTynD?= =?us-ascii?Q?iIEuukb932AqL7uKAYkajNnZAgea3ZkHBO432a6h0QMHpvnFCA7IwJA2iXq2?= =?us-ascii?Q?E0AbWQCJIxb7kgHy67+ZwykhdqhBbC261s9eHND1WA=3D=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dc787bc-400f-4223-1694-08dc2d81b973 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:56.6990 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 8/8] avfilter/avfilter: Move frame_pool to FilterLinkInternal 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Avoids ugly casts when uninitializing. (One could actually avoid allocating this separately if one were willing to expose FFFramePool to those files including link_internal.h.) Signed-off-by: Andreas Rheinhardt --- libavfilter/audio.c | 22 ++++++++++++---------- libavfilter/avfilter.c | 2 +- libavfilter/avfilter.h | 5 ----- libavfilter/link_internal.h | 2 ++ libavfilter/video.c | 22 ++++++++++++---------- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libavfilter/audio.c b/libavfilter/audio.c index 35270c14d2..abcbaf7304 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -28,6 +28,7 @@ #include "avfilter.h" #include "framepool.h" #include "internal.h" +#include "link_internal.h" const AVFilterPad ff_audio_default_filterpad[1] = { { @@ -44,6 +45,7 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples) AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) { AVFrame *frame = NULL; + FilterLinkInternal *const li = ff_link_internal(link); int channels = link->ch_layout.nb_channels; int align = av_cpu_max_align(); #if FF_API_OLD_CHANNEL_LAYOUT @@ -54,10 +56,10 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - if (!link->frame_pool) { - link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); - if (!link->frame_pool) + if (!li->frame_pool) { + li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, + nb_samples, link->format, align); + if (!li->frame_pool) return NULL; } else { int pool_channels = 0; @@ -65,7 +67,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int pool_align = 0; enum AVSampleFormat pool_format = AV_SAMPLE_FMT_NONE; - if (ff_frame_pool_get_audio_config(link->frame_pool, + if (ff_frame_pool_get_audio_config(li->frame_pool, &pool_channels, &pool_nb_samples, &pool_format, &pool_align) < 0) { return NULL; @@ -74,15 +76,15 @@ FF_ENABLE_DEPRECATION_WARNINGS if (pool_channels != channels || pool_nb_samples < nb_samples || pool_format != link->format || pool_align != align) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); - link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); - if (!link->frame_pool) + ff_frame_pool_uninit(&li->frame_pool); + li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, + nb_samples, link->format, align); + if (!li->frame_pool) return NULL; } } - frame = ff_frame_pool_get(link->frame_pool); + frame = ff_frame_pool_get(li->frame_pool); if (!frame) return NULL; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 52ef5ca9a4..44185ff3e6 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -202,7 +202,7 @@ void avfilter_link_free(AVFilterLink **link) li = ff_link_internal(*link); ff_framequeue_free(&li->fifo); - ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool); + ff_frame_pool_uninit(&li->frame_pool); av_channel_layout_uninit(&(*link)->ch_layout); av_freep(link); diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 9252713ae2..5eff35b836 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -666,11 +666,6 @@ struct AVFilterLink { */ 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, diff --git a/libavfilter/link_internal.h b/libavfilter/link_internal.h index 57efd44a45..c01c15109e 100644 --- a/libavfilter/link_internal.h +++ b/libavfilter/link_internal.h @@ -29,6 +29,8 @@ typedef struct FilterLinkInternal { AVFilterLink l; + struct FFFramePool *frame_pool; + /** * Queue of frames waiting to be filtered. */ diff --git a/libavfilter/video.c b/libavfilter/video.c index 243762c8fd..22412244ad 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -31,6 +31,7 @@ #include "avfilter.h" #include "framepool.h" #include "internal.h" +#include "link_internal.h" #include "video.h" const AVFilterPad ff_video_default_filterpad[1] = { @@ -47,6 +48,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h) AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align) { + FilterLinkInternal *const li = ff_link_internal(link); AVFrame *frame = NULL; int pool_width = 0; int pool_height = 0; @@ -68,13 +70,13 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig return frame; } - if (!link->frame_pool) { - link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, align); - if (!link->frame_pool) + if (!li->frame_pool) { + li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, + link->format, align); + if (!li->frame_pool) return NULL; } else { - if (ff_frame_pool_get_video_config(link->frame_pool, + if (ff_frame_pool_get_video_config(li->frame_pool, &pool_width, &pool_height, &pool_format, &pool_align) < 0) { return NULL; @@ -83,15 +85,15 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig if (pool_width != w || pool_height != h || pool_format != link->format || pool_align != align) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); - link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, align); - if (!link->frame_pool) + ff_frame_pool_uninit(&li->frame_pool); + li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, + link->format, align); + if (!li->frame_pool) return NULL; } } - frame = ff_frame_pool_get(link->frame_pool); + frame = ff_frame_pool_get(li->frame_pool); if (!frame) return NULL; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".