[FFmpeg-devel] Sorry state of AVOptions

Michael Niedermayer michael at niedermayer.cc
Fri Jul 5 22:50:19 EEST 2024


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

[...]
-- 
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
-------------- 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/9ade76ef/attachment.sig>


More information about the ffmpeg-devel mailing list