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

Anton Khirnov anton at khirnov.net
Sun Mar 3 16:55:39 EET 2024


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.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list