[FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 5 22:38:44 EEST 2024
On Fri, Mar 08, 2024 at 07:06:17AM +0000, Anton Khirnov wrote:
> ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Feb 8 08:50:18 2024 +0100| [efe447877811f2f14f814e80ce71383e2f056f36] | committer: Anton Khirnov
>
> lavu/opt: add array options
>
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efe447877811f2f14f814e80ce71383e2f056f36
> ---
>
> doc/APIchanges | 3 +
> libavutil/opt.c | 360 ++++++++++++++++++++++++++++++++++++++++++++------
> libavutil/opt.h | 56 +++++++-
> libavutil/tests/opt.c | 49 +++++++
> libavutil/version.h | 2 +-
> tests/ref/fate/opt | 35 ++++-
> 6 files changed, 459 insertions(+), 46 deletions(-)
[...]
> --- a/libavutil/opt.h
> +++ b/libavutil/opt.h
> @@ -250,6 +250,17 @@ enum AVOptionType{
> AV_OPT_TYPE_COLOR,
> 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),
This sounds like it suggests undefined behavior
taking a pointer to a pointer of lets say a array of float
and adding 1 and then dereferencing this as int is undefined behavior
A pointer created that way may not be aligned correctly. This just happens
to work on the major platforms ...
Or said differently a int *array ; int array_len in a struct arent guranteed to have
the same distance between each other each time.
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240705/553a9f28/attachment.sig>
More information about the ffmpeg-devel
mailing list