]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
A bit of headers cleanup
[vlc] / modules / control / hotkeys.c
index fe0c9b6dc5192e59377e7f1540827cf96f6d6c77..b14f253fa98022e3d4c350ee7a9f6cb76fcaa2b8 100644 (file)
 #include <stdlib.h>                                      /* malloc(), free() */
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/input.h>
-#include <vlc/vout.h>
-#include <vlc/aout.h>
+#include <vlc_interface.h>
+#include <vlc_input.h>
+#include <vlc_vout.h>
+#include <vlc_aout.h>
 #include <vlc_osd.h>
-
+#include <vlc_playlist.h>
 #include "vlc_keys.h"
 
 #define BUFFER_SIZE 10
@@ -135,6 +135,7 @@ static void Close( vlc_object_t *p_this )
     {
         vlc_object_release( p_intf->p_sys->p_vout );
     }
+    vlc_mutex_destroy( &p_intf->p_sys->change_lock );
     /* Destroy structure */
     free( p_intf->p_sys );
 }
@@ -170,7 +171,7 @@ static void Run( intf_thread_t *p_intf )
         int i_times = 0;
 
         /* Sleep a bit */
-        msleep( INTF_IDLE_SLEEP );
+//        msleep( INTF_IDLE_SLEEP );
 
         /* Update the input */
         if( p_intf->p_sys->p_input == NULL )
@@ -228,8 +229,11 @@ static void Run( intf_thread_t *p_intf )
 
         if( !i_action )
         {
+            vlc_mutex_lock( &p_intf->object_lock );
+            vlc_cond_wait( &p_intf->object_wait, &p_intf->object_lock );
+            vlc_mutex_unlock( &p_intf->object_lock );
             /* No key pressed, sleep a bit more */
-            msleep( INTF_IDLE_SLEEP );
+//            msleep( INTF_IDLE_SLEEP );
             continue;
         }
 
@@ -746,6 +750,9 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
         p_intf->p_sys->p_keys[ p_intf->p_sys->i_size ] = newval.i_int;
         p_intf->p_sys->i_size++;
     }
+    vlc_mutex_lock( &p_intf->object_lock );
+    vlc_cond_signal( &p_intf->object_wait );
+    vlc_mutex_unlock( &p_intf->object_lock );
     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
 
     return VLC_SUCCESS;
@@ -790,16 +797,16 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
     var_Get( p_intf, psz_bookmark_name, &val );
 
     char *psz_bookmark = strdup( val.psz_string );
-    for( i = 0; i < p_playlist->i_size; i++)
-    {
-        if( !strcmp( psz_bookmark,
-                     p_playlist->pp_items[i]->p_input->psz_uri ) )
+    PL_LOCK;
+    FOREACH_ARRAY( playlist_item_t *p_item, p_playlist->items )
+        if( !strcmp( psz_bookmark, p_item->p_input->psz_uri ) )
         {
-            playlist_LockControl( p_playlist, PLAYLIST_VIEWPLAY, NULL,
-                                  p_playlist->pp_items[i] );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE,
+                              NULL, p_item );
             break;
         }
-    }
+    FOREACH_END();
+    PL_UNLOCK;
     vlc_object_release( p_playlist );
 }