[FFmpeg-devel] [PATCH] ffprobe: move writer context registration and initialization in main()

Stefano Sabatini stefasab at gmail.com
Fri Jan 6 21:09:31 CET 2012


On date Friday 2012-01-06 20:34:31 +0100, Clément Bœsch encoded:
> On Fri, Jan 06, 2012 at 07:15:33PM +0100, Stefano Sabatini wrote:
> > On date Friday 2012-01-06 11:05:15 +0100, Stefano Sabatini encoded:
> > > Simplify pending changes, as the writer context will be used in the
> > > main() routine.
> > > ---
> > >  ffprobe.c |   53 ++++++++++++++++++++++++++---------------------------
> > >  1 files changed, 26 insertions(+), 27 deletions(-)
> > 
> > Updated, slightly different.
> > -- 
> > FFmpeg = Freak and Furious Majestic Practical Ecstatic Gorilla
> 
> > From b7225527fa60d48792c508c645661cc101c0fd61 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Sun, 1 Jan 2012 17:18:18 +0100
> > Subject: [PATCH] ffprobe: move writer context registration and initialization
> >  in main()
> > 
> > Simplify pending changes, as the writer context will be used in the
> > main() routine.
> > ---
> >  ffprobe.c |   62 +++++++++++++++++++++++++++++-------------------------------
> >  1 files changed, 30 insertions(+), 32 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index 34626a8..dabbbc5 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> [...]
> >  
> > -    ret = probe_file(input_filename);
> > +    if ((ret = writer_open(&wctx, w, w_args, NULL)) >= 0) {
> > +        if (!input_filename) {
> > +            show_usage();
> > +            av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
> > +            av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
> > +            ret = AVERROR(EINVAL);
> > +        } else
> > +            ret = probe_file(wctx, input_filename);
> > +
> > +        writer_close(&wctx);
> > +    }
> >  
> 
> The reasons it tries to open the writer before it actually checks if the
> user has specified an input don't sound obvious to me. But the patch LGTM
> anyway.

This is implicitely required by -show_version, you may want to print
the version info even if no file was specified, for example with:
ffprobe -show_version
-- 
FFmpeg = Forgiving Fierce Merciless Power Everlasting Governor


More information about the ffmpeg-devel mailing list