]> git.sesse.net Git - vlc/blobdiff - src/interface/interface.c
Interaction: unused parameter
[vlc] / src / interface / interface.c
index 6c8c9f9a3d627c2bef54b8c2b9f96ab5a2c26e83..41cb47804d6180a8a5401d49b7bfa2407b78f40b 100644 (file)
@@ -43,6 +43,9 @@
 #include <vlc_vout.h>
 
 #include "vlc_interface.h"
+#if defined( __APPLE__ ) || defined( WIN32 )
+#include "../control/libvlc_internal.h"
+#endif
 #include "libvlc.h"
 
 /*****************************************************************************
@@ -69,6 +72,7 @@ static void intf_Destroy( vlc_object_t *obj )
         module_unneed( p_intf, p_intf->p_module );
 
     free( p_intf->psz_intf );
+    config_ChainDestroy( p_intf->p_cfg );
     vlc_mutex_destroy( &p_intf->change_lock );
 }
 
@@ -89,14 +93,20 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module )
     p_intf = vlc_object_create( p_this, VLC_OBJECT_INTF );
     if( !p_intf )
         return NULL;
-    p_intf->b_interaction = false;
 #if defined( __APPLE__ ) || defined( WIN32 )
     p_intf->b_should_run_on_first_thread = false;
 #endif
 
     /* Choose the best module */
-    p_intf->psz_intf = strdup( psz_module );
-    p_intf->p_module = module_need( p_intf, "interface", psz_module, true );
+    p_intf->p_cfg = NULL;
+    char *psz_parser = *psz_module == '$'
+                     ? var_CreateGetString(p_intf,psz_module+1)
+                     : strdup( psz_module );
+    char *psz_tmp = config_ChainCreate( &p_intf->psz_intf, &p_intf->p_cfg,
+                                        psz_parser );
+    free( psz_tmp );
+    free( psz_parser );
+    p_intf->p_module = module_need( p_intf, "interface", p_intf->psz_intf, true );
 
     if( p_intf->p_module == NULL )
     {
@@ -106,10 +116,6 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module )
         return NULL;
     }
 
-    /* Initialize structure */
-    p_intf->b_menu        = false;
-    p_intf->b_menu_change = false;
-
     /* Initialize mutexes */
     vlc_mutex_init( &p_intf->change_lock );
 
@@ -135,7 +141,7 @@ int intf_RunThread( intf_thread_t *p_intf )
     if( p_intf->b_should_run_on_first_thread )
     {
         if( vlc_thread_create( p_intf, "interface", MonitorLibVLCDeath,
-                               VLC_THREAD_PRIORITY_LOW, false ) )
+                               VLC_THREAD_PRIORITY_LOW ) )
         {
             msg_Err( p_intf, "cannot spawn libvlc death monitoring thread" );
             return VLC_EGENERIC;
@@ -145,7 +151,7 @@ int intf_RunThread( intf_thread_t *p_intf )
         /* Make sure our MonitorLibVLCDeath thread exit */
         vlc_object_kill( p_intf );
         /* It is monitoring libvlc, not the p_intf */
-        vlc_object_signal( p_intf->p_libvlc );
+        vlc_object_kill( p_intf->p_libvlc );
         vlc_thread_join( p_intf );
 
         vlc_object_detach( p_intf );
@@ -155,7 +161,7 @@ int intf_RunThread( intf_thread_t *p_intf )
 #endif
     /* Run the interface in a separate thread */
     if( vlc_thread_create( p_intf, "interface", RunInterface,
-                           VLC_THREAD_PRIORITY_LOW, false ) )
+                           VLC_THREAD_PRIORITY_LOW ) )
     {
         msg_Err( p_intf, "cannot spawn interface thread" );
         return VLC_EGENERIC;
@@ -226,6 +232,7 @@ static void* RunInterface( vlc_object_t *p_this )
 }
 
 #if defined( __APPLE__ ) || defined( WIN32 )
+#include "control/libvlc_internal.h" /* libvlc_InternalWait */
 /**
  * MonitorLibVLCDeath: Used when b_should_run_on_first_thread is set.
  *
@@ -237,29 +244,9 @@ static void * MonitorLibVLCDeath( vlc_object_t * p_this )
     libvlc_int_t * p_libvlc = p_intf->p_libvlc;
     int canc = vlc_savecancel ();
 
-    vlc_object_lock( p_libvlc );
-    while(vlc_object_alive( p_libvlc ) )
-    {
-        if(p_intf->b_die)
-        {
-            vlc_object_unlock( p_libvlc );
-            return NULL;
-        }
-        vlc_object_wait( p_libvlc );
-    }
-    vlc_object_unlock( p_libvlc );
-
-    /* Someone killed libvlc */
+    libvlc_InternalWait( p_libvlc );
 
-    /* Make sure we kill all interface objects, especially
-     * those that are blocking libvlc (running on main thread) */
-    vlc_list_t * p_list = vlc_list_find( p_libvlc, VLC_OBJECT_INTF, FIND_CHILD );
-    for( int i = 0; i < p_list->i_count; i++ )
-    {
-        vlc_object_t * p_intf = p_list->p_values[i].p_object;
-        vlc_object_kill( p_intf );
-    }
-    vlc_list_release( p_list );
+    vlc_object_kill( p_intf ); /* Kill the stupid first thread interface */
     vlc_restorecancel (canc);
     return NULL;
 }