Factorize print_version().
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 25 Jan 2009 20:35:58 +0000 (20:35 +0000)
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 25 Jan 2009 20:35:58 +0000 (20:35 +0000)
Print CPU information in verbose mode instead of by default.

git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@28360 b3059339-0415-0410-9bf9-f77b7e298cf2

Makefile
mencoder.c
mpcommon.c
mpcommon.h
mplayer.c
version.sh

index ce91463..d6c8036 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -848,7 +848,7 @@ version.h:
 ###### 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)
index f3947b4..df85a37 100644 (file)
 
 #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 @@ user_correct_pts = 0;
   // 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();
index 79af866..0d64027 100644 (file)
@@ -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 @@ ass_track_t* ass_track = 0; // current track to render
 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;
index bdee63d..a0c6fb8 100644 (file)
@@ -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);
index e78dcbb..dd9e9dc 100644 (file)
--- a/mplayer.c
+++ b/mplayer.c
@@ -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 @@ static void pause_loop(void)
 #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 @@ int gui_no_filename=0;
   // 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
index c9e5dd3..50a757c 100755 (executable)
@@ -9,7 +9,7 @@ test $svn_revision || svn_revision=UNKNOWN
 
 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