[FFmpeg-devel] [PATCH] lavfi/movie: add support to setting format and codec options

Stefano Sabatini stefasab at gmail.com
Thu May 10 01:34:22 CEST 2012


On date Wednesday 2012-05-09 16:20:25 +0200, Nicolas George encoded:
> Le primidi 11 floréal, an CCXX, Stefano Sabatini a écrit :
> >  static const AVOption movie_options[]= {
> > +{"codec_opts",   "set codec options",       OFFSET(codec_opts),   AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> > +{"copts",        "set format options",      OFFSET(codec_opts),   AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> >  {"format_name",  "set format name",         OFFSET(format_name),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> >  {"f",            "set format name",         OFFSET(format_name),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> > +{"format_opts",  "set format options",      OFFSET(format_opts),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> > +{"fopts",        "set format options",      OFFSET(format_opts),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
> 
> Nice idea, but IMHO, the implementation you chose is not in the spirit of
> the options system. IMHO, the options should not be nested: src_movie takes
> the options it understands and leaves the rest in the dictionary for the
> format, toe formats takes and removes what it understands, the rest is for
> the codec, and if there are options after the codec, they are unknown and
> should generate an error. That is the way ffmpeg proceeds (except for
> streams specifier when the same option can be applied to several streams)
> and the way the API was designed.

The problem with the current ffmpeg approach is that it has namespace
problems (for example what if format and codec has an option with the
same name?), thus I prefer to keep the options for format and codec
separated (to which we may add protocol options as well).

Also following the ffmpeg path the overall logic would be way more
complicated (for example we may need to add a callback in case the
parser fails to find an option in the filter context). But I want to
explore this a bit, and see if what you say can be implemented cleanly.
-- 
FFmpeg = Fostering and Faithful Mere Perfectionist Exuberant Genius


More information about the ffmpeg-devel mailing list