* Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options [not found] <20240308070618.2B9D0411B56@natalya.videolan.org> @ 2024-07-05 19:38 ` Michael Niedermayer 2024-07-05 20:06 ` Paul B Mahol 0 siblings, 1 reply; 2+ messages in thread From: Michael Niedermayer @ 2024-07-05 19:38 UTC (permalink / raw) To: ffmpeg-devel [-- 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". ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options 2024-07-05 19:38 ` [FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options Michael Niedermayer @ 2024-07-05 20:06 ` Paul B Mahol 0 siblings, 0 replies; 2+ messages in thread From: Paul B Mahol @ 2024-07-05 20:06 UTC (permalink / raw) To: FFmpeg development discussions and patches On Fri, Jul 5, 2024 at 9:38 PM Michael Niedermayer <michael@niedermayer.cc> wrote: > 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. > One more reason to replace AVOptions limited API. > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > He who knows, does not speak. He who speaks, does not know. -- Lao Tsu > _______________________________________________ > 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". > _______________________________________________ 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". ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-05 20:07 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20240308070618.2B9D0411B56@natalya.videolan.org> 2024-07-05 19:38 ` [FFmpeg-devel] [FFmpeg-cvslog] lavu/opt: add array options Michael Niedermayer 2024-07-05 20:06 ` Paul B Mahol
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