Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint <cus@passwd.hu>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options
Date: Mon, 4 Mar 2024 22:32:21 +0100 (CET)
Message-ID: <2fecfdba-e1c5-3071-198a-51d17c3e42a2@passwd.hu> (raw)
In-Reply-To: <20240304130657.30631-6-anton@khirnov.net>



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".

  parent reply	other threads:[~2024-03-04 21:32 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 13:06 [FFmpeg-devel] [PATCH 01/29] lavu/opt: factor per-type dispatch out of av_opt_get() Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 02/29] lavu/opt: factor per-type dispatch out of av_opt_set() Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 03/29] libavutil/opt: rework figuring out option sizes Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 04/29] lavu/opt: factor per-type dispatch out of av_opt_copy() Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 05/29] lavu/opt: distinguish between native and foreign access for AVOption fields Anton Khirnov
2024-03-04 22:39   ` Marton Balint
2024-03-05  9:48     ` Anton Khirnov
2024-03-05 10:17     ` Diederick C. Niehorster
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options Anton Khirnov
2024-03-04 13:29   ` Andreas Rheinhardt
2024-03-04 21:00     ` Anton Khirnov
2024-03-05  8:52       ` Andreas Rheinhardt
2024-03-07 14:50     ` Andreas Rheinhardt
2024-03-07 15:24       ` [FFmpeg-devel] [PATCH v2 " Anton Khirnov
2024-03-04 21:32   ` Marton Balint [this message]
2024-03-05  9:50     ` [FFmpeg-devel] [PATCH " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 07/29] lavc: add a decoder option for configuring side data preference Anton Khirnov
2024-03-04 14:05   ` Derek Buitenhuis
2024-03-05  9:57     ` Anton Khirnov
2024-03-05 12:30   ` James Almer
2024-03-05 14:29     ` Anton Khirnov
2024-03-05 14:35       ` James Almer
2024-03-05 14:54         ` Anton Khirnov
2024-03-05 15:07           ` James Almer
2024-03-05 15:19             ` Anton Khirnov
2024-03-06 13:58   ` [FFmpeg-devel] [PATCH v2 " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 08/29] avcodec: add internal side data wrappers Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 09/29] lavc: add content light/mastering display " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 10/29] avcodec/av1dec: respect side data preference Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 11/29] avcodec/cri: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 12/29] avcodec/h264_slice: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 13/29] lavc/hevcdec: pass an actual codec context to ff_h2645_sei_to_frame() Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 14/29] avcodec/hevcdec: respect side data preference Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 15/29] avcodec/libjxldec: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 16/29] avcodec/mjpegdec: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 17/29] avcodec/mpeg12dec: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 18/29] avcodec/pngdec: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 19/29] avcodec/tiff: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 20/29] avcodec/webp: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 21/29] avcodec/libdav1d: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 22/29] avcodec/dpx: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data Anton Khirnov
2024-03-04 13:36   ` Andreas Rheinhardt
2024-03-05 10:00     ` Anton Khirnov
2024-03-07 11:19       ` Andreas Rheinhardt
2024-03-07 12:18         ` Anton Khirnov
2024-03-07 12:25           ` James Almer
2024-03-07 12:37             ` Anton Khirnov
2024-03-07 20:05       ` Niklas Haas
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 24/29] avcodec/h2645_sei: use ff_frame_new_side_data_from_buf Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 25/29] avcodec/snowdec: use ff_frame_new_side_data Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 26/29] avcodec/mjpegdec: " Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 27/29] avcodec/hevcdec: switch to ff_frame_new_side_data_from_buf Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 28/29] lavc/*dec: use side data preference for mastering display/content light metadata Anton Khirnov
2024-03-04 13:06 ` [FFmpeg-devel] [PATCH 29/29] tests/fate/matroska: add tests for side data preference Anton Khirnov
2024-03-07 23:42   ` Andreas Rheinhardt
2024-03-07  9:30 ` [FFmpeg-devel] [PATCH 01/29] lavu/opt: factor per-type dispatch out of av_opt_get() Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fecfdba-e1c5-3071-198a-51d17c3e42a2@passwd.hu \
    --to=cus@passwd.hu \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git