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

Stefano Sabatini stefano.sabatini-lala
Sat Sep 22 13:43:37 CEST 2007


On date Friday 2007-09-14 16:44:53 +0200, Stefano Sabatini encoded:
> On date Wednesday 2007-09-12 20:34:30 +0200, Michael Niedermayer encoded:
[...]
> > 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:
[...]
> > > > 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 int 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.
[...]

I'm attaching the patches corresponding to the two approaches: I'm OK
with both of them, with a preference for the first one proposed
(program_name and program_birth_year declared as extern in cmdutils.c)
for the abovementioned reasons.

Regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-common-show-version-and-banner-02.patch
Type: text/x-diff
Size: 5272 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070922/e7db7da7/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-common-show-version-and-banner-03.patch
Type: text/x-diff
Size: 4914 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070922/e7db7da7/attachment-0001.patch>



More information about the ffmpeg-devel mailing list