Hi, there's a number of known problems with AVOptions: 1) Current design doesn't allow demuxer or decoder-specific options, because private data isn't allocated until avcodec_open/av_open_input_stream and after that it's already too late to set options. 2) Current API is pretty messy and unpleasant to use, have a look at cmdutils.c:opt_default() and set_context_defaults() for an example. 3) Default value is a double, so no string or binary defaults. 4) ???
I've been working on solving that, as it stands in the way of moving private options where they belong (and I expect demuxer-private options to be useful for my gsoc project). Intermediate WIP results can be found in the opts branch in git://git.khirnov.net/git/libav I) As suggested by unused AVOption2, I've replaced default_val by a union, thus allowing arbitrary defaults (this breaks FATE for yet unknown reasons) II) I've introduced a new API, where the options are stored in a temporary storage until the open() call. Then they are recursively distributed where they belong. This enables using private options like this: avformat_alloc_context() avopt_set() on the above context av_open_input_stream() <- options are actually set here, private contexts are tried first Demuxer-private options are already written and appear to work. Decoder-private options pose a little problem -- options state in AVCodecContext is currently inited during avcodec_alloc_context() and freed in avcodec_close(). The problem is that e.g. av_find_stream_info() opens and closes the codec, so the option context is not there anymore when the options are processed and codec is openened again. Suggestions welcome. -strict is also broken atm, since ffmpeg expects to be able to read the options back immediately, which isn't possible now. Comments/tests/fixes very much welcome. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
