[FFmpeg-devel] [PATCH] avfilter: Handle =help to show Filter options documentation
Paul B Mahol
onemda at gmail.com
Fri Mar 29 17:37:46 CET 2013
On 3/29/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavfilter/avfilter.c | 14 +++++++++++++-
> libavfilter/avfilter.h | 1 +
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 8a907dc..df7c84b 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -236,6 +236,9 @@ int avfilter_config_links(AVFilterContext *filter)
> return AVERROR(EINVAL);
> }
> } else if ((ret = config_link(link)) < 0) {
> + if (link->src->help) {
> + av_opt_show2(&link->src->filter->priv_class, NULL,
> AV_OPT_FLAG_FILTERING_PARAM, 0);
> + } else
> av_log(link->src, AV_LOG_ERROR,
> "Failed to configure output pad on %s\n",
> link->src->name);
> @@ -279,6 +282,9 @@ int avfilter_config_links(AVFilterContext *filter)
>
> if ((config_link = link->dstpad->config_props))
> if ((ret = config_link(link)) < 0) {
> + if (link->dst->help) {
> + av_opt_show2(&link->dst->filter->priv_class, NULL,
> AV_OPT_FLAG_FILTERING_PARAM, 0);
> + } else
> av_log(link->src, AV_LOG_ERROR,
> "Failed to configure input pad on %s\n",
> link->dst->name);
> @@ -602,6 +608,7 @@ void avfilter_free(AVFilterContext *filter)
> int avfilter_init_filter(AVFilterContext *filter, const char *args, void
> *opaque)
> {
> int ret=0;
> + filter->help = args && !strncmp(args, "help", 4);
>
> if (filter->filter->shorthand) {
> av_assert0(filter->priv);
> @@ -610,14 +617,19 @@ int avfilter_init_filter(AVFilterContext *filter,
> const char *args, void *opaque
> av_opt_set_defaults(filter->priv);
> ret = av_opt_set_from_string(filter->priv, args,
> filter->filter->shorthand, "=", ":");
> - if (ret < 0)
> + if (ret < 0) {
> + if(filter->help)
> + av_opt_show2(&filter->filter->priv_class, NULL,
> AV_OPT_FLAG_FILTERING_PARAM, 0);
> return ret;
> + }
> args = NULL;
> }
> if (filter->filter->init_opaque)
> ret = filter->filter->init_opaque(filter, args, opaque);
> else if (filter->filter->init)
> ret = filter->filter->init(filter, args);
> + if(filter->help && ret<0)
> + av_opt_show2(&filter->filter->priv_class, NULL,
> AV_OPT_FLAG_FILTERING_PARAM, 0);
> return ret;
> }
>
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 455161f..7b5c0f7 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -522,6 +522,7 @@ struct AVFilterContext {
> void *priv; ///< private data for use by the
> filter
>
> struct AVFilterCommand *command_queue;
> + int help; ///< avfilter internal flag indicating
> that help text possibly was requested
> };
>
> /**
Too much code for something trivial. Overdesigned.
> --
> 1.7.9.5
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list