Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options
Date: Fri, 5 Jul 2024 21:38:44 +0200
Message-ID: <20240705193844.GI1904408@pb2> (raw)
In-Reply-To: <20240308070618.2B9D0411B56@natalya.videolan.org>


[-- Attachment #1.1: Type: text/plain, Size: 1940 bytes --]

On Fri, Mar 08, 2024 at 07:06:17AM +0000, Anton Khirnov wrote:
> ffmpeg | branch: master | Anton Khirnov <anton@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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

       reply	other threads:[~2024-07-05 19:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240308070618.2B9D0411B56@natalya.videolan.org>
2024-07-05 19:38 ` Michael Niedermayer [this message]
2024-07-05 20:06   ` Paul B Mahol

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=20240705193844.GI1904408@pb2 \
    --to=michael@niedermayer.cc \
    --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