[MPlayer-cvslog] r34237 - in trunk: cfg-mplayer.h m_option.c m_option.h

ib subversion at mplayerhq.hu
Sat Oct 22 13:00:32 CEST 2011


Author: ib
Date: Sat Oct 22 13:00:31 2011
New Revision: 34237

Log:
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.

Modified:
   trunk/cfg-mplayer.h
   trunk/m_option.c
   trunk/m_option.h

Modified: trunk/cfg-mplayer.h
==============================================================================
--- trunk/cfg-mplayer.h	Sat Oct 22 02:17:28 2011	(r34236)
+++ trunk/cfg-mplayer.h	Sat Oct 22 13:00:31 2011	(r34237)
@@ -292,8 +292,8 @@ const m_option_t mplayer_opts[]={
     {"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},

Modified: trunk/m_option.c
==============================================================================
--- trunk/m_option.c	Sat Oct 22 02:17:28 2011	(r34236)
+++ trunk/m_option.c	Sat Oct 22 13:00:31 2011	(r34237)
@@ -888,6 +888,8 @@ static int parse_print(const m_option_t*
 
   if(opt->priv == NULL)
     return M_OPT_EXIT;
+  if(opt->priv == PRIV_NO_EXIT)
+    return 0;
   return 1;
 }
 

Modified: trunk/m_option.h
==============================================================================
--- trunk/m_option.h	Sat Oct 22 02:17:28 2011	(r34236)
+++ trunk/m_option.h	Sat Oct 22 13:00:31 2011	(r34237)
@@ -305,6 +305,12 @@ struct m_option {
 };
 
 
+/// \defgroup PrivFlags Private data
+/// @{
+/// Don't exit after printing a CONF_TYPE_PRINT option.
+#define PRIV_NO_EXIT (void *)-1
+///@}
+
 /// \defgroup OptionFlags Option flags
 ///@{
 


More information about the MPlayer-cvslog mailing list