[FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Tue Mar 5 10:52:54 EET 2024
Anton Khirnov:
> Quoting Andreas Rheinhardt (2024-03-04 14:29:59)
>> Anton Khirnov:
>>> ---
>>> 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.
>>
>> How about we make this actually type-safe and use an actual struct for
>> this instead of relying on the compiler not adding padding between a
>> pointer and an unsigned int?
>
> A struct containing what exactly?
>
A pointer and a size field.
- Andreas
More information about the ffmpeg-devel
mailing list