changeset 28325:21504ba0f5d3

Factorize print_version(). Print CPU information in verbose mode instead of by default.
author diego
date Sun, 25 Jan 2009 20:35:58 +0000
parents 36321e2ba25a
children 51797a3b96d2
files Makefile mencoder.c mpcommon.c mpcommon.h mplayer.c version.sh
diffstat 6 files changed, 51 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Jan 25 20:10:36 2009 +0000
+++ b/Makefile	Sun Jan 25 20:35:58 2009 +0000
@@ -848,7 +848,7 @@
 ###### dependency declarations / specific CFLAGS ######
 
 codec-cfg.d: codecs.conf.h
-mencoder.d mplayer.d vobsub.d gui/win32/gui.d libmpdemux/muxer_avi.d osdep/mplayer-rc.o stream/network.d stream/stream_cddb.d: version.h
+mpcommon.d vobsub.d gui/win32/gui.d libmpdemux/muxer_avi.d osdep/mplayer-rc.o stream/network.d stream/stream_cddb.d: version.h
 $(DEPS): help_mp.h
 
 libdvdcss/%.o libdvdcss/%.d: CFLAGS += -D__USE_UNIX98 -D_GNU_SOURCE -DVERSION=\"1.2.9\" $(CFLAGS_LIBDVDCSS)
--- a/mencoder.c	Sun Jan 25 20:10:36 2009 +0000
+++ b/mencoder.c	Sun Jan 25 20:35:58 2009 +0000
@@ -36,13 +36,9 @@
 
 #include <sys/time.h>
 
-
-#include "version.h"
 #include "mp_msg.h"
 #include "help_mp.h"
 
-#include "cpudetect.h"
-
 #include "codec-cfg.h"
 #include "m_option.h"
 #include "m_config.h"
@@ -421,40 +417,7 @@
   // Preparse the command line
   m_config_preparse_command_line(mconfig,argc,argv);
 
-  mp_msg(MSGT_CPLAYER,MSGL_INFO, "MEncoder " VERSION " (C) 2000-2009 MPlayer Team\n");
-
-  /* Test for cpu capabilities (and corresponding OS support) for optimizing */
-  GetCpuCaps(&gCpuCaps);
-#if ARCH_X86
-  mp_msg(MSGT_CPLAYER,MSGL_INFO,"CPUflags: Type: %d MMX: %d MMX2: %d 3DNow: %d 3DNow2: %d SSE: %d SSE2: %d\n",
-      gCpuCaps.cpuType,gCpuCaps.hasMMX,gCpuCaps.hasMMX2,
-      gCpuCaps.has3DNow, gCpuCaps.has3DNowExt,
-      gCpuCaps.hasSSE, gCpuCaps.hasSSE2);
-#ifdef RUNTIME_CPUDETECT
-  mp_msg(MSGT_CPLAYER,MSGL_INFO, MSGTR_CompiledWithRuntimeDetection);
-#else
-  mp_msg(MSGT_CPLAYER,MSGL_INFO, MSGTR_CompiledWithCPUExtensions);
-#if HAVE_MMX
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," MMX");
-#endif
-#if HAVE_MMX2
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," MMX2");
-#endif
-#if HAVE_3DNOW
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," 3DNow");
-#endif
-#if HAVE_3DNOWEX
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," 3DNowEx");
-#endif
-#if HAVE_SSE
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," SSE");
-#endif
-#if HAVE_SSE2
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," SSE2");
-#endif
-  mp_msg(MSGT_CPLAYER,MSGL_INFO,"\n\n");
-#endif
-#endif
+  print_version("MEncoder");
 
 #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
   set_path_env();
--- a/mpcommon.c	Sun Jan 25 20:10:36 2009 +0000
+++ b/mpcommon.c	Sun Jan 25 20:35:58 2009 +0000
@@ -5,7 +5,11 @@
 #include "mplayer.h"
 #include "libvo/sub.h"
 #include "libvo/video_out.h"
+#include "cpudetect.h"
+#include "help_mp.h"
+#include "mp_msg.h"
 #include "spudec.h"
+#include "version.h"
 #include "vobsub.h"
 #ifdef CONFIG_TV_TELETEXT
 #include "stream/tv.h"
@@ -24,6 +28,47 @@
 sub_data* subdata = NULL;
 subtitle* vo_sub_last = NULL;
 
+
+void print_version(const char* name)
+{
+    mp_msg(MSGT_CPLAYER, MSGL_INFO, MP_TITLE, name);
+
+    /* Test for CPU capabilities (and corresponding OS support) for optimizing */
+    GetCpuCaps(&gCpuCaps);
+#if ARCH_X86
+    mp_msg(MSGT_CPLAYER, MSGL_V,
+	   "CPUflags:  MMX: %d MMX2: %d 3DNow: %d 3DNow2: %d SSE: %d SSE2: %d\n",
+	   gCpuCaps.hasMMX, gCpuCaps.hasMMX2,
+	   gCpuCaps.has3DNow, gCpuCaps.has3DNowExt,
+	   gCpuCaps.hasSSE, gCpuCaps.hasSSE2);
+#ifdef RUNTIME_CPUDETECT
+    mp_msg(MSGT_CPLAYER,MSGL_V, MSGTR_CompiledWithRuntimeDetection);
+#else
+    mp_msg(MSGT_CPLAYER,MSGL_V, MSGTR_CompiledWithCPUExtensions);
+#if HAVE_MMX
+    mp_msg(MSGT_CPLAYER,MSGL_V," MMX");
+#endif
+#if HAVE_MMX2
+    mp_msg(MSGT_CPLAYER,MSGL_V," MMX2");
+#endif
+#if HAVE_3DNOW
+    mp_msg(MSGT_CPLAYER,MSGL_V," 3DNow");
+#endif
+#if HAVE_3DNOWEX
+    mp_msg(MSGT_CPLAYER,MSGL_V," 3DNowEx");
+#endif
+#if HAVE_SSE
+    mp_msg(MSGT_CPLAYER,MSGL_V," SSE");
+#endif
+#if HAVE_SSE2
+    mp_msg(MSGT_CPLAYER,MSGL_V," SSE2");
+#endif
+    mp_msg(MSGT_CPLAYER,MSGL_V,"\n");
+#endif /* RUNTIME_CPUDETECT */
+#endif /* ARCH_X86 */
+}
+
+
 void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
 {
     unsigned char *packet=NULL;
--- a/mpcommon.h	Sun Jan 25 20:10:36 2009 +0000
+++ b/mpcommon.h	Sun Jan 25 20:35:58 2009 +0000
@@ -8,6 +8,8 @@
 extern double sub_last_pts;
 extern struct ass_track_s *ass_track;
 extern subtitle *vo_sub_last;
+
+void print_version(const char* name);
 void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset);
 void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset);
 int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang);
--- a/mplayer.c	Sun Jan 25 20:10:36 2009 +0000
+++ b/mplayer.c	Sun Jan 25 20:35:58 2009 +0000
@@ -36,8 +36,6 @@
 
 #include <errno.h>
 
-#include "version.h"
-
 #include "mp_msg.h"
 
 #define HELP_MP_DEFINE_STATIC
@@ -74,8 +72,6 @@
 #include "osdep/getch2.h"
 #include "osdep/timer.h"
 
-#include "cpudetect.h"
-
 #ifdef CONFIG_GUI
 #include "gui/interface.h"
 #endif
@@ -2396,43 +2392,6 @@
 #endif
 }
 
-void print_version(void){
-  mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s\n", MP_TITLE);
-
-/* Test for CPU capabilities (and corresponding OS support) for optimizing */
-  GetCpuCaps(&gCpuCaps);
-#if ARCH_X86
-  mp_msg(MSGT_CPLAYER,MSGL_INFO,"CPUflags:  MMX: %d MMX2: %d 3DNow: %d 3DNow2: %d SSE: %d SSE2: %d\n",
-      gCpuCaps.hasMMX,gCpuCaps.hasMMX2,
-      gCpuCaps.has3DNow, gCpuCaps.has3DNowExt,
-      gCpuCaps.hasSSE, gCpuCaps.hasSSE2);
-#ifdef RUNTIME_CPUDETECT
-  mp_msg(MSGT_CPLAYER,MSGL_INFO, MSGTR_CompiledWithRuntimeDetection);
-#else
-  mp_msg(MSGT_CPLAYER,MSGL_INFO, MSGTR_CompiledWithCPUExtensions);
-#if HAVE_MMX
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," MMX");
-#endif
-#if HAVE_MMX2
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," MMX2");
-#endif
-#if HAVE_3DNOW
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," 3DNow");
-#endif
-#if HAVE_3DNOWEX
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," 3DNowEx");
-#endif
-#if HAVE_SSE
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," SSE");
-#endif
-#if HAVE_SSE2
-  mp_msg(MSGT_CPLAYER,MSGL_INFO," SSE2");
-#endif
-  mp_msg(MSGT_CPLAYER,MSGL_INFO,"\n");
-#endif /* RUNTIME_CPUDETECT */
-#endif /* ARCH_X86 */
-}
-
 
 // Find the right mute status and record position for new file position
 static void edl_seek_reset(MPContext *mpctx)
@@ -2570,7 +2529,7 @@
   // Preparse the command line
   m_config_preparse_command_line(mconfig,argc,argv);
 
-  print_version();
+  print_version("MPlayer");
 #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
   set_path_env();
 #endif
--- a/version.sh	Sun Jan 25 20:10:36 2009 +0000
+++ b/version.sh	Sun Jan 25 20:35:58 2009 +0000
@@ -9,7 +9,7 @@
 
 NEW_REVISION="#define VERSION \"dev-SVN-r${svn_revision}${extra}\""
 OLD_REVISION=`cat version.h 2> /dev/null`
-TITLE="#define MP_TITLE \"MPlayer dev-SVN-r${svn_revision}${extra} (C) 2000-2009 MPlayer Team\""
+TITLE="#define MP_TITLE \"%s dev-SVN-r${svn_revision}${extra} (C) 2000-2009 MPlayer Team\\\n\""
 
 # Update version.h only on revision changes to avoid spurious rebuilds
 if test "$NEW_REVISION" != "$OLD_REVISION"; then