[FFmpeg-devel] [PATCH] opt: attempt to improve options dump output.

Stefano Sabatini stefasab at gmail.com
Sun Mar 31 19:51:43 CEST 2013


On date Sunday 2013-03-31 18:40:21 +0200, Clément Bœsch encoded:
> On Sun, Mar 31, 2013 at 06:34:23PM +0200, Stefano Sabatini wrote:
> > On date Sunday 2013-03-31 15:14:21 +0200, Clément Bœsch encoded:
> > > Add some indent and remove the '-' prefix for filters.
> > > ---
> > >  libavutil/opt.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavutil/opt.c b/libavutil/opt.c
> > > index 97fc6fd..fb3b724 100644
> > > --- a/libavutil/opt.c
> > > +++ b/libavutil/opt.c
> > > @@ -839,9 +839,11 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
> > >          else if (unit && opt->type==AV_OPT_TYPE_CONST && strcmp(unit, opt->unit))
> > >              continue;
> > >          else if (unit && opt->type == AV_OPT_TYPE_CONST)
> > > -            av_log(av_log_obj, AV_LOG_INFO, "   %-15s ", opt->name);
> > > +            av_log(av_log_obj, AV_LOG_INFO, "     %-15s ", opt->name);
> > >          else
> > 
> > Looks OK if looks OK.
> > 
> > > -            av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
> > > +            av_log(av_log_obj, AV_LOG_INFO, "  %s%-17s ",
> > > +                   (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-",
> > > +                   opt->name);
> > 
> > Options are options, so we should avoid to display them in a different
> > way depending on the context. Thus I tend to prefer either to use
> > always "-" or never, then the user could (should) figure out how to
> > set options depending on the context, rather than guessing from the
> > help output.
> 

> Using the '-' prefix for filters is definitely wrong. But removing it for
> all the options and you are sure to confuse users on how they are supposed
> to set them. The two options systems are inconsistent, so the
> "documentation" should IMO display them as they are, inconsistent.

I still prefer consistency but I'm not strong on this, so feel free to
commit what you consider best.
-- 
FFmpeg = Furious & Fostering Muttering Prodigious Enhanced Game


More information about the ffmpeg-devel mailing list