]> git.sesse.net Git - vlc/blobdiff - modules/video_output/sdl.c
b_menu_change: remove write-only variable
[vlc] / modules / video_output / sdl.c
index 0bc7de17d5a14157aef0ac80fd7f454adaded16d..08fb157c8643f85c694ac8f4183f2a7c0f3e7388 100644 (file)
@@ -120,20 +120,22 @@ static int ConvertKey( SDLKey );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_shortname( "SDL" );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VOUT );
-    set_description( N_("Simple DirectMedia Layer video output") );
-    set_capability( "video output", 60 );
-    add_shortcut( "sdl" );
-    add_string( "sdl-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true );
-    set_callbacks( Open, Close );
+vlc_module_begin ()
+    set_shortname( "SDL" )
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VOUT )
+    set_description( N_("Simple DirectMedia Layer video output") )
+    set_capability( "video output", 60 )
+    add_shortcut( "sdl" )
+    add_string( "sdl-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
+    set_callbacks( Open, Close )
 #if defined( __i386__ ) || defined( __x86_64__ )
     /* On i386, SDL is linked against svgalib */
-    linked_with_a_crap_library_which_uses_atexit();
+    linked_with_a_crap_library_which_uses_atexit ()
 #endif
-vlc_module_end();
+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;
     }
@@ -212,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);
@@ -460,18 +459,9 @@ static int Manage( vout_thread_t *p_vout )
 
             case SDL_BUTTON_RIGHT:
                 {
-                    intf_thread_t *p_intf;
-
                     var_Get( p_vout, "mouse-button-down", &val );
                     val.i_int &= ~4;
-                    var_Set( p_vout, "mous-button-down", val );
-                    p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF,
-                                                      FIND_ANYWHERE );
-                    if( p_intf )
-                    {
-                        p_intf->b_menu_change = 1;
-                        vlc_object_release( p_intf );
-                    }
+                    var_Set( p_vout, "mouse-button-down", val );
 
                     val.b_bool = true;
                     var_Set( p_vout->p_libvlc, "intf-popupmenu", val );
@@ -514,7 +504,7 @@ 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 );
@@ -638,7 +628,7 @@ static int Manage( vout_thread_t *p_vout )
 /*****************************************************************************
  * Key events handling
  *****************************************************************************/
-static struct
+static const struct
 {
     SDLKey sdl_key;
     int i_vlckey;