[Ffmpeg-devel] Re: AVOptions
Wed Sep 14 17:35:43 CEST 2005
> so as to clarify things, a developer who adds a new option or codec must not
> be required to test all combinations and find all legal max/min values, (s)he
> certainly should but if (s)he doesnt then things must work too
That's understandable (from the developers standpoint), but the consequence
is, that the min/max values cannot be trusted in all cases, which makes them
Would it make sense to set min=max=0 if there are no limits or the limits are
unknown? Then applications can easily check if they can trust min/max.
>From what I see now, all allowed ranges in utils.c are either INT_MIN..INT_MAX
or 0..INT_MAX. I sure that there is room for improvement :)
> and as you suggest that you wish to help with the codec-option compatibility
> i guess we just need to wait for your API suggestions and patches to see
> how easy it is
I didn't say it's easy, it's probably VERY hard to do this 100% correctly.
I saw, that some options are only queried in dsputil, so one must find out,
from which codecs the routine is called etc.
But nevertheless I think that one can in principle do some obvious
- Video encoders, which do no temporal compression (e.g. DV, MJPEG) don't need
options related to motion estimation, GOP size and B-Frames.
- Encoders, which have no compression or a fixed ratio compression
(like ima4 or raw video) don't need any bitrate settings.
- Some options are for some distinct codecs only (e.g. extern_huff for mjpeg).
- There are options, which are never used (e.g. FF_BUG_OLD_MSMPEG4). Can they
be kicked out?
I'm not sure what's the best way to do this. Possibilities would be:
- Divide the AVOptions into groups (e.g. temporal compression parameters,
motion estimation parameters...) and let each codec select which groups
are supported. This is a rough approach but would at least prevent terribly
brain-dead options. I did a similar thing for the lavc plugin in
libquicktime, which supports only a subset of the AVCodec options.
Maybe it's not possible to group ALL options in a sensible and consistent
- Let each codec have the AVOptions from util.c by default, but offer
a possibility to replace them with own options. For simple codecs, it should
be possible to figure the options out. For more feature-rich codecs, it will
become messy, that's true.
- Let each codec take the options from util.c, make a local copy, and offer
1. DISABLE single options so they aren't shown.
2. Adjust min/max so they become true.
I would prefer the last method since it's purely optional (doesn't require any
work from codec developers) and some senseless options can easily be hidden.
More information about the ffmpeg-devel