[FFmpeg-devel] [PATCH] Make ffserver use parse_options()

Stefano Sabatini stefano.sabatini-lala
Sun May 18 09:38:55 CEST 2008


On date Sunday 2008-05-18 03:11:56 +0200, Michael Niedermayer encoded:
> On Sun, May 18, 2008 at 12:57:10AM +0200, Stefano Sabatini wrote:
> > On date Saturday 2008-05-17 23:02:39 +0200, Michael Niedermayer encoded:
> > > On Sat, May 17, 2008 at 01:18:20PM +0200, Stefano Sabatini wrote:
> > > > Hi all, as in subject,
> > > > 
> > > > somehow improves both the user and the programmer interface of
> > > > ffserver.
> > > [...]
> > > > @@ -4339,10 +4329,45 @@
> > > >      need_to_start_children = 1;
> > > >  }
> > > >  
> > > > +static void show_help();
> > > > +
> > > > +static void opt_show_help(void)
> > > > +{
> > > > +    show_help();
> > > > +    exit(0);
> > > > +}
> > > [...]
> > > > +static void show_help()
> > > > +{
> > > > +    printf("usage: ffserver [options]\n"
> > > > +           "Hyper fast multi format Audio/Video streaming server\n");
> > > > +    printf("\n");
> > > > +    show_help_options(options, "Main options:\n", 0, 0);
> > > > +}
> > > 
> > > Am i missing something or could these 2 be merged?
> > 
> > No, you can indeed do as in the attached patch, though I don't like it
> > very much partly because I don't like forward declarations and because
> 
> You are sure aware that your code above contains that forward declaration
> as well.

Yes but it was late night yesterday...
 
> > I prefer to define consistently all the opt_* before the options
> > array, anyway i reckon this is just pickyness so do as you prefer.
> 
> Well then define them all before the array, its not my fault if you do not.

No I can't because opt_show_help() uses the options array itself, so I
have to define it before.

So please choose between:

1) splitted show_help()+ opt_show_help() with show_help() forward
declaration

2) just one opt_show_help() with opt_show_help() forward declaration

I prefer 1) since it looks more consistent for what regards the opt_*
functions, I think you prefer 2) since it's more compact.

> > (In ffplay and ffmpeg there is a reason to define two different
> > show_help and opt_show_help functions, since the help message is
> > printed also in other places not only in opt_show_help.)
> 
> Well, at least the help prining for the case of an invalid sync method
> in ffplay is very inconsistant. Other invalid parameters do not cause
> the help to be printed.

Agree.

Regards.
-- 
FFmpeg = Funny and Friendly MultiPurpose Elastic Gymnast




More information about the ffmpeg-devel mailing list