]> git.sesse.net Git - vlc/blobdiff - modules/video_output/sdl.c
WinCE intf: get rid of VLC_OBJECT_MODULE
[vlc] / modules / video_output / sdl.c
index f39a58c744d13687809819dd5e6858a91661d223..0e1acfe48f0fb906af61b7095f5dff0f33b4c5ef 100644 (file)
@@ -135,6 +135,8 @@ vlc_module_begin();
 #endif
 vlc_module_end();
 
+static vlc_mutex_t sdl_lock = VLC_STATIC_MUTEX;
+
 /*****************************************************************************
  * OpenVideo: allocate SDL video thread output method
  *****************************************************************************
@@ -146,19 +148,16 @@ static int Open ( vlc_object_t *p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *)p_this;
     /* XXX: check for conflicts with the SDL audio output */
-    vlc_mutex_t *lock = var_AcquireMutex( "sdl" );
+    vlc_mutex_lock( &sdl_lock );
 
 #ifdef HAVE_SETENV
     char *psz_method;
 #endif
 
-    if( lock == NULL )
-        return VLC_ENOMEM;
-
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
     {
-        vlc_mutex_unlock( lock );
+        vlc_mutex_unlock( &sdl_lock );
         return VLC_ENOMEM;
     }
 
@@ -167,7 +166,7 @@ static int Open ( vlc_object_t *p_this )
     /* Check if SDL video module has been initialized */
     if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
     {
-        vlc_mutex_unlock( lock );
+        vlc_mutex_unlock( &sdl_lock );
         free( p_vout->p_sys );
         return VLC_EGENERIC;
     }
@@ -181,7 +180,7 @@ static int Open ( vlc_object_t *p_this )
     p_vout->pf_control = NULL;
 
 #ifdef HAVE_SETENV
-    psz_method = config_GetPsz( p_vout, "vout" );
+    char* psz = psz_method = config_GetPsz( p_vout, "vout" );
     if( psz_method )
     {
         while( *psz_method && *psz_method != ':' )
@@ -194,6 +193,7 @@ static int Open ( vlc_object_t *p_this )
             setenv( "SDL_VIDEODRIVER", psz_method + 1, 1 );
         }
     }
+    free( psz );
 #endif
 
     /* Initialize library */
@@ -211,11 +211,11 @@ static int Open ( vlc_object_t *p_this )
     {
         msg_Err( p_vout, "cannot initialize SDL (%s)", SDL_GetError() );
         free( p_vout->p_sys );
-        vlc_mutex_unlock( lock );
+        vlc_mutex_unlock( &sdl_lock );
         return VLC_EGENERIC;
     }
 
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &sdl_lock );
 
     /* Translate keys into unicode */
     SDL_EnableUNICODE(1);
@@ -513,11 +513,11 @@ static int Manage( vout_thread_t *p_vout )
         case SDL_QUIT:
             {
 #if 0
-                playlist_t *p_playlist = pl_Yield( p_vout );
+                playlist_t *p_playlist = pl_Hold( p_vout );
                 if( p_playlist != NULL )
                 {
                     playlist_Stop( p_playlist );
-                    pl_Release( p_playlist );
+                    pl_Release( p_vout );
                 }
 #else
 #warning FIXME FIXME ?
@@ -637,7 +637,7 @@ static int Manage( vout_thread_t *p_vout )
 /*****************************************************************************
  * Key events handling
  *****************************************************************************/
-static struct
+static const struct
 {
     SDLKey sdl_key;
     int i_vlckey;