[vlc-commits] control: move CONSOLE_INTRO_MSG to a private header
Rémi Denis-Courmont
git at videolan.org
Mon Mar 2 21:45:20 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 2 22:44:17 2015 +0200| [f3398a2741095ee9b5f2951c260bed8eaab111d8] | committer: Rémi Denis-Courmont
control: move CONSOLE_INTRO_MSG to a private header
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3398a2741095ee9b5f2951c260bed8eaab111d8
---
include/vlc_interface.h | 19 -------------------
modules/control/Makefile.am | 4 ++--
modules/control/dummy.c | 3 ++-
modules/control/intromsg.h | 38 ++++++++++++++++++++++++++++++++++++++
modules/control/rc.c | 3 ++-
5 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index f5a888d..ca1c564 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -114,25 +114,6 @@ VLC_API void vlc_LogSet(libvlc_int_t *, vlc_log_cb cb, void *data);
/*@}*/
-#if defined( _WIN32 ) && !VLC_WINSTORE_APP
-# define CONSOLE_INTRO_MSG \
- if( !getenv( "PWD" ) ) /* detect Cygwin shell or Wine */ \
- { \
- AllocConsole(); \
- freopen( "CONOUT$", "w", stdout ); \
- freopen( "CONOUT$", "w", stderr ); \
- freopen( "CONIN$", "r", stdin ); \
- } \
- msg_Info( p_intf, "VLC media player - %s", VERSION_MESSAGE ); \
- msg_Info( p_intf, "%s", COPYRIGHT_MESSAGE ); \
- msg_Info( p_intf, _("\nWarning: if you cannot access the GUI " \
- "anymore, open a command-line window, go to the " \
- "directory where you installed VLC and run " \
- "\"vlc -I qt\"\n") )
-#else
-# define CONSOLE_INTRO_MSG (void)0
-#endif
-
/* Interface dialog ids for dialog providers */
typedef enum vlc_dialog {
INTF_DIALOG_FILE_SIMPLE = 1,
diff --git a/modules/control/Makefile.am b/modules/control/Makefile.am
index f4d0d6a..70a8486 100644
--- a/modules/control/Makefile.am
+++ b/modules/control/Makefile.am
@@ -1,12 +1,12 @@
controldir = $(pluginsdir)/control
-libdummy_plugin_la_SOURCES = control/dummy.c
+libdummy_plugin_la_SOURCES = control/dummy.c control/intromsg.h
libgestures_plugin_la_SOURCES = control/gestures.c
libhotkeys_plugin_la_SOURCES = control/hotkeys.c
libhotkeys_plugin_la_LIBADD = $(LIBM)
libnetsync_plugin_la_SOURCES = control/netsync.c
libnetsync_plugin_la_LIBADD = $(SOCKET_LIBS)
-liboldrc_plugin_la_SOURCES = control/rc.c
+liboldrc_plugin_la_SOURCES = control/rc.c control/intromsg.h
liboldrc_plugin_la_LIBADD = $(SOCKET_LIBS) $(LIBM)
control_LTLIBRARIES = \
diff --git a/modules/control/dummy.c b/modules/control/dummy.c
index c0bc3cd..e541698 100644
--- a/modules/control/dummy.c
+++ b/modules/control/dummy.c
@@ -40,6 +40,7 @@
"Enabling the quiet mode will not bring this command box but can also " \
"be pretty annoying when you want to stop VLC and no video window is " \
"open." )
+#include "intromsg.h"
#endif
static int Open( vlc_object_t * );
@@ -65,7 +66,7 @@ static int Open( vlc_object_t *p_this )
bool b_quiet;
b_quiet = var_InheritBool( p_intf, "dummy-quiet" );
if( !b_quiet )
- CONSOLE_INTRO_MSG;
+ intf_consoleIntroMsg(p_intf);
#endif
msg_Info( p_intf, "using the dummy interface module..." );
diff --git a/modules/control/intromsg.h b/modules/control/intromsg.h
new file mode 100644
index 0000000..7af9520
--- /dev/null
+++ b/modules/control/intromsg.h
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * intromsg.h
+ *****************************************************************************
+ * Copyright (C) 1999-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+static inline void intf_consoleIntroMsg(intf_thread_t *intf)
+{
+ if (getenv( "PWD" ) == NULL) /* detect Cygwin shell or Wine */
+ {
+ AllocConsole();
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ freopen("CONIN$", "r", stdin);
+ }
+
+ msg_Info(intf, "VLC media player - %s", VERSION_MESSAGE);
+ msg_Info(intf, "%s", COPYRIGHT_MESSAGE);
+ msg_Info(intf, _("\nWarning: if you cannot access the GUI "
+ "anymore, open a command-line window, go to the "
+ "directory where you installed VLC and run "
+ "\"vlc -I qt\"\n"));
+}
diff --git a/modules/control/rc.c b/modules/control/rc.c
index d3c8673..efa1893 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -178,6 +178,7 @@ static void msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
"Enabling the quiet mode will not bring this command box but can also " \
"be pretty annoying when you want to stop VLC and no video window is " \
"open." )
+#include "intromsg.h"
#endif
vlc_module_begin ()
@@ -342,7 +343,7 @@ static int Activate( vlc_object_t *p_this )
p_sys->b_quiet = var_InheritBool( p_intf, "rc-quiet" );
# if !VLC_WINSTORE_APP
if( !p_sys->b_quiet )
- CONSOLE_INTRO_MSG;
+ intf_consoleIntroMsg( p_intf );
# endif
#endif
More information about the vlc-commits
mailing list