[FFmpeg-devel] [PATCH] show-banner and show-license as cmdutils.c functions

Stefano Sabatini stefano.sabatini-lala
Tue Aug 7 21:45:31 CEST 2007


On date Tuesday 2007-08-07 18:02:39 +0200, Michael Niedermayer encoded:
> On Tue, Aug 07, 2007 at 12:13:25PM +0200, Stefano Sabatini wrote:
> [...]
> > > [...]
> > > > @@ -3780,6 +3781,11 @@
> > > >  }
> > > >  #endif
> > > >  
> > > > +/* required for the inclusion of cmdutils.h */
> > > > +void parse_arg_file(const char *filename)
> > > > +{
> > > > +}
> > > > +
> > > 
> > > ugly hack
> > 
> > Agree, but I couldn't find a better way to manage it.
> > What about to make cmdutils.c:parse_options like this:
> > 
> > void parse_options(int argc, char **argv, const OptionDef *options,(void (*)(const char *))parse_arg_function)
> >  
> > when parse_arg_function specifyies which function has to be executed
> > on a bare arg, and manage the case when is parse_arg_function ==
> > NULL (as would be in the ffserver case)?
> 
> ok
> 
> 
> > 
> > > >  static int parse_ffconfig(const char *filename)
> > > >  {
> > > >      FILE *f;
> > > > @@ -4441,14 +4447,9 @@
> > > >          return 0;
> > > >  }
> > > >  
> > > > -static void show_banner(void)
> > > > -{
> > > > -    printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2006 Fabrice Bellard, et al.\n");
> > > > -}
> > > > -
> > > >  static void show_help(void)
> > > >  {
> > > > -    show_banner();
> > > > +    show_ffmpeg_banner(stderr);
> > > 
> > > stdout->stderr change
> > > 
> > > also ffmpeg != ffserver, the code does not display the same thing after this
> > [...]
> > 
> > In all the ff* applications the banner shows FFMPEG_VERSION, in the
> > case of ffmpeg it also displays the libav[cfu] versions, so it seems
> > safe to me to have just a common banner function that shows them all: or
> > eventually we can have an argument inside ffmpeg_show_banner that
> > takes the name of the application as argument, like this:
> > 
> > void show_ffmpeg_banner(FILE *stream, const char* program_name)
> > {
> >     fprintf(stream, "%s version " FFMPEG_VERSION ", Copyright (c) 2000-2007 Fabrice Bellard, et al.\n", program_name);
> >     fprintf(stream, "  configuration: " FFMPEG_CONFIGURATION "\n");
> >     fprintf(stream, "  libavutil version: " AV_STRINGIFY(LIBAVUTIL_VERSION) "\n");
> >     fprintf(stream, "  libavcodec version: " AV_STRINGIFY(LIBAVCODEC_VERSION) "\n");
> >     fprintf(stream, "  libavformat version: " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\n");
> >     fprintf(stream, "  built on " __DATE__ " " __TIME__);
> > #ifdef __GNUC__
> >     fprintf(stream, ", gcc: " __VERSION__ "\n");
> > #else
> >     fprintf(stream, ", using a non-gcc compiler\n");
> > #endif
> > }
> > 
> > Where to print the banner?
> > 
> > Current situation:
> > application | banner/version output destination |
> > =================================================
> > ffplay      | stdout
> > ffserver    | stdout
> > ffmpeg      | stderr
> > 
> > I prefer to print it on stderr, but on stdout when it is explicitly
> > requested the version of the program (for example by a "-version"
> > option), anyway the behaviour should be consistent across the various
> > ff* tools.
> 
> ok
[...]

Second attempt, regression test passed.

Suggested log: implement show_version and show_license as cmdutils.c functions.

Note that the ff* tools behaviour results still inconsistent, further
patches should "normalize" ffplay and ffserver (that is: version
printed on stderr at startup, no version displayed when showing help
and license, version and license outputted on stdout when explicitly
requested).

Cheers.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: show-banner-and-license-as-cmdutils-functions-01.patch
Type: text/x-diff
Size: 12246 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070807/6e0726b1/attachment.patch>



More information about the ffmpeg-devel mailing list