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 A88AE49A3B for ; Mon, 26 Feb 2024 17:14:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3384E68C7EA; Mon, 26 Feb 2024 19:14:15 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2996468C05A for ; Mon, 26 Feb 2024 19:14:08 +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=acn0+5Hl; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E29162401C1 for ; Mon, 26 Feb 2024 18:14:07 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 4NZTPdw4uhwp for ; Mon, 26 Feb 2024 18:14:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708967647; bh=5VmyuPL1Il/CaHbN3eb3U3F6+YZxIHK22otMPDzK3pY=; h=Subject:From:To:In-Reply-To:References:Date:From; b=acn0+5Hlv7Jsq+G1hxhKF4dZEOhalohr775DAGlyqtEXohu0XoArlBEuC9R+xw8Kq MKtG5/TKVMRo/CVJ7cNzokxfAbVVI6wnJAIFXvwgDJE5kmeHR1TqZnfbP+I+FHA6+S nYd3xdgBeJL5EehjOIAE7wO+No1zVHz78tMaNmoyIwG/VVaeL3mWzF0OZZcerh5Kb7 MRf1T17mqp8Dy5NP5AOolN9qEEL1vynZ70Cfc5VkW10YJQ6NeXwsGaPJxQFPnp8ISK SXqTPtQ7vE7VWvwwhmc1q+Dcxi85sduXWPLACb1FdXtJaog+QhR/f5GtA1T8yCW+au 5uC9EaW1WmiPQ== 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 354ED240177 for ; Mon, 26 Feb 2024 18:14:07 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 115461601B9; Mon, 26 Feb 2024 18:14:07 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20240223143115.16521-1-anton@khirnov.net> <20240223143115.16521-16-anton@khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Mon, 26 Feb 2024 18:14:07 +0100 Message-ID: <170896764704.29002.11257003666537600643@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 15/38] lavu/opt: add array options 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 Marton Balint (2024-02-23 20:05:06) > > > On Fri, 23 Feb 2024, Anton Khirnov wrote: > > > AVOption.array_max_size is added before AVOption.unit to avoid > > increasing sizeof(AVOption). > > --- > > doc/APIchanges | 3 + > > libavutil/opt.c | 344 ++++++++++++++++++++++++++++++++++++------ > > libavutil/opt.h | 26 ++++ > > libavutil/tests/opt.c | 34 +++++ > > tests/ref/fate/opt | 23 ++- > > 5 files changed, 385 insertions(+), 45 deletions(-) > > > [...] > > > --- a/libavutil/opt.h > > +++ b/libavutil/opt.h > > @@ -288,6 +288,16 @@ enum AVOptionType{ > > */ > > #define AV_OPT_FLAG_CHILD_CONSTS (1 << 18) > > > > +/** > > + * The option is an array. > > + * > > + * When adding array options to an object, @ref AVOption.offset should refer to > > + * a pointer corresponding to the option type. The pointer should be immediately > > + * followed by an unsigned int that will store the number of elements in the > > + * array. > > + */ > > +#define AV_OPT_FLAG_ARRAY (1 << 19) > > + > > /** > > * AVOption > > */ > > @@ -313,6 +323,16 @@ typedef struct AVOption { > > union { > > int64_t i64; > > double dbl; > > + > > + /** > > + * This member is always used for AV_OPT_FLAG_ARRAY options. When > > + * non-NULL, the first character of the string must be the separator to > > + * be used for (de)serializing lists to/from strings with av_opt_get(), > > This is quite ugly. Also it breaks the assumption that if the user sets an > option value to the default value of the option, than it will work. I don't follow, what assumption are you talking about? > So let's just remove this feature for now. > > Eventually I think some new struct should be introduced, e.g. > AVOptionExtension, which can be used to specify additional option > settings, such as array min/max size, and maybe separator. It would be a > lot more clean and future proof than filling the holes in AVOption. I've actually considered that, but don't see a clean way of linking such an extension with its option. We only have an int-sized hole, so can't add a new pointer field to AVOption. I suppose there could be a new array of extensions in AVClass, linked to options by name, but that seems even more ugly and inefficient. -- 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".