Commit 02d504a7 authored by Fabrice Bellard's avatar Fabrice Bellard

more sections in help - copyright fixes

Originally committed as revision 2143 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 18bff752
...@@ -16,38 +16,31 @@ ...@@ -16,38 +16,31 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <stdlib.h> #define HAVE_AV_CONFIG_H
#include <stdio.h>
#include <string.h>
#include "common.h" #include "common.h"
#include "avformat.h" #include "avformat.h"
#include "cmdutils.h" #include "cmdutils.h"
void show_help_options(const OptionDef *options) void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
{ {
const OptionDef *po; const OptionDef *po;
int i, expert, first; int first;
printf("Main options are:\n"); first = 1;
for(i=0;i<2;i++) { for(po = options; po->name != NULL; po++) {
first = 1; char buf[64];
for(po = options; po->name != NULL; po++) { if ((po->flags & mask) == value) {
char buf[64]; if (first) {
expert = (po->flags & OPT_EXPERT) != 0; printf("%s", msg);
if (expert == i) { first = 0;
if (expert && first) { }
printf("\nAdvanced options are:\n"); strcpy(buf, po->name);
first = 0; if (po->flags & HAS_ARG) {
} strcat(buf, " ");
strcpy(buf, po->name); strcat(buf, po->argname);
if (po->flags & HAS_ARG) {
strcat(buf, " ");
strcat(buf, po->argname);
}
printf("-%-17s %s\n", buf, po->help);
} }
printf("-%-17s %s\n", buf, po->help);
} }
} }
} }
...@@ -84,7 +77,7 @@ void parse_options(int argc, char **argv, const OptionDef *options) ...@@ -84,7 +77,7 @@ void parse_options(int argc, char **argv, const OptionDef *options)
} }
if (po->flags & OPT_STRING) { if (po->flags & OPT_STRING) {
char *str; char *str;
str = strdup(arg); str = av_strdup(arg);
*po->u.str_arg = str; *po->u.str_arg = str;
} else if (po->flags & OPT_BOOL) { } else if (po->flags & OPT_BOOL) {
*po->u.int_arg = 1; *po->u.int_arg = 1;
......
...@@ -8,6 +8,9 @@ typedef struct { ...@@ -8,6 +8,9 @@ typedef struct {
#define OPT_BOOL 0x0002 #define OPT_BOOL 0x0002
#define OPT_EXPERT 0x0004 #define OPT_EXPERT 0x0004
#define OPT_STRING 0x0008 #define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020
#define OPT_GRAB 0x0040
union { union {
void (*func_arg)(const char *); void (*func_arg)(const char *);
int *int_arg; int *int_arg;
...@@ -17,7 +20,7 @@ typedef struct { ...@@ -17,7 +20,7 @@ typedef struct {
const char *argname; const char *argname;
} OptionDef; } OptionDef;
void show_help_options(const OptionDef *options); void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
void parse_options(int argc, char **argv, const OptionDef *options); void parse_options(int argc, char **argv, const OptionDef *options);
void parse_arg_file(const char *filename); void parse_arg_file(const char *filename);
void print_error(const char *filename, int err); void print_error(const char *filename, int err);
......
This diff is collapsed.
...@@ -1634,10 +1634,14 @@ const OptionDef options[] = { ...@@ -1634,10 +1634,14 @@ const OptionDef options[] = {
void show_help(void) void show_help(void)
{ {
printf("usage: ffplay [options] input_file\n" printf("ffplay version " FFMPEG_VERSION ", Copyright (c) 2003 Fabrice Bellard\n"
"usage: ffplay [options] input_file\n"
"Simple media player\n"); "Simple media player\n");
printf("\n"); printf("\n");
show_help_options(options); show_help_options(options, "Main options:\n",
OPT_EXPERT, 0);
show_help_options(options, "\nAdvanced options:\n",
OPT_EXPERT, OPT_EXPERT);
printf("\nWhile playing:\n" printf("\nWhile playing:\n"
"q, ESC quit\n" "q, ESC quit\n"
"f toggle full screen\n" "f toggle full screen\n"
......
...@@ -4477,23 +4477,27 @@ static void write_packet(FFCodec *ffenc, ...@@ -4477,23 +4477,27 @@ static void write_packet(FFCodec *ffenc,
} }
#endif #endif
static void help(void) static void show_banner(void)
{ {
printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000, 2001, 2002 Fabrice Bellard\n" printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2003 Fabrice Bellard\n");
"usage: ffserver [-L] [-h] [-f configfile]\n" }
static void show_help(void)
{
show_banner();
printf("usage: ffserver [-L] [-h] [-f configfile]\n"
"Hyper fast multi format Audio/Video streaming server\n" "Hyper fast multi format Audio/Video streaming server\n"
"\n" "\n"
"-L : print the LICENCE\n" "-L : print the LICENSE\n"
"-h : this help\n" "-h : this help\n"
"-f configfile : use configfile instead of /etc/ffserver.conf\n" "-f configfile : use configfile instead of /etc/ffserver.conf\n"
); );
} }
static void licence(void) static void show_license(void)
{ {
show_banner();
printf( printf(
"ffserver version " FFMPEG_VERSION "\n"
"Copyright (c) 2000, 2001, 2002 Fabrice Bellard\n"
"This library is free software; you can redistribute it and/or\n" "This library is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU Lesser General Public\n" "modify it under the terms of the GNU Lesser General Public\n"
"License as published by the Free Software Foundation; either\n" "License as published by the Free Software Foundation; either\n"
...@@ -4556,11 +4560,11 @@ int main(int argc, char **argv) ...@@ -4556,11 +4560,11 @@ int main(int argc, char **argv)
break; break;
switch(c) { switch(c) {
case 'L': case 'L':
licence(); show_license();
exit(1); exit(1);
case '?': case '?':
case 'h': case 'h':
help(); show_help();
exit(1); exit(1);
case 'n': case 'n':
no_launch = 1; no_launch = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment