On Thu, 9 Jun 2011 16:27:29 +0200, Stefano Sabatini 
<[email protected]> wrote:
> On date Thursday 2011-06-09 12:27:53 +0200, Anton Khirnov encoded:
> [...]
> > diff --git a/libavutil/opt.h b/libavutil/opt.h
> > index f16d989..0ad7628 100644
> > --- a/libavutil/opt.h
> > +++ b/libavutil/opt.h
> > @@ -92,6 +92,7 @@ typedef struct AVOption {
> >      const char *unit;
> >  } AVOption;
> >  
> > +#if FF_API_FIND_OPT
> >  /**
> >   * Look for an option in obj. Look only for the options which
> >   * have the flags set as specified in mask and flags (that is,
> > @@ -103,8 +104,12 @@ typedef struct AVOption {
> >   * @param[in] unit the unit of the option to look for, or any if NULL
> >   * @return a pointer to the option found, or NULL if no option
> >   * has been found
> > + *
> > + * @deprecated use av_opt_find.
> >   */
> > +attribute_deprecated
> >  const AVOption *av_find_opt(void *obj, const char *name, const char *unit, 
> > int mask, int flags);
> > +#endif
> >  
> >  /**
> >   * Set the field of obj with the given name to value.
> > @@ -194,4 +199,29 @@ void av_opt_free(void *obj);
> >   */
> >  int av_opt_apply_dict(void *obj, struct AVDictionary **options);
> >  
> 
> > +#define AVOPT_SEARCH_CHILDREN   0x0001 /**< Search also in possible 
> > children of the given object. */
> 
> Please also specify the order of search, that is if the options are
> looked before in the parent or before in the children (or this could
> be another flag).

Done locally. Changing search order can be added later if/when it's
useful for something.

> 
> Nit: AV_OPT_... like AV_OPT_FLAG_*, FF_OPT_TYPE_*
> 
> Maybe AV_OPT_FIND_FLAG_SEARCH_CHILDREN, longer but more
> namespace-collision-free.

Let's not go into extremes here, AV_OPT_SEARCH_ is already verbose
enough.

> 
> > +
> > +/**
> > + * Look for an option in obj. Look only for the options which
> > + * have the specified flags set.
> > + *
> > + * @param[in] obj A pointer to a struct whose first element is a
> > + * pointer to an AVClass.
> > + * @param[in] name The name of the option to look for.
> > + * @param[in] unit When searching for named constants, name of the unit
> > + *                 it belongs to.
> > + * @param opt_flags Find only options with those flags set (AV_OPT_FLAG).
> > + * @param search_flags A combination of AVOPT_SEARCH_*.
> > + *
> > + * @return A pointer to the option found, or NULL if no option
> > + *         has been found.
> > + *
> 
> > + * @note Options found with AVOPT_SEARCH_CHILDREN flag may not be
> > + * settable directly with av_set_string3. Use special calls which
> > + * take an options dict (e.g. avformat_open_input() ) to set options
> > + * found with this flag.
> 
> Note: maybe av_set_string may be extended to make it look in the
> children contexts.

Possible in principle, but would require yet more callbacks in AVClass.
That's somewhat ugly, but can be done if needed.

--
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to