]> git.sesse.net Git - vlc/blobdiff - src/interface/interface.c
Do not include vlc_modules.h in vlc_common.h
[vlc] / src / interface / interface.c
index 46192d83b024f6df25d1df530c5b2c9085f78ccb..43b45f28d17af44730c25f12abea815042f5072b 100644 (file)
 
 #include <assert.h>
 #include <vlc_common.h>
+#include <vlc_modules.h>
+#include <vlc_interface.h>
 
-#include <vlc_aout.h>
-#include <vlc_vout.h>
-
-#include "vlc_interface.h"
 #if defined( __APPLE__ ) || defined( WIN32 )
 #include "../control/libvlc_internal.h"
 #endif
@@ -53,7 +51,7 @@
  * Local prototypes
  *****************************************************************************/
 static void* RunInterface( vlc_object_t *p_this );
-#if defined( __APPLE__ ) || defined( WIN32 )
+#if defined( __APPLE__ )
 static void * MonitorLibVLCDeath( vlc_object_t *p_this );
 #endif
 static int AddIntfCallback( vlc_object_t *, char const *,
@@ -73,9 +71,11 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
 {
     libvlc_int_t *p_libvlc = p_this->p_libvlc;
     intf_thread_t * p_intf;
+    static const char psz_type[] = "interface";
 
     /* Allocate structure */
-    p_intf = vlc_object_create( p_libvlc, VLC_OBJECT_INTF );
+    p_intf = vlc_custom_create( p_libvlc, sizeof( *p_intf ),
+                                VLC_OBJECT_GENERIC, psz_type );
     if( !p_intf )
         return VLC_ENOMEM;
 
@@ -106,7 +106,7 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
 
     /* Attach interface to LibVLC */
     vlc_object_attach( p_intf, p_libvlc );
-#if defined( __APPLE__ ) || defined( WIN32 )
+#if defined( __APPLE__ )
     p_intf->b_should_run_on_first_thread = false;
 #endif
 
@@ -127,12 +127,7 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
     }
 
     vlc_mutex_lock( &lock );
-    if( !vlc_object_alive( p_libvlc ) )
-    {
-        vlc_mutex_unlock( &lock );
-        goto error; /* Too late! */
-    }
-#if defined( __APPLE__ ) || defined( WIN32 )
+#if defined( __APPLE__ )
     /* Hack to get Mac OS X Cocoa runtime running
      * (it needs access to the main thread) */
     if( p_intf->b_should_run_on_first_thread )
@@ -186,8 +181,6 @@ void intf_DestroyAll( libvlc_int_t *p_libvlc )
 {
     intf_thread_t *p_first;
 
-    assert( !vlc_object_alive( p_libvlc ) );
-
     vlc_mutex_lock( &lock );
     p_first = libvlc_priv( p_libvlc )->p_intf;
 #ifndef NDEBUG
@@ -230,7 +223,7 @@ static void* RunInterface( vlc_object_t *p_this )
     return NULL;
 }
 
-#if defined( __APPLE__ ) || defined( WIN32 )
+#if defined( __APPLE__ )
 #include "control/libvlc_internal.h" /* libvlc_InternalWait */
 /**
  * MonitorLibVLCDeath: Used when b_should_run_on_first_thread is set.