[Ffmpeg-devel] Re: AVOptions

Burkhard Plaum plaum
Tue Sep 13 18:33:51 CEST 2005


Michael Niedermayer <michaelni <at> gmx.at> writes:

> 
> Hi
> 
> as everyone certainly already knows ffmpeg/libav* has a nice&new AVOption
> API, comments & suggestions for improvements are welcome

I would suggest to introduce a short_name and a long_name for each option.

The short_name is unique, locale independent, and will be used inside lavc.
To make internal processing easier, the short name can be required to be
plain ASCII.

The long_name is more human readable (e.g. for GUI labels). It can be 
translated to any language/charset without affecting any internal stuff.

Another issue might be, that there are lots of options defined in utils.h,
but there is no way to find out, which option applies for which codec.
If I create e.g. a mjpeg codec, av_next_option() should never return any
options, which are only for h263+. 

A possible approach to implement this follows:

There can be macros in opt.h like:

#define OPT_BITRATE \
{"bit_rate", NULL, OFFSET(bit_rate), FF_OPT_TYPE_INT, \
DEFAULT, INT_MIN, INT_MAX, V|A|E}

/* #defines other options follow */

A codec foo, which accepts only the bitrate as option would then have 
something like

static AVOption foo_options[] = 
  {
    OPT_BITRATE,
    { NULL }
  };

in it's private file.

Any opinions?

Cheers

Burkhard





More information about the ffmpeg-devel mailing list