changeset 17472:526abfe30498

Make -list-options work in both MPlayer and MEncoder.
author albeu
date Tue, 24 Jan 2006 11:34:24 +0000
parents 63909962d3fc
children eba63d6c1e4e
files DOCS/man/en/mplayer.1 m_config.c parser-mpcmd.c
diffstat 3 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Tue Jan 24 11:16:13 2006 +0000
+++ b/DOCS/man/en/mplayer.1	Tue Jan 24 11:34:24 2006 +0000
@@ -573,6 +573,10 @@
 Specify configuration file to be parsed after the default ones.
 .
 .TP
+.B \-list-options
+Prints all available options.
+.
+.TP
 .B \-msglevel <all=<level>:<module>=<level>:...>
 Control verbosity directly for each module.
 The 'all' module changes the verbosity of all the modules not
@@ -812,10 +816,6 @@
 Specifies a configuration file for LIRC (default: ~/\:.lircrc).
 .
 .TP
-.B \-list-options
-Prints all available options.
-.
-.TP
 .B \-loop <number>
 Loops movie playback <number> times.
 0 means forever.
--- a/m_config.c	Tue Jan 24 11:16:13 2006 +0000
+++ b/m_config.c	Tue Jan 24 11:34:24 2006 +0000
@@ -27,6 +27,9 @@
 static void
 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_new(void) {
   m_config_t* config;
@@ -35,6 +38,7 @@
   static m_option_t ref_opts[] = {
     { "profile", NULL, &profile_opt_type, CONF_NOSAVE, 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 }
   };
   int i;
@@ -576,3 +580,10 @@
   if(!config->profile_depth) mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n");
   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;
+}
--- a/parser-mpcmd.c	Tue Jan 24 11:16:13 2006 +0000
+++ b/parser-mpcmd.c	Tue Jan 24 11:34:24 2006 +0000
@@ -136,11 +136,8 @@
 
 	mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
 	// We handle here some specific option
-	if(strcasecmp(opt,"list-options") == 0) {
-	  m_config_print_option_list(config);
-	  exit(1);
-	  // Loop option when it apply to a group
-	} else if(strcasecmp(opt,"loop") == 0 &&
+	// Loop option when it apply to a group
+	if(strcasecmp(opt,"loop") == 0 &&
 		  (! last_entry || last_entry->child) ) {
 	  int l;
 	  char* end;