[FFmpeg-devel] Sorry state of AVOptions
Paul B Mahol
onemda at gmail.com
Fri Jul 5 23:09:48 EEST 2024
On Fri, Jul 5, 2024 at 10:09 PM Michael Niedermayer <michael at niedermayer.cc>
wrote:
> On Thu, Jul 04, 2024 at 04:44:39PM +0200, Paul B Mahol wrote:
> > The AVOptions state is extremely ugly.
> >
> > It is insane to request from library users to convert non-strings option
> > values from/to strings to be able to read/change them, it is ugly,
> > inefficient, and slow. This becomes more relevant for recent array
> options
>
> > extension for which av_opt_ptr() hack does not work at all.
>
> maybe reverting this, will make array somewhat work with av_opt_ptr()
>
> @@ -1794,7 +2016,9 @@ const AVClass *av_opt_child_class_iterate(const
> AVClass *parent, void **iter)
> void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
> {
> const AVOption *opt= av_opt_find2(&class, name, NULL, 0,
> AV_OPT_SEARCH_FAKE_OBJ, NULL);
> - if(!opt)
> +
> + // no direct access to array-type options
> + if (!opt || (opt->type & AV_OPT_TYPE_FLAG_ARRAY))
> return NULL;
> return (uint8_t*)obj + opt->offset;
> }
>
> thx
>
It is very bad and fragile API. It needs to go.
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list