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 130624A48F for ; Thu, 28 Mar 2024 12:21:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 649FF68D6C3; Thu, 28 Mar 2024 14:21:31 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C05C68D4D7 for ; Thu, 28 Mar 2024 14:21:25 +0200 (EET) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=P7LA3j6U; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 60F75240DAC for ; Thu, 28 Mar 2024 13:21:25 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id CxA7Gso8kBB5 for ; Thu, 28 Mar 2024 13:21:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1711628484; bh=WU/NqWDQULMMTyy76Kzl+omLBtCTnPPiNpG0zSpSi88=; h=Subject:From:To:In-Reply-To:References:Date:From; b=P7LA3j6UOkpXlktqv3XdBy7yX1dI2O4hgGaiD8GQlSlxhxDzXGSufoDFPqZ1Wqw6G lLhZXBeMXiWep/ztgJ8RJs7Kk7H14t+PxsELl8Y5uHJgzBwLqHmc427cy8XpxE5eSD tWJCnubN584bPY36to/kq0Dt1bE462Vjq7PckObntG5HE+LiqEHVIvyMoVLjP8ANm7 G+Ti3TYa0PCf5X4122Hj0ig6ts8Hf3eZGtB8IH/D4HtnDQlz+AdhRDtItZ33GIoF4U wtmjr8FC5GUytRg3KoObfNWycBz4sIPUY+yUNmu9PkO1JyMsp3/hnPiBGyqURGIcTT ptxx/54g+dPsg== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A700B2404AF for ; Thu, 28 Mar 2024 13:21:24 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 87DAB1601B9; Thu, 28 Mar 2024 13:21:24 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <3b04e51c-29d1-4105-bd40-c32805afa301@gmail.com> References: <20240328031210.21407-1-jamrial@gmail.com> <171162501860.7287.7383716984700357542@lain.khirnov.net> <3b04e51c-29d1-4105-bd40-c32805afa301@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Thu, 28 Mar 2024 13:21:24 +0100 Message-ID: <171162848453.7287.6446914436217353196@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/7 v4] avutil/frame: add a flag to allow overwritting existing entries 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 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: Quoting James Almer (2024-03-28 12:41:40) > On 3/28/2024 8:23 AM, Anton Khirnov wrote: > > Quoting James Almer (2024-03-28 04:12:04) > >> Enable it only for side data types that don't allow more than one entry. > >> > >> Signed-off-by: James Almer > >> --- > >> libavutil/frame.c | 59 ++++++++++++++++++++++++++++--- > >> libavutil/frame.h | 27 +++++++++----- > >> libavutil/tests/side_data_array.c | 52 +++++++++++++++------------ > >> tests/ref/fate/side_data_array | 22 ++++++------ > >> 4 files changed, 115 insertions(+), 45 deletions(-) > >> > >> diff --git a/libavutil/frame.c b/libavutil/frame.c > >> index ef1613c344..d9bd19b2aa 100644 > >> --- a/libavutil/frame.c > >> +++ b/libavutil/frame.c > >> @@ -799,12 +799,34 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, > >> enum AVFrameSideDataType type, > >> size_t size, unsigned int flags) > >> { > >> - AVBufferRef *buf = av_buffer_alloc(size); > >> + const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); > >> + AVBufferRef *buf; > >> AVFrameSideData *ret = NULL; > >> > >> if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) > >> remove_side_data(sd, nb_sd, type); > >> + if (!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) { > > > > desc == NULL means type is invalid > > This being a generic alloc function, it should IMO not be limited to > currently defined types. And I chose to treat them as non multi, as > that's the most common scenario. Andreas argued in the thread adding descriptors that side data type without a descriptor is invalid and should explode. I tend to agree. -- Anton Khirnov _______________________________________________ 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".