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 02DB34A497 for ; Thu, 28 Mar 2024 12:57:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D567668D5BD; Thu, 28 Mar 2024 14:57:11 +0200 (EET) Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 069BD68C2B5 for ; Thu, 28 Mar 2024 14:57:06 +0200 (EET) Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5a53d5aaaa4so438491eaf.2 for ; Thu, 28 Mar 2024 05:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711630623; x=1712235423; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=OM0unp7ZZIjw/ysyZdXyVYCCsrWtLyssWYzFIMMdik4=; b=VtkFxWKQAf2ynOg1UGVwYTdpEpcCjaHeHPWw84M5m/RcPyn4lVD2IoMWPiurOclE2I xbq2bo0gwe0x700Ws25Q6NyiZor8GASs+OhVJ72OWSWcpUU12PzCxz3GoE0gCUzXV7gn W7UCKQkgQwEGNvUHWZmy2VhV4c2naoe2nc4DeCIvWDp+OYI0KYtsbXyxhJz4Lk+Ls7Qo F3o/YeGpdKGE9P354TiOHeAHvjPXjfmBrrsfm88+h+mH3JK1ibR+v5mWqZf8pMQTA06O GLhNb+OhRfrPBlkv0uvgM4EPfDpqric1Jf4kDvXlSnzzP7LGY3O9ANuN/aYux6o8+srY UZrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711630623; x=1712235423; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OM0unp7ZZIjw/ysyZdXyVYCCsrWtLyssWYzFIMMdik4=; b=KYJhsTwtHeLPYTDvjxSUrLM/zgTVNiRsDzXSSEzMrMnEWVpXX/DM8N92NLhPiWpzZZ 8Z2pfPQEQusCJAVayqe9dwl+p/fdtwmYPzZDyOwYdStLA8Qez0C6UOK+7B98H13pDZm2 e8FqzAYuvialnMIMWHlE+uC+rijPUm/RX2GX2VTZY8b/6oGv8ewqQLacowGBu3MM1C9x WCZP0XJK8UGXvHm/Oe4Ba+2xpIyCV/YeAPpwas4ie/6XrV9h8DWmYDGez1Vdot+Yfdr+ hEkHpUcW31CPLl+Yv0v13SegXF9NLLAccGAtCw9+q/nJEWYH2jOU4IDjwIrAsBWhlv5Y Rifg== X-Gm-Message-State: AOJu0YwlbKnsPYASWds2Vz5W+E2Odqjl8PydDMb9OuZzWpJHC5VBcIqR BdOba3lfE+LItxeTqXhwFWWG34vdOwtYnjLaTpum8Srwtech+JPhS+b17lFh X-Google-Smtp-Source: AGHT+IGC4A5VhU97EOXYwEJQ06rsY5EBE4wy3btg9T+NdeyxfBOOqn64MOlXKoBcN+VusdsZ/mSHTw== X-Received: by 2002:a05:6358:591c:b0:183:645b:cfa5 with SMTP id g28-20020a056358591c00b00183645bcfa5mr340945rwf.15.1711630623194; Thu, 28 Mar 2024 05:57:03 -0700 (PDT) Received: from [192.168.0.15] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id q24-20020a656858000000b005f077dce0f6sm1108761pgt.31.2024.03.28.05.57.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Mar 2024 05:57:02 -0700 (PDT) Message-ID: <1b376119-ad19-40b9-a256-77bcc831b8e9@gmail.com> Date: Thu, 28 Mar 2024 09:57:06 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240328031210.21407-1-jamrial@gmail.com> <171162501860.7287.7383716984700357542@lain.khirnov.net> <3b04e51c-29d1-4105-bd40-c32805afa301@gmail.com> <171162848453.7287.6446914436217353196@lain.khirnov.net> Content-Language: en-US From: James Almer In-Reply-To: <171162848453.7287.6446914436217353196@lain.khirnov.net> 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/28/2024 9:21 AM, Anton Khirnov wrote: > 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. I agree with that when you're handling side data that comes from something like a filter or similar modules within our libraries, as that'd be a bug. But this is the public core API for side data, and i don't see a reason why we should fail if the caller does av_frame_side_data_new(&sd, &nd_sd, 1000, 1, 0);. We never did before, and doing it now feels wrong. _______________________________________________ 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".