[FFmpeg-devel] [PATCH 15/38] lavu/opt: add array options

Diederick C. Niehorster dcnieho at gmail.com
Sun Mar 3 17:53:50 EET 2024


On Sun, Mar 3, 2024 at 3:55 PM Anton Khirnov <anton at khirnov.net> wrote:

> Quoting Marton Balint (2024-02-26 20:38:46)
> > The more I think about it, it is actually a broader problem.
> >
> > You are changing the semantics of existing AV_OPT_TYPE_xxx types. So
> > previously an option with AV_OPT_TYPE_STRING used to have default value
> in
> > default_val.str. After your patch, it will be either default_val.str, or
> > default_val.str[1], based on if it is an array or not.
> >
> > I think the API user safely assumed that if the option type is known to
> > him, he will always find the default value in the relevant default_val
> > field. It is actually a bigger issue for an array of AV_OPT_TYPE_INT,
> > because previously to get the default value AVOption->default_val.i64
> was
> > used, and now .str[1] should be instead...
>
> In my view the semantics of default_val (and offset) are only defined
> when declaring options on your own object, not when accessing those
> fields when declared by some other code. I also see no good reason for
> any user to read these fields.
>

I disagree. Here an example: for a GUI using some part of ffmpeg and
wanting to give the user some control over the ffmpeg operation, it would
not be strange to be able to set options and either indicate which values
are default, or have a "reset to defaults" button. I have written such a
thing (not yet opensourced).

Also the ffmpeg CLI has the ability to print the options and their defaults
for a component. Can this still be done?


More information about the ffmpeg-devel mailing list