Thilo Borgmann: > --- > fftools/cmdutils.c | 5 +++++ > libavutil/opt.c | 14 +++++++++++++- > libavutil/opt.h | 8 ++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 22ba654bb0..dae018f83a 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -172,6 +172,11 @@ void show_help_options(const OptionDef *options, const > char *msg, int req_flags, > av_strlcat(buf, po->argname, sizeof(buf)); > } > printf("-%-17s %s\n", buf, po->help); > + > + if (po->args) { > + const AVClass *p = po->args; > + av_arg_show(&p, NULL); > + } > } > printf("\n"); > } > diff --git a/libavutil/opt.c b/libavutil/opt.c > index a3940f47fb..89ef111690 100644 > --- a/libavutil/opt.c > +++ b/libavutil/opt.c > @@ -1256,7 +1256,7 @@ static void opt_list(void *obj, void *av_log_obj, const > char *unit, > av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); > else > av_log(av_log_obj, AV_LOG_INFO, " %s%-17s ", > - (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? " " : "-", > + (opt->flags & (AV_OPT_FLAG_FILTERING_PARAM | > AV_OPT_FLAG_ARGUMENT)) ? " " : "-", > opt->name); > > switch (opt->type) { > @@ -1329,6 +1329,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); > break; > } > + if (!(opt->flags & AV_OPT_FLAG_ARGUMENT)) { > av_log(av_log_obj, AV_LOG_INFO, "%c%c%c%c%c%c%c%c%c%c%c", > (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.', > (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.', > @@ -1341,6 +1342,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > (opt->flags & AV_OPT_FLAG_BSF_PARAM) ? 'B' : '.', > (opt->flags & AV_OPT_FLAG_RUNTIME_PARAM) ? 'T' : '.', > (opt->flags & AV_OPT_FLAG_DEPRECATED) ? 'P' : '.'); > + } > > if (opt->help) > av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); > @@ -1456,6 +1458,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int > req_flags, int rej_flags) > return 0; > } > > +int av_arg_show(void *obj, void *av_log_obj) > +{ > + if (!obj) > + return -1; > + > + opt_list(obj, av_log_obj, NULL, AV_OPT_FLAG_ARGUMENT, 0, -1); > + > + return 0; > +} > + > void av_opt_set_defaults(void *s) > { > av_opt_set_defaults2(s, 0, 0); > diff --git a/libavutil/opt.h b/libavutil/opt.h > index 461b5d3b6b..dce3483237 100644 > --- a/libavutil/opt.h > +++ b/libavutil/opt.h > @@ -297,6 +297,7 @@ typedef struct AVOption { > #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which > can be set by the user for filtering > #define AV_OPT_FLAG_DEPRECATED (1<<17) ///< set if option is > deprecated, users should refer to AVOption.help text for more information > #define AV_OPT_FLAG_CHILD_CONSTS (1<<18) ///< set if option constants can > also reside in child objects > +#define AV_OPT_FLAG_ARGUMENT (1<<19) ///< set if option is an > argument to another option > //FIXME think about enc-audio, ... style flags > > /** > @@ -386,6 +387,13 @@ typedef struct AVOptionRanges { > */ > int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); > > +/** > + * Show the obj arguments. > + * > + * @param av_log_obj log context to use for showing the options > + */ > +int av_arg_show(void *obj, void *av_log_obj); > + > /** > * Set the values of all AVOption fields to their default values. > *
1. Changes to the tools and the libraries should be in separate patches. E.g. judging by the commit message one would not think that this would change libavutil by adding a public function; but it does! 2. I don't really get what the documentation of AV_OPT_FLAG_ARGUMENT means. It seems to be some magic parameter which allows one to request/reject AVOptions in av_opt_show2(). 3. av_arg_show(obj, av_log_obj) is equivalent to av_opt_show2(obj, av_log_obj, AV_OPT_FLAG_ARGUMENT, 0). - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".