[FFmpeg-devel] [PATCH] Define cmdline_program_name and use it in show_help

Stefano Sabatini stefano.sabatini-lala
Tue Oct 28 20:58:24 CET 2008


On date Tuesday 2008-10-28 13:40:48 +0100, Aurelien Jacobs encoded:
> Stefano Sabatini wrote:
> 
> > On date Monday 2008-10-27 13:46:24 +0100, Luca Abeni encoded:
> > > Hi all,
> > > 
> > > Aurelien Jacobs wrote:
> > > [...]
> > > >>> Index: ffmpeg.c
> > > >>> ===================================================================
> > > >>> --- ffmpeg.c	(revision 15712)
> > > >>> +++ ffmpeg.c	(working copy)
> > > >>> @@ -71,6 +71,7 @@
> > > >>>  #undef exit
> > > >>>  
> > > >>>  const char program_name[] = "FFmpeg";
> > > >>> +const char* cmdline_program_name = NULL;
> > > >>>   
> > > >> why is it not static ? btw, I'd prefer char *foo to char* foo, but maybe
> > > >> that's just me...
> > > > 
> > > > I also prefer char *foo.
> > > > And no need to initialize it to NULL.
> > 
> > OK.
> >  
> > > Maybe this is a stupid question, but... Why using a global variable instead
> > > of passing argv[0] as an argument to show_help() (in ffplay.c and ffmpeg.c)?
> > 
> > For consistency with program_name, no strong opinion on this.
> 
> This don't give more consistency. program_name is used in other .c files,
> while cmdline_program_name is not.

Yes.

> If show_help() is only called from main, then passing argv[0] is definitely
> the way to go.

The problem is that show_help is called by cmdline.c:parse_options,
where the OPT_EXIT callback is not meant to take an argument.

We could change the OPT_EXIT callback to take an opaque argument, but
this would look overkill (well, maybe this patch too is overkill...).

So making the cmdline_program_name vars globals looks to me the better
compromise.

Regards.
-- 
FFmpeg = Free Freak Multimedia Pitiless Evanescent God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: define-cmdline-program-name-02.patch
Type: text/x-diff
Size: 3010 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081028/dd317fc1/attachment.patch>



More information about the ffmpeg-devel mailing list