Make -list-options work in both MPlayer and MEncoder.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17473 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2006-01-24 11:34:24 +00:00
parent d4d62bbc65
commit 7f28974433
3 changed files with 17 additions and 9 deletions

View File

@ -573,6 +573,10 @@ instead of the builtin codecs.conf.
Specify configuration file to be parsed after the default ones. Specify configuration file to be parsed after the default ones.
. .
.TP .TP
.B \-list-options
Prints all available options.
.
.TP
.B \-msglevel <all=<level>:<module>=<level>:...> .B \-msglevel <all=<level>:<module>=<level>:...>
Control verbosity directly for each module. Control verbosity directly for each module.
The 'all' module changes the verbosity of all the modules not The 'all' module changes the verbosity of all the modules not
@ -812,10 +816,6 @@ set it to 2 for Linux or 1024 for Windows.
Specifies a configuration file for LIRC (default: ~/\:.lircrc). Specifies a configuration file for LIRC (default: ~/\:.lircrc).
. .
.TP .TP
.B \-list-options
Prints all available options.
.
.TP
.B \-loop <number> .B \-loop <number>
Loops movie playback <number> times. Loops movie playback <number> times.
0 means forever. 0 means forever.

View File

@ -27,6 +27,9 @@ show_profile(m_option_t *opt, char* name, char *param);
static void static void
m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix); m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix);
static int
list_options(m_option_t *opt, char* name, char *param);
m_config_t* m_config_t*
m_config_new(void) { m_config_new(void) {
m_config_t* config; m_config_t* config;
@ -35,6 +38,7 @@ m_config_new(void) {
static m_option_t ref_opts[] = { static m_option_t ref_opts[] = {
{ "profile", NULL, &profile_opt_type, CONF_NOSAVE, 0, 0, NULL }, { "profile", NULL, &profile_opt_type, CONF_NOSAVE, 0, 0, NULL },
{ "show-profile", show_profile, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL }, { "show-profile", show_profile, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
{ "list-options", list_options, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
{ NULL, NULL, NULL, 0, 0, 0, NULL } { NULL, NULL, NULL, 0, 0, 0, NULL }
}; };
int i; int i;
@ -576,3 +580,10 @@ show_profile(m_option_t *opt, char* name, char *param) {
if(!config->profile_depth) mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n"); if(!config->profile_depth) mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n");
return M_OPT_EXIT-1; return M_OPT_EXIT-1;
} }
static int
list_options(m_option_t *opt, char* name, char *param) {
m_config_t* config = opt->priv;
m_config_print_option_list(config);
return M_OPT_EXIT;
}

View File

@ -136,11 +136,8 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt); mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
// We handle here some specific option // We handle here some specific option
if(strcasecmp(opt,"list-options") == 0) { // Loop option when it apply to a group
m_config_print_option_list(config); if(strcasecmp(opt,"loop") == 0 &&
exit(1);
// Loop option when it apply to a group
} else if(strcasecmp(opt,"loop") == 0 &&
(! last_entry || last_entry->child) ) { (! last_entry || last_entry->child) ) {
int l; int l;
char* end; char* end;