[MPlayer-cvslog] r28360 - in trunk: Makefile mencoder.c mpcommon.c mpcommon.h mplayer.c version.sh

Aurelien Jacobs aurel at gnuage.org
Sun Jan 25 23:54:53 CET 2009


diego wrote:

> Author: diego
> Date: Sun Jan 25 21:35:58 2009
> New Revision: 28360
> 
> Log:
> Factorize print_version().
> 
> Modified:
>    trunk/Makefile
>    trunk/mencoder.c
>    trunk/mpcommon.c
>    trunk/mpcommon.h
>    trunk/mplayer.c
>    trunk/version.sh
> 
> [...]
> @@ -24,6 +28,47 @@ ass_track_t* ass_track = 0; // current t
>  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 */
> +}

Unrelated to this commit, but this could be written nicer, smaller,
more readable:

if (HAVE_MMX)    mp_msg(MSGT_CPLAYER,MSGL_V," MMX"  );
if (HAVE_MMX2)   mp_msg(MSGT_CPLAYER,MSGL_V," MMX2" );
if (HAVE_3DNOW)  mp_msg(MSGT_CPLAYER,MSGL_V," 3DNow");
...

Aurel



More information about the MPlayer-cvslog mailing list