]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
Do not translate "". Fix the localized configuration file.
[vlc] / src / libvlc.c
index fb7aa5257967965797b680513ca7e971eec2b113..1281f62cee67dfbbb34da3d6f5beb5bef39fe3d2 100644 (file)
@@ -42,7 +42,6 @@
 
 #include "modules/modules.h"
 #include "config/configuration.h"
-#include "interface/interface.h"
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
@@ -258,7 +257,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
 
     priv = libvlc_priv (p_libvlc);
     priv->p_playlist = NULL;
-    priv->p_interaction = NULL;
+    priv->p_dialog_provider = NULL;
     priv->p_vlm = NULL;
     p_libvlc->psz_object_name = strdup( "libvlc" );
 
@@ -791,16 +790,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     priv->i_timers = 0;
     priv->pp_timers = NULL;
 
-    /* Init stats */
-    p_libvlc->p_stats = (global_stats_t *)malloc( sizeof( global_stats_t ) );
-    if( !p_libvlc->p_stats )
-    {
-        vlc_object_release( p_libvlc );
-        return VLC_ENOMEM; /* FIXME: leaks */
-    }
-    vlc_mutex_init( &p_libvlc->p_stats->lock );
-    priv->p_stats_computer = NULL;
-
     priv->i_last_input_id = 0; /* Not very safe, should be removed */
 
     /*
@@ -814,9 +803,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     var_AddCallback( p_libvlc, "key-pressed", vlc_key_to_action,
                      p_libvlc->p_hotkeys );
 
-    /* Initialize interaction */
-    priv->p_interaction = interaction_Init( p_libvlc );
-
     /* Initialize playlist and get commandline files */
     p_playlist = playlist_Create( VLC_OBJECT(p_libvlc) );
     if( !p_playlist )
@@ -984,9 +970,9 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      */
     var_Create( p_libvlc, "drawable-xid", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_ADDRESS );
-#ifdef __APPLE__
-    var_Create( p_libvlc, "drawable", VLC_VAR_INTEGER );
-#endif
+    var_Create( p_libvlc, "drawable-agl", VLC_VAR_INTEGER );
+    var_Create( p_libvlc, "drawable-gl", VLC_VAR_INTEGER );
+
     var_Create( p_libvlc, "drawable-view-top", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-view-left", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-view-bottom", VLC_VAR_INTEGER );
@@ -1072,16 +1058,10 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 
     vlc_object_release( p_playlist );
 
-    /* Free interaction */
-    msg_Dbg( p_libvlc, "removing interaction" );
-    interaction_Destroy( priv->p_interaction );
-
     stats_TimersDumpAll( p_libvlc );
     stats_TimersCleanAll( p_libvlc );
 
     msg_Dbg( p_libvlc, "removing stats" );
-    vlc_mutex_destroy( &p_libvlc->p_stats->lock );
-    FREENULL( p_libvlc->p_stats );
 
 #ifndef WIN32
     char* psz_pidfile = NULL;
@@ -1145,6 +1125,13 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
     vlc_mutex_destroy( &priv->config_lock );
     vlc_mutex_destroy( &priv->timer_lock );
 
+#ifndef NDEBUG /* Hack to dump leaked objects tree */
+    if( vlc_internals( p_libvlc )->i_refcount > 1 )
+        while( vlc_internals( p_libvlc )->i_refcount > 0 )
+            vlc_object_release( p_libvlc );
+#endif
+
+    assert( vlc_internals( p_libvlc )->i_refcount == 1 );
     vlc_object_release( p_libvlc );
 }
 
@@ -1171,7 +1158,9 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
                 psz_module = "dummy";
             else
 #endif
-                msg_Info( p_libvlc, _("Running vlc with the default interface. Use 'cvlc' to use vlc without interface.") );
+                msg_Info( p_libvlc, "%s",
+                          _("Running vlc with the default interface. "
+                            "Use 'cvlc' to use vlc without interface.") );
         }
         free( psz_interface );
     }
@@ -1197,6 +1186,8 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
     return VLC_SUCCESS;
 };
 
+static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
+
 /**
  * Waits until the LibVLC instance gets an exit signal. Normally, this happens
  * when the user "exits" an interface plugin.
@@ -1204,12 +1195,11 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
 void libvlc_InternalWait( libvlc_int_t *p_libvlc )
 {
     libvlc_priv_t *priv = libvlc_priv( p_libvlc );
-    vlc_object_internals_t *internals = vlc_internals( p_libvlc );
 
-    vlc_object_lock( p_libvlc );
+    vlc_mutex_lock( &exit_lock );
     while( vlc_object_alive( p_libvlc ) )
-        vlc_cond_wait( &priv->exiting, &internals->lock );
-    vlc_object_unlock( p_libvlc );
+        vlc_cond_wait( &priv->exiting, &exit_lock );
+    vlc_mutex_unlock( &exit_lock );
 }
 
 /**
@@ -1220,8 +1210,10 @@ void libvlc_Quit( libvlc_int_t *p_libvlc )
 {
     libvlc_priv_t *priv = libvlc_priv( p_libvlc );
 
+    vlc_mutex_lock( &exit_lock );
     vlc_object_kill( p_libvlc );
-    vlc_cond_signal( &priv->exiting ); /* OK, kill took care of the lock */
+    vlc_cond_signal( &priv->exiting );
+    vlc_mutex_unlock( &exit_lock );
 }
 
 #if defined( ENABLE_NLS ) && (defined (__APPLE__) || defined (WIN32)) && \
@@ -1984,7 +1976,7 @@ static void Version( void )
     utf8_fprintf( stdout, _("Compiled by %s@%s.%s\n"),
              VLC_CompileBy(), VLC_CompileHost(), VLC_CompileDomain() );
     utf8_fprintf( stdout, _("Compiler: %s\n"), VLC_Compiler() );
-    utf8_fprintf( stdout, LICENSE_MSG );
+    utf8_fprintf( stdout, "%s", LICENSE_MSG );
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
     PauseConsole();
@@ -2140,3 +2132,15 @@ static void InitDeviceValues( libvlc_int_t *p_vlc )
     (void)p_vlc;
 #endif /* HAVE_HAL */
 }
+
+#include <vlc_avcodec.h>
+
+void vlc_avcodec_mutex (bool acquire)
+{
+    static vlc_mutex_t lock = VLC_STATIC_MUTEX;
+
+    if (acquire)
+        vlc_mutex_lock (&lock);
+    else
+        vlc_mutex_unlock (&lock);
+}