[FFmpeg-devel] [PATCH 04/10] fftools/cmdutils: split common option handlers into their own file

Anton Khirnov anton at khirnov.net
Sun Mar 20 12:07:31 EET 2022


Quoting Andreas Rheinhardt (2022-03-17 16:30:04)
> Anton Khirnov:
> > ---
> >  fftools/Makefile                     |    2 +-
> >  fftools/cmdutils.c                   | 1399 +--------------
> >  fftools/cmdutils.h                   |  202 ---
> >  fftools/ffmpeg_opt.c                 |    1 +
> >  fftools/ffplay.c                     |    1 +
> >  fftools/ffprobe.c                    |    1 +
> >  fftools/{cmdutils.c => opt_common.c} | 2450 ++++++++------------------
> >  fftools/opt_common.h                 |  231 +++
> >  8 files changed, 985 insertions(+), 3302 deletions(-)
> >  copy fftools/{cmdutils.c => opt_common.c} (60%)
> >  create mode 100644 fftools/opt_common.h
> 
> Very weird stats. When I apply this, I get:
> 
> fftools/Makefile     |    2 +-
> fftools/cmdutils.c   | 1399
> +------------------------------------------------
>  fftools/cmdutils.h   |  202 -------
>  fftools/ffmpeg_opt.c |    1 +
>  fftools/ffplay.c     |    1 +
>  fftools/ffprobe.c    |    1 +
>  fftools/opt_common.c | 1445
> +++++++++++++++++++++++++++++++++++++++++++++++++++
>  fftools/opt_common.h |  231 ++++++++
>  8 files changed, 1685 insertions(+), 1597 deletions(-)

Probably because I have diff.renames=copy in my gitconfig.

> > +#if CONFIG_AVFILTER
> > +static void show_help_filter(const char *name)
> > +{
> > +#if CONFIG_AVFILTER
> > +    const AVFilter *f = avfilter_get_by_name(name);
> > +    int i, count;
> > +
> > +    if (!name) {
> > +        av_log(NULL, AV_LOG_ERROR, "No filter name specified.\n");
> > +        return;
> > +    } else if (!f) {
> > +        av_log(NULL, AV_LOG_ERROR, "Unknown filter '%s'.\n", name);
> > +        return;
> > +    }
> > +
> > +    printf("Filter %s\n", f->name);
> > +    if (f->description)
> > +        printf("  %s\n", f->description);
> >  
> > -        printf("    Supported framerates:");
> > -        while (fps->num) {
> > -            printf(" %d/%d", fps->num, fps->den);
> > -            fps++;
> > -        }
> > -        printf("\n");
> > +    if (f->flags & AVFILTER_FLAG_SLICE_THREADS)
> > +        printf("    slice threading supported\n");
> > +
> > +    printf("    Inputs:\n");
> > +    count = avfilter_filter_pad_count(f, 0);
> > +    for (i = 0; i < count; i++) {
> 
> You can use a local loop variable here and in several other places here.

I would much prefer this to remain a simple move to the extent this is
possible. With diff.colorMoved=true, git will show you that almost
everything is a pure move.

All other cleanups should be applied later as separate commits.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list