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 1C33749BE9 for ; Mon, 4 Mar 2024 21:32:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D329668D4AD; Mon, 4 Mar 2024 23:32:29 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 056A468D194 for ; Mon, 4 Mar 2024 23:32:24 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id A97A3E9C76 for ; Mon, 4 Mar 2024 22:32:23 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3h3AFDVkxSBl for ; Mon, 4 Mar 2024 22:32:21 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 886AAE98ED for ; Mon, 4 Mar 2024 22:32:21 +0100 (CET) Date: Mon, 4 Mar 2024 22:32:21 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20240304130657.30631-6-anton@khirnov.net> Message-ID: <2fecfdba-e1c5-3071-198a-51d17c3e42a2@passwd.hu> References: <20240304130657.30631-1-anton@khirnov.net> <20240304130657.30631-6-anton@khirnov.net> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 06/29] 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-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 Mon, 4 Mar 2024, Anton Khirnov wrote: > --- > doc/APIchanges | 3 + > libavutil/opt.c | 362 +++++++++++++++++++++++++++++++++++++----- > libavutil/opt.h | 62 +++++++- > libavutil/tests/opt.c | 51 ++++++ > tests/ref/fate/opt | 35 +++- > 5 files changed, 468 insertions(+), 45 deletions(-) > > diff --git a/doc/APIchanges b/doc/APIchanges > index 7d46ebb006..3209614ed6 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 > > API changes, most recent first: > > +2024-02-xx - xxxxxxxxxx - lavu 58.xx.100 - opt.h > + Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef. > + > 2024-02-28 - xxxxxxxxxx - swr 4.14.100 - swresample.h > swr_convert() now accepts arrays of const pointers (to input and output). [...] > diff --git a/libavutil/opt.h b/libavutil/opt.h > index e402f6a0a0..77797b3fbe 100644 > --- a/libavutil/opt.h > +++ b/libavutil/opt.h > @@ -253,6 +253,17 @@ enum AVOptionType{ > #endif > AV_OPT_TYPE_BOOL, > AV_OPT_TYPE_CHLAYOUT, > + > + /** > + * May be combined with another regular option type to declare an array > + * option. > + * > + * For array options, @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. > + */ > + AV_OPT_TYPE_FLAG_ARRAY = (1 << 16), > }; > > /** > @@ -298,6 +309,46 @@ enum AVOptionType{ > */ > #define AV_OPT_FLAG_CHILD_CONSTS (1 << 18) > > +/** > + * Must be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options. > + */ > +typedef struct AVOptionArrayDef { > + /** > + * Must be set to sizeof(AVOptionArrayDef), in order to allow extending this > + * struct without breaking ABI. > + */ > + size_t sizeof_self; > + > + /** > + * Native access only. > + * > + * Default value of the option, as would be serialized by av_opt_get() (i.e. > + * using the value of sep as the separator). > + */ > + const char *def; > + > + /** > + * Minimum number of elements in the array. When this field is non-zero, def > + * must be non-NULL and contain at least this number of elements. > + */ > + unsigned size_min; > + /** > + * Maximum number of elements in the array, 0 when unlimited. > + */ > + unsigned size_max; > + > + /** > + * Separator between array elements in string representations of this > + * option, used by av_opt_set() and av_opt_get(). It must be a printable > + * ASCII character, excluding alphanumeric and the backslash. A comma is > + * used when sep=0. > + * > + * The separator and the backslash must be backslash-escaped in order to > + * appear in string representations of the option value. > + */ > + uint8_t sep; > +} AVOptionArrayDef; > + > /** > * AVOption > */ > @@ -320,8 +371,7 @@ typedef struct AVOption { > enum AVOptionType type; > > /** > - * Native access only. > - * > + * Native access only, except when documented otherwise. > * the default value for scalar options > */ > union { > @@ -330,6 +380,14 @@ typedef struct AVOption { > const char *str; > /* TODO those are unused now */ > AVRational q; > + > + /** > + * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL. This contradicts with the documentation of AVOptionArrayDef above, because there you write that default_val MUST be set. > + * > + * Foreign access to some members allowed, as noted in AVOptionArrayDef > + * documentation. > + */ > + const AVOptionArrayDef *arr; > } default_val; Regards, Marton _______________________________________________ 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".