[FFmpeg-devel] [PATCH] Implement common show_banner and show_version functions

Stefano Sabatini stefano.sabatini-lala
Fri Sep 14 16:44:53 CEST 2007


On date Wednesday 2007-09-12 20:34:30 +0200, Michael Niedermayer encoded:
> Hi
> 
> On Sun, Sep 09, 2007 at 11:15:50PM +0200, Stefano Sabatini wrote:
> > On date Sunday 2007-09-09 19:47:04 +0200, Michael Niedermayer encoded:
> > > Hi
> > > 
> > > On Sun, Sep 09, 2007 at 06:18:55PM +0200, Stefano Sabatini wrote:
> > > > Hi all,
> > > > 
> > > > the idea is to provide more consistency in behaviour and appearance
> > > > across the ff* utils. For example to show up the banner on stderr at
> > > > program startup seems like a good idea, and this patch makes trivial
> > > > to implement such a feature for ffserver and ffplay too in a
> > > > consistent manner.
> > > > 
> > > > A drawback of this patch is that it requires to define for each
> > > > ff* tool the variables program_name and program_birth_year.
> > > 
> > > you can pass these as arguments or?
> > 
> > Yes like in the attached patch.
> > 
> > But I still somehow prefer the previous way, program_name and
> > program_birth_year are better defined just one time at the beginning
> > of the file rather than to be passed around as function arguments.
> 
> so why not
> static const char *application_name= "my program";
> ...
> 
> show_banner(application_name, ...);

Because in this way you can still define at the top of the file:

static const char *application_name= "my program";
static const char *application_birth_year= 2000;

but then use show_banner like this:
show_banner("another program", 1000);

Furthermore, requiring the definition of program_name and
program_birth_name in the program main file when including cmdutils.h
isn't necessarily a bad thing, because in this way you're saying:
"this is a command util, you *have* to define the program_name and
program_birth_year blurb for it or it won't compile".

On the other hand if a file doesn't define the main for a command
line util, then you have no reasons to include cmdutils.h.

Regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)




More information about the ffmpeg-devel mailing list