changeset 34149:11d9ef2177ec

Improve option type CONF_TYPE_PRINT. Allow printing options that neither exit MPlayer nor need an "extra option" in order to work. This fixes that mplayer -gui file won't play, while mplayer -gui -v file for example does.
author ib
date Sat, 22 Oct 2011 11:00:31 +0000
parents 61e3181426d8
children 05c4e9ce128f
files cfg-mplayer.h m_option.c m_option.h
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Sat Oct 22 00:17:28 2011 +0000
+++ b/cfg-mplayer.h	Sat Oct 22 11:00:31 2011 +0000
@@ -292,8 +292,8 @@
     {"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
 #endif
 
-    {"gui", "The -gui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, (void *)1},
-    {"nogui", "The -nogui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, (void *)1},
+    {"gui", "The -gui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, PRIV_NO_EXIT},
+    {"nogui", "The -nogui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, PRIV_NO_EXIT},
 
 #ifdef CONFIG_GUI
     {"skin", &skinName, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
--- a/m_option.c	Sat Oct 22 00:17:28 2011 +0000
+++ b/m_option.c	Sat Oct 22 11:00:31 2011 +0000
@@ -888,6 +888,8 @@
 
   if(opt->priv == NULL)
     return M_OPT_EXIT;
+  if(opt->priv == PRIV_NO_EXIT)
+    return 0;
   return 1;
 }
 
--- a/m_option.h	Sat Oct 22 00:17:28 2011 +0000
+++ b/m_option.h	Sat Oct 22 11:00:31 2011 +0000
@@ -305,6 +305,12 @@
 };
 
 
+/// \defgroup PrivFlags Private data
+/// @{
+/// Don't exit after printing a CONF_TYPE_PRINT option.
+#define PRIV_NO_EXIT (void *)-1
+///@}
+
 /// \defgroup OptionFlags Option flags
 ///@{