[FFmpeg-devel] Filters & AVOptions

Clément Bœsch ubitux at gmail.com
Thu Apr 11 19:29:27 CEST 2013


Hi,

Some little comments about what's been done these last hours about the
filters and AVOptions.

But first, some little story/context. A while ago, we introduced the
shorthand for filters. Basically, the ability to have "c=3:a=1:b=2" or
"1:c=3:b=2" or "1:2:3" and use internals/helper to auto parse these
options to initialize the local filter context. The order of the
short-hands (the parameters without a key) was defined in each filter with
something like:
    const char *const shorthand = {"a", "b", "c", NULL};

A few days ago though, the fork introduced a similar feature making use of
the filters' AVOption options declaration instead. This has some
advantages, and some drawbacks over our own solution. Anyway, it was
decided to switch to this new shorthand system (because the new system
will allow some dictionary init which might be relevant). For the users,
not much things should change.

Most of the filters are now compatible with this new system: the filters
have either a priv_class/avoptions/etc or nothing if they take no
parameters.

The problem for the remaining filters is mainly that they can't use ':'
freely anymore: it's the separator used for separating options, and the
parsing has completely moved to avfilter internals. Basically, filters can
not receive a string as initializer anymore (the idea is to have a
dictionary init form only). Various temporary solutions are available to
deal with this problem, the main one being a ':'-to-'|' replace in the
compat layer (see lavfi/avfilter.c:avfilter_init_filter). Then the filter
only uses '|' as an item separator (most of the time the abuse of ':' was
to separate a list of items).

We've dealt with most of the filters, but some are remaining and need to
be updated ASAP before the next incoming evil wave. Here is the list and
the problem we have to handle (this list is from
avfilter.c:filters_left_to_update):

  abuffer
    Still use shorthands, should be possible to update without much problems
  aconvert
    Patch to drop that filter posted
  aresample
    resample filter now uses a dict init, we need to have the same
  atempo
    Might be problematic because of the process_command system
  buffer
    Similar to abuffer
  flite
    I can't test it, so I'm not the best person to update this
  hue
    Stefano has a pending patch for this
  mp
    This one is a bit troublesome since most mplayer filter make use of
    ':'...
  pan
    We use ':' as a dynamic separator, so we need to switch to '|'. It
    should be similar to the changes done for aevalsrc
  scale
    This one might be messy because of the compat layers we had, I'm not
    the best person to comment on these
  setdar
  setsar
    Similar to scale

I don't plan to deal with more filters myself since I won't be efficient
at all with those remaining.

Anyway, some random comments about this new system:

 - the mixed short/long system is now restored (the fork only supports one
   or another), so there should be no compatibility break

 - /!\ it might be relevant to notice in the doc that the usage of
   shorthands in *unstable* and should not be used in scripting (the fork
   could insert some options at the end of an options list, while we added
   some options in the meantime). This is the main drawback of the new
   system IMO. /!\

 - the aliases are correctly handled (thanks to Michael) so no worry about
   that

 - the new lavfi opt wave is incoming, so we probably need to get things
   done ASAP

 - it's possible the fork did not use the same name for options as we did
   when porting our filters to avoptions. So a deep pass on the
   documentation and code consistency should be done, where we should
   check the names, and order of the options (to keep the same shorthands
   as the fork).

Regards,

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130411/aeb3cbc8/attachment.asc>


More information about the ffmpeg-devel mailing list