]> git.sesse.net Git - vlc/commitdiff
Use a vlc_CPU() wrapper instead of (ab)using libvlc_global
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 19 May 2007 21:43:16 +0000 (21:43 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 19 May 2007 21:43:16 +0000 (21:43 +0000)
15 files changed:
include/vlc_common.h
modules/audio_filter/converter/mpgatofixed32.c
modules/audio_output/alsa.c
modules/codec/faad.c
modules/codec/ffmpeg/encoder.c
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/postprocess.c
modules/codec/ffmpeg/scale.c
modules/codec/libmpeg2.c
modules/codec/x264.c
modules/codec/xvmc/xxmc.c
modules/stream_out/switcher.c
modules/video_filter/deinterlace.c
src/libvlc-common.c
src/misc/cpu.c

index 9beadf0f5b917ff9fe923ca32c44215535293df3..1a723690a0e31f005b78760badb6e0ea629e674c 100644 (file)
@@ -1162,6 +1162,7 @@ VLC_EXPORT( int, __vlc_execve, ( vlc_object_t *p_object, int i_argc, char *const
 #define CPU_CAPABILITY_SSE2    (1<<7)
 #define CPU_CAPABILITY_ALTIVEC (1<<16)
 #define CPU_CAPABILITY_FPU     (1<<31)
+VLC_EXPORT( unsigned, vlc_CPU, ( void ) );
 
 /*****************************************************************************
  * I18n stuff
index c6458f20378fe322ffd3a55d97884b086ce893c1..941ef0a9864771863f52e4c341445208126186fe 100644 (file)
@@ -313,7 +313,7 @@ static int OpenFilter( vlc_object_t *p_this )
     mad_synth_init( &p_sys->mad_synth );
     mad_stream_options( &p_sys->mad_stream, MAD_OPTION_IGNORECRC );
 
-    if( p_this->p_libvlc_global->i_cpu & CPU_CAPABILITY_FPU )
+    if( vlc_CPU() & CPU_CAPABILITY_FPU )
         p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
     else
         p_filter->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
index d9547bb3e98887412e70f17bada1fec3f0c153ed..35df6846ce3384b991fece91f4e4d7e73fe38825 100644 (file)
@@ -357,7 +357,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Choose the linear PCM format (read the comment above about FPU
        and float32) */
-    if( p_aout->p_libvlc_global->i_cpu & CPU_CAPABILITY_FPU )
+    if( vlc_CPU() & CPU_CAPABILITY_FPU )
     {
         i_vlc_pcm_format = VLC_FOURCC('f','l','3','2');
         i_snd_pcm_format = SND_PCM_FORMAT_FLOAT;
index 0193584f36de3b97f4a97051f5356c778e633a43..07beb3e3d36aa8f7d9ad880c38b73732f8f2fff5 100644 (file)
@@ -121,7 +121,7 @@ static int Open( vlc_object_t *p_this )
     aout_DateSet( &p_sys->date, 0 );
     p_dec->fmt_out.i_cat = AUDIO_ES;
 
-    if (p_this->p_libvlc_global->i_cpu & CPU_CAPABILITY_FPU)
+    if (vlc_CPU() & CPU_CAPABILITY_FPU)
         p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
     else
         p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Set the faad config */
     cfg = faacDecGetCurrentConfiguration( p_sys->hfaad );
-    if (p_this->p_libvlc_global->i_cpu & CPU_CAPABILITY_FPU)
+    if (vlc_CPU() & CPU_CAPABILITY_FPU)
         cfg->outputFormat = FAAD_FMT_FLOAT;
     else
         cfg->outputFormat = FAAD_FMT_16BIT;
@@ -432,7 +432,7 @@ static void DoReordering( decoder_t *p_dec,
     }
 
     /* Do the actual reordering */
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_FPU )
+    if( vlc_CPU() & CPU_CAPABILITY_FPU )
         for( i = 0; i < i_samples; i++ )
             for( j = 0; j < i_nb_channels; j++ )
                 p_out[i * i_nb_channels + pi_chan_table[j]] =
index 1b9833aa5a22ab73c695e513fbec59db99cf909c..b8a3cb0b4a29d2eb81719b361e021fe9c58a3d21 100644 (file)
@@ -261,20 +261,21 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
     p_context->opaque = (void *)p_this;
 
     /* Set CPU capabilities */
+    unsigned i_cpu = vlc_CPU();
     p_context->dsp_mask = 0;
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX) )
+    if( !(i_cpu & CPU_CAPABILITY_MMX) )
     {
         p_context->dsp_mask |= FF_MM_MMX;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT) )
+    if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
     {
         p_context->dsp_mask |= FF_MM_MMXEXT;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW) )
+    if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
     {
         p_context->dsp_mask |= FF_MM_3DNOW;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE) )
+    if( !(i_cpu & CPU_CAPABILITY_SSE) )
     {
         p_context->dsp_mask |= FF_MM_SSE;
         p_context->dsp_mask |= FF_MM_SSE2;
index 23243e1388c5f6e9a507248142330022d7d64b65..915c99381b5aae2355091d5b80e5308901e1c9f7 100644 (file)
@@ -234,7 +234,8 @@ vlc_module_begin();
     add_shortcut( "ffmpeg-deinterlace" );
 #endif
 
-    var_Create( p_module->p_libvlc_global, "avcodec", VLC_VAR_MUTEX );
+    var_Create( (vlc_object_t *)p_module->p_libvlc_global, "avcodec",
+                VLC_VAR_MUTEX );
 
 vlc_module_end();
 
@@ -284,24 +285,25 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_context->opaque = (void *)p_this;
 
     /* Set CPU capabilities */
+    unsigned i_cpu = vlc_CPU();
     p_context->dsp_mask = 0;
-    if( !(p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX) )
+    if( !(i_cpu & CPU_CAPABILITY_MMX) )
     {
         p_context->dsp_mask |= FF_MM_MMX;
     }
-    if( !(p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT) )
+    if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
     {
         p_context->dsp_mask |= FF_MM_MMXEXT;
     }
-    if( !(p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW) )
+    if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
     {
         p_context->dsp_mask |= FF_MM_3DNOW;
     }
-    if( !(p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE) )
+    if( !(i_cpu & CPU_CAPABILITY_SSE) )
     {
         p_context->dsp_mask |= FF_MM_SSE;
     }
-    if( !(p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE2) )
+    if( !(i_cpu & CPU_CAPABILITY_SSE2) )
     {
         p_context->dsp_mask |= FF_MM_SSE2;
     }
@@ -337,7 +339,7 @@ static void CloseDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys = p_dec->p_sys;
     vlc_value_t lockval;
 
-    var_Get( p_dec->p_libvlc_global, "avcodec", &lockval );
+    var_Get( (vlc_object_t *)p_dec->p_libvlc_global, "avcodec", &lockval );
 
     switch( p_sys->i_cat )
     {
@@ -426,7 +428,7 @@ void E_(InitLibavcodec)( vlc_object_t *p_object )
     static int b_ffmpeginit = 0;
     vlc_value_t lockval;
 
-    var_Get( p_object->p_libvlc_global, "avcodec", &lockval );
+    var_Get( (vlc_object_t *)p_object->p_libvlc_global, "avcodec", &lockval );
     vlc_mutex_lock( lockval.p_address );
 
     /* *** init ffmpeg library (libavcodec) *** */
index 01246b13c3ea0e0128b5f28ebb956c6779c1411d..375195f6fbcda2bf995e3ad87ca09319e336ec7a 100644 (file)
@@ -122,7 +122,7 @@ int E_(InitPostproc)( decoder_t *p_dec, void *p_data,
                       int i_width, int i_height, int pix_fmt )
 {
     video_postproc_sys_t *p_sys = (video_postproc_sys_t *)p_data;
-    int32_t i_cpu = p_dec->p_libvlc_global->i_cpu;
+    unsigned i_cpu = vlc_CPU();
     int i_flags = 0;
 
     /* Set CPU capabilities */
index 08796f9835db60157505e0a29d58197731a59d5c..5e3df4b6aa1dce74d6efc624794d9068a4473c0c 100644 (file)
@@ -115,20 +115,21 @@ int E_(OpenScaler)( vlc_object_t *p_this )
     swscale_fast_memcpy = p_filter->p_libvlc->pf_memcpy;
 
     /* Set CPU capabilities */
+    unsigned i_cpu = vlc_CPU();
     p_sys->i_cpu_mask = 0;
-    if( p_filter->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX )
+    if( i_cpu & CPU_CAPABILITY_MMX )
     {
         p_sys->i_cpu_mask |= SWS_CPU_CAPS_MMX;
     }
-    if( p_filter->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+    if( i_cpu & CPU_CAPABILITY_MMXEXT )
     {
         p_sys->i_cpu_mask |= SWS_CPU_CAPS_MMX2;
     }
-    if( p_filter->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW )
+    if( i_cpu & CPU_CAPABILITY_3DNOW )
     {
         p_sys->i_cpu_mask |= SWS_CPU_CAPS_3DNOW;
     }
-    if( p_filter->p_libvlc_global->i_cpu & CPU_CAPABILITY_ALTIVEC )
+    if( i_cpu & CPU_CAPABILITY_ALTIVEC )
     {
         p_sys->i_cpu_mask |= SWS_CPU_CAPS_ALTIVEC;
     }
index 8cb11d4e874b7b68e76e60f39a3894c3e4d5f135..8b9e1befb911efc406dec0eae008afe2659ac3fa 100644 (file)
@@ -148,23 +148,23 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->b_preroll = VLC_FALSE;
 
 #if defined( __i386__ ) || defined( __x86_64__ )
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX )
+    if( vlc_CPU() & CPU_CAPABILITY_MMX )
     {
         i_accel |= MPEG2_ACCEL_X86_MMX;
     }
 
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW )
+    if( vlc_CPU() & CPU_CAPABILITY_3DNOW )
     {
         i_accel |= MPEG2_ACCEL_X86_3DNOW;
     }
 
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+    if( vlc_CPU() & CPU_CAPABILITY_MMXEXT )
     {
         i_accel |= MPEG2_ACCEL_X86_MMXEXT;
     }
 
 #elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_ALTIVEC )
+    if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
     {
         i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
     }
index 604efda4ccf4b028d54f534f339daf1fdb23e5c8..8428ca1f906e95de72ff1737daf05e084218167d 100644 (file)
@@ -1114,19 +1114,21 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.i_fps_num = p_enc->fmt_in.video.i_frame_rate;
         p_sys->param.i_fps_den = p_enc->fmt_in.video.i_frame_rate_base;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX) )
+
+    unsigned i_cpu = vlc_CPU();
+    if( !(i_cpu & CPU_CAPABILITY_MMX) )
     {
         p_sys->param.cpu &= ~X264_CPU_MMX;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT) )
+    if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
     {
         p_sys->param.cpu &= ~X264_CPU_MMXEXT;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE) )
+    if( !(i_cpu & CPU_CAPABILITY_SSE) )
     {
         p_sys->param.cpu &= ~X264_CPU_SSE;
     }
-    if( !(p_enc->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE2) )
+    if( !(i_cpu & CPU_CAPABILITY_SSE2) )
     {
         p_sys->param.cpu &= ~X264_CPU_SSE2;
     }
index 62081fd170f3daee9c661facdd9f363feb01bb5e..d35ae3c89dae17bd1f88f00caae3ea25e94f83e4 100644 (file)
@@ -152,23 +152,23 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->b_skip     = 0;
 
 #if defined( __i386__ )
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX )
+    if( vlc_CPU() & CPU_CAPABILITY_MMX )
     {
         i_accel |= MPEG2_ACCEL_X86_MMX;
     }
 
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW )
+    if( vlc_CPU() & CPU_CAPABILITY_3DNOW )
     {
         i_accel |= MPEG2_ACCEL_X86_3DNOW;
     }
 
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+    if( vlc_CPU() & CPU_CAPABILITY_MMXEXT )
     {
         i_accel |= MPEG2_ACCEL_X86_MMXEXT;
     }
 
 #elif defined( __powerpc__ ) || defined( SYS_DARWIN )
-    if( p_dec->p_libvlc_global->i_cpu & CPU_CAPABILITY_ALTIVEC )
+    if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
     {
         i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
     }
index 11dd84bcb6d9ea0483141b9a493b7ee1b934017d..91d1867f2bf7760937fdfc9ea98bcf91500c089f 100644 (file)
@@ -352,20 +352,21 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         id->ff_enc_c = avcodec_alloc_context();
 
         /* Set CPU capabilities */
+        unsigned i_cpu = vlc_CPU();
         id->ff_enc_c->dsp_mask = 0;
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX) )
+        if( !(i_cpu & CPU_CAPABILITY_MMX) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_MMX;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT) )
+        if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW) )
+        if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE) )
+        if( !(i_cpu & CPU_CAPABILITY_SSE) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_SSE;
             id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
@@ -725,20 +726,21 @@ static mtime_t VideoCommand( sout_stream_t *p_stream, sout_stream_id_t *id )
         id->ff_enc_c = avcodec_alloc_context();
 
         /* Set CPU capabilities */
+        unsigned i_cpu = vlc_CPU();
         id->ff_enc_c->dsp_mask = 0;
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMX) )
+        if( !(i_cpu & CPU_CAPABILITY_MMX) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_MMX;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT) )
+        if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW) )
+        if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
         }
-        if( !(p_stream->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE) )
+        if( !(i_cpu & CPU_CAPABILITY_SSE) )
         {
             id->ff_enc_c->dsp_mask |= FF_MM_SSE;
             id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
index 5aae8f82ae764b363eafea7e514a22b2cc55cec2..52416aeb1e765af718de6ac07f9ac1d71642f82c 100644 (file)
@@ -207,7 +207,7 @@ static int Create( vlc_object_t *p_this )
     vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock );
 
 #if defined(CAN_COMPILE_C_ALTIVEC)
-    if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_ALTIVEC )
+    if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
     {
         p_vout->p_sys->pf_merge = MergeAltivec;
         p_vout->p_sys->pf_end_merge = NULL;
@@ -215,7 +215,7 @@ static int Create( vlc_object_t *p_this )
     else
 #endif
 #if defined(CAN_COMPILE_SSE)
-    if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE2 )
+    if( vlc_CPU() & CPU_CAPABILITY_SSE2 )
     {
         p_vout->p_sys->pf_merge = MergeSSE2;
         p_vout->p_sys->pf_end_merge = EndMMX;
@@ -223,7 +223,7 @@ static int Create( vlc_object_t *p_this )
     else
 #endif
 #if defined(CAN_COMPILE_MMXEXT)
-    if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+    if( vlc_CPU() & CPU_CAPABILITY_MMXEXT )
     {
         p_vout->p_sys->pf_merge = MergeMMXEXT;
         p_vout->p_sys->pf_end_merge = EndMMX;
@@ -231,7 +231,7 @@ static int Create( vlc_object_t *p_this )
     else
 #endif
 #if defined(CAN_COMPILE_3DNOW)
-    if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW )
+    if( vlc_CPU() & CPU_CAPABILITY_3DNOW )
     {
         p_vout->p_sys->pf_merge = Merge3DNow;
         p_vout->p_sys->pf_end_merge = End3DNow;
@@ -1965,7 +1965,7 @@ static void RenderX( vout_thread_t *p_vout,
             uint8_t *src = &p_pic->p[i_plane].p_pixels[8*y*i_src];
 
 #ifdef CAN_COMPILE_MMXEXT
-            if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+            if( vlc_CPU & CPU_CAPABILITY_MMXEXT )
                 XDeintBand8x8MMXEXT( dst, i_dst, src, i_src, i_mbx, i_modx );
             else
 #endif
@@ -1992,7 +1992,7 @@ static void RenderX( vout_thread_t *p_vout,
     }
 
 #ifdef CAN_COMPILE_MMXEXT
-    if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT )
+    if( vlc_CPU & CPU_CAPABILITY_MMXEXT )
         emms();
 #endif
 }
index 8866a453d650b764151397c1e57bc0c9b83a8bf9..51fc7392877cd6e3eac995497c1fe9e137de1533 100644 (file)
@@ -173,7 +173,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
     if( !libvlc_global.b_ready )
     {
         /* Guess what CPU we have */
-        libvlc_global.i_cpu = CPUCapabilities();
+        cpu_flags = CPUCapabilities();
        /* The module bank will be initialized later */
         libvlc_global.p_module_bank = NULL;
 
@@ -728,27 +728,27 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
     msg_Flush( p_libvlc );
 
     if( !config_GetInt( p_libvlc, "fpu" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_FPU;
+        cpu_flags &= ~CPU_CAPABILITY_FPU;
 
 #if defined( __i386__ ) || defined( __x86_64__ )
     if( !config_GetInt( p_libvlc, "mmx" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_MMX;
+        cpu_flags &= ~CPU_CAPABILITY_MMX;
     if( !config_GetInt( p_libvlc, "3dn" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_3DNOW;
+        cpu_flags &= ~CPU_CAPABILITY_3DNOW;
     if( !config_GetInt( p_libvlc, "mmxext" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_MMXEXT;
+        cpu_flags &= ~CPU_CAPABILITY_MMXEXT;
     if( !config_GetInt( p_libvlc, "sse" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_SSE;
+        cpu_flags &= ~CPU_CAPABILITY_SSE;
     if( !config_GetInt( p_libvlc, "sse2" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_SSE2;
+        cpu_flags &= ~CPU_CAPABILITY_SSE2;
 #endif
 #if defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
     if( !config_GetInt( p_libvlc, "altivec" ) )
-        libvlc_global.i_cpu &= ~CPU_CAPABILITY_ALTIVEC;
+        cpu_flags &= ~CPU_CAPABILITY_ALTIVEC;
 #endif
 
 #define PRINT_CAPABILITY( capability, string )                              \
-    if( libvlc_global.i_cpu & capability )                                         \
+    if( vlc_CPU() & capability )                                            \
     {                                                                       \
         strncat( p_capabilities, string " ",                                \
                  sizeof(p_capabilities) - strlen(p_capabilities) );         \
index c928ace1a97e01b28e5fd85ec0db0d4a7373c8ef..ec2af1f5c3eab1d8e55e93b2ab36791cac88388e 100644 (file)
@@ -51,7 +51,7 @@ static void SigHandler   ( int );
 static jmp_buf env;
 static int     i_illegal;
 #if defined( __i386__ ) || defined( __x86_64__ )
-static char   *psz_capability;
+static const char *psz_capability;
 #endif
 #endif
 
@@ -60,7 +60,7 @@ static char   *psz_capability;
  *****************************************************************************
  * This function is called to list extensions the CPU may have.
  *****************************************************************************/
-uint32_t CPUCapabilities( void )
+static uint32_t CPUCapabilities( void )
 {
     volatile uint32_t i_capabilities = CPU_CAPABILITY_NONE;
 
@@ -338,3 +338,15 @@ static void SigHandler( int i_signal )
 }
 #endif
 
+
+extern uint32_t cpu_flags = 0;
+
+
+/*****************************************************************************
+ * vlc_CPU: get pre-computed CPU capability flags
+ ****************************************************************************/
+unsigned vlc_CPU (void)
+{
+    return cpu_flags;
+}
+