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

Stefano Sabatini stefano.sabatini-lala
Sat Nov 29 13:23:43 CET 2008


On date Tuesday 2008-11-25 22:42:56 +0100, Stefano Sabatini encoded:
> On date Saturday 2008-11-22 21:54:52 +0100, Stefano Sabatini encoded:
> > On date Saturday 2008-11-08 17:19:34 +0100, Stefano Sabatini encoded:
> > > On date Tuesday 2008-10-28 23:14:08 +0100, Stefano Sabatini encoded:
> > > [...]
> > > > Index: ffmpeg.c
> > > > ===================================================================
> > > > --- ffmpeg.c	(revision 15731)
> > > > +++ ffmpeg.c	(working copy)
> > > > @@ -91,6 +91,8 @@
> > > >  
> > > >  #define MAX_FILES 20
> > > >  
> > > > +static const char *cmdline_program_name;
> > > > +
> > > >  static AVFormatContext *input_files[MAX_FILES];
> > > >  static int64_t input_files_ts_offset[MAX_FILES];
> > > >  static double input_files_ts_scale[MAX_FILES][MAX_STREAMS];
> > > > @@ -3447,8 +3449,8 @@
> > > >  static void show_help(void)
> > > >  {
> > > >      av_log_set_callback(log_callback_help);
> > > > -    printf("usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}...\n"
> > > > -           "Hyper fast Audio and Video encoder\n");
> > > > +    printf("usage: %s [[infile options] -i infile]... {[outfile options] outfile}...\n"
> > > > +           "Hyper fast Audio and Video encoder\n", cmdline_program_name);
> > > >      printf("\n");
> > > >      show_help_options(options, "Main options:\n",
> > > >                        OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0);
> > > > @@ -3859,6 +3861,8 @@
> > > >      int i;
> > > >      int64_t ti;
> > > >  
> > > > +    cmdline_program_name = argv[0];
> > > > +
> > > >      avcodec_register_all();
> > > >      avdevice_register_all();
> > > >      av_register_all();
> > > > Index: ffplay.c
> > > > ===================================================================
> > > > --- ffplay.c	(revision 15731)
> > > > +++ ffplay.c	(working copy)
> > > > @@ -177,6 +177,8 @@
> > > >  static void show_help(void);
> > > >  static int audio_write_get_buf_size(VideoState *is);
> > > >  
> > > > +static const char *cmdline_program_name;
> > > > +
> > > >  /* options specified by the user */
> > > >  static AVInputFormat *file_iformat;
> > > >  static const char *input_filename;
> > > > @@ -2504,8 +2506,8 @@
> > > >  
> > > >  static void show_help(void)
> > > >  {
> > > > -    printf("usage: ffplay [options] input_file\n"
> > > > -           "Simple media player\n");
> > > > +    printf("usage: %s [options] input_file\n"
> > > > +           "Simple media player\n", cmdline_program_name);
> > > >      printf("\n");
> > > >      show_help_options(options, "Main options:\n",
> > > >                        OPT_EXPERT, 0);
> > > > @@ -2537,6 +2539,8 @@
> > > >  {
> > > >      int flags, i;
> > > >  
> > > > +    cmdline_program_name = argv[0];
> > > > +
> > > >      /* register all codecs, demux and protocols */
> > > >      avcodec_register_all();
> > > >      avdevice_register_all();
> > > > Index: ffserver.c
> > > > ===================================================================
> > > > --- ffserver.c	(revision 15731)
> > > > +++ ffserver.c	(working copy)
> > > > @@ -242,6 +242,8 @@
> > > >      float avg_frame_size;   /* frame size averaged over last frames with exponential mean */
> > > >  } FeedData;
> > > >  
> > > > +static const char *cmdline_program_name;
> > > > +
> > > >  static struct sockaddr_in my_http_addr;
> > > >  static struct sockaddr_in my_rtsp_addr;
> > > >  
> > > > @@ -4450,8 +4452,8 @@
> > > >  
> > > >  static void opt_show_help(void)
> > > >  {
> > > > -    printf("usage: FFserver [options]\n"
> > > > -           "Hyper fast multi format Audio/Video streaming server\n");
> > > > +    printf("usage: %s [options]\n"
> > > > +           "Hyper fast multi format Audio/Video streaming server\n", cmdline_program_name);
> > > >      printf("\n");
> > > >      show_help_options(options, "Main options:\n", 0, 0);
> > > >  }
> > > > @@ -4471,6 +4473,8 @@
> > > >  {
> > > >      struct sigaction sigact;
> > > >  
> > > > +    cmdline_program_name = argv[0];
> > > > +
> > > >      av_register_all();
> > > >  
> > > >      show_banner();
> > > 
> > > Ping?
> > > 
> > > Well, if you consider this overkill then I'll simply revert
> > >       printf("usage: FFserver [options]\n"
> > > to    printf("usage: ffserver [options]\n"
> > > 
> > > ;-).
> > 
> > Ping2.
> 
> Since doesn't seem to be interest to apply this, then I propose the
> simple fix (I'll apply it in the weekend).
[...]
> Index: ffserver.c
> ===================================================================
> --- ffserver.c	(revision 15925)
> +++ ffserver.c	(working copy)
> @@ -4450,7 +4450,7 @@
>  
>  static void opt_show_help(void)
>  {
> -    printf("usage: FFserver [options]\n"
> +    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);

Applied, if Michael like the hairy solution then I'll apply that,
otherwise I'm already satisfied with the simple fix.

Regards.
-- 
FFmpeg = Funny and Forgiving Monstrous Picky Exuberant Ghost




More information about the ffmpeg-devel mailing list