Commit e78c0487 authored by michael's avatar michael

OPT_EXIT


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13231 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d8844fda
...@@ -149,6 +149,8 @@ unknown_opt: ...@@ -149,6 +149,8 @@ unknown_opt:
} else { } else {
po->u.func_arg(arg); po->u.func_arg(arg);
} }
if(po->flags & OPT_EXIT)
exit(0);
} else { } else {
if (parse_arg_function) if (parse_arg_function)
parse_arg_function(opt); parse_arg_function(opt);
......
...@@ -70,6 +70,7 @@ typedef struct { ...@@ -70,6 +70,7 @@ typedef struct {
#define OPT_SUBTITLE 0x0200 #define OPT_SUBTITLE 0x0200
#define OPT_FUNC2 0x0400 #define OPT_FUNC2 0x0400
#define OPT_INT64 0x0800 #define OPT_INT64 0x0800
#define OPT_EXIT 0x1000
union { union {
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
int *int_arg; int *int_arg;
......
...@@ -3499,7 +3499,6 @@ static void opt_show_formats(void) ...@@ -3499,7 +3499,6 @@ static void opt_show_formats(void)
"even though both encoding and decoding are supported. For example, the h263\n" "even though both encoding and decoding are supported. For example, the h263\n"
"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n" "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
"worse.\n"); "worse.\n");
av_exit(0);
} }
static void parse_matrix_coeffs(uint16_t *dest, const char *str) static void parse_matrix_coeffs(uint16_t *dest, const char *str)
...@@ -3574,12 +3573,6 @@ static void show_help(void) ...@@ -3574,12 +3573,6 @@ static void show_help(void)
av_opt_show(sws_opts, NULL); av_opt_show(sws_opts, NULL);
} }
static void opt_show_help(void)
{
show_help();
av_exit(0);
}
static void opt_target(const char *arg) static void opt_target(const char *arg)
{ {
int norm = -1; int norm = -1;
...@@ -3763,12 +3756,6 @@ static int opt_bsf(const char *opt, const char *arg) ...@@ -3763,12 +3756,6 @@ static int opt_bsf(const char *opt, const char *arg)
return 0; return 0;
} }
static void opt_show_license(void)
{
show_license();
av_exit(0);
}
static void opt_show_version(void) static void opt_show_version(void)
{ {
show_version(program_name); show_version(program_name);
...@@ -3777,10 +3764,10 @@ static void opt_show_version(void) ...@@ -3777,10 +3764,10 @@ static void opt_show_version(void)
static const OptionDef options[] = { static const OptionDef options[] = {
/* main options */ /* main options */
{ "L", 0, {(void*)opt_show_license}, "show license" }, { "L", OPT_EXIT, {(void*)show_license}, "show license" },
{ "h", 0, {(void*)opt_show_help}, "show help" }, { "h", OPT_EXIT, {(void*)show_help}, "show help" },
{ "version", 0, {(void*)opt_show_version}, "show version" }, { "version", 0, {(void*)opt_show_version}, "show version" },
{ "formats", 0, {(void*)opt_show_formats}, "show available formats, codecs, protocols, ..." }, { "formats", OPT_EXIT, {(void*)opt_show_formats}, "show available formats, codecs, protocols, ..." },
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" }, { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
{ "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" }, { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
{ "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" }, { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
......
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