cmdutils: change the signature of the function argument in parse_options()
This is required for a pending simplification.
This commit is contained in:
parent
0d0fdb0ad5
commit
96f931adf7
@ -217,7 +217,7 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
|
|||||||
#endif /* WIN32 && !__MINGW32CE__ */
|
#endif /* WIN32 && !__MINGW32CE__ */
|
||||||
|
|
||||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||||
void (* parse_arg_function)(const char*))
|
int (* parse_arg_function)(const char *opt, const char *arg))
|
||||||
{
|
{
|
||||||
const char *opt, *arg;
|
const char *opt, *arg;
|
||||||
int optindex, handleoptions=1;
|
int optindex, handleoptions=1;
|
||||||
@ -284,8 +284,10 @@ unknown_opt:
|
|||||||
if(po->flags & OPT_EXIT)
|
if(po->flags & OPT_EXIT)
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
if (parse_arg_function)
|
if (parse_arg_function) {
|
||||||
parse_arg_function(opt);
|
if (parse_arg_function(NULL, opt) < 0)
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
|
|||||||
* not have to be processed.
|
* not have to be processed.
|
||||||
*/
|
*/
|
||||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||||
void (* parse_arg_function)(const char*));
|
int (* parse_arg_function)(const char *opt, const char *arg));
|
||||||
|
|
||||||
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
|
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
|
||||||
|
|
||||||
|
3
ffmpeg.c
3
ffmpeg.c
@ -3855,7 +3855,7 @@ static int opt_streamid(const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void opt_output_file(const char *filename)
|
static int opt_output_file(const char *opt, const char *filename)
|
||||||
{
|
{
|
||||||
AVFormatContext *oc;
|
AVFormatContext *oc;
|
||||||
int err, use_video, use_audio, use_subtitle, use_data;
|
int err, use_video, use_audio, use_subtitle, use_data;
|
||||||
@ -3984,6 +3984,7 @@ static void opt_output_file(const char *filename)
|
|||||||
av_freep(&forced_key_frames);
|
av_freep(&forced_key_frames);
|
||||||
uninit_opts();
|
uninit_opts();
|
||||||
init_opts();
|
init_opts();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* same option as mencoder */
|
/* same option as mencoder */
|
||||||
|
3
ffplay.c
3
ffplay.c
@ -3006,7 +3006,7 @@ static void show_help(void)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void opt_input_file(const char *filename)
|
static int opt_input_file(const char *opt, const char *filename)
|
||||||
{
|
{
|
||||||
if (input_filename) {
|
if (input_filename) {
|
||||||
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||||
@ -3016,6 +3016,7 @@ static void opt_input_file(const char *filename)
|
|||||||
if (!strcmp(filename, "-"))
|
if (!strcmp(filename, "-"))
|
||||||
filename = "pipe:";
|
filename = "pipe:";
|
||||||
input_filename = filename;
|
input_filename = filename;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from the main */
|
/* Called from the main */
|
||||||
|
@ -339,7 +339,7 @@ static int opt_format(const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void opt_input_file(const char *arg)
|
static int opt_input_file(const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
if (input_filename) {
|
if (input_filename) {
|
||||||
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||||
@ -349,6 +349,7 @@ static void opt_input_file(const char *arg)
|
|||||||
if (!strcmp(arg, "-"))
|
if (!strcmp(arg, "-"))
|
||||||
arg = "pipe:";
|
arg = "pipe:";
|
||||||
input_filename = arg;
|
input_filename = arg;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_help(void)
|
static void show_help(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user