]> git.sesse.net Git - vlc/blobdiff - src/misc/media_library.c
vlm: use make_URI() with --vlm-conf
[vlc] / src / misc / media_library.c
index 1223ad1d913d9b1cede0c22464fb81e176d7ea45..e855703452363a942427ea405d56c93f7c101872 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined( __LIBVLC__ )
-  #error You are not libvlc or one of its plugins. You cannot include this file
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -33,6 +29,7 @@
 
 #include <assert.h>
 #include <vlc_media_library.h>
+#include <vlc_modules.h>
 #include "../libvlc.h"
 
 /**
@@ -101,48 +98,30 @@ media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
     return p_ml;
 }
 
-#undef ml_Hold
+#undef ml_Get
 /**
  * @brief Acquire a reference to the media library singleton
  * @param p_this Object that holds the reference
  * @return media_library_t The ml object. NULL if not compiled with
  * media library or if unable to load
  */
-media_library_t* ml_Hold( vlc_object_t* p_this )
+media_library_t* ml_Get( vlc_object_t* p_this )
 {
     media_library_t* p_ml;
+    vlc_mutex_lock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
     assert( VLC_OBJECT( p_ml ) != p_this );
     if( p_ml == NULL &&
-            var_GetBool( p_this->p_libvlc, "load-media-library-on-startup" ) == false )
+        !var_GetBool( p_this->p_libvlc, "load-media-library-on-startup" ) )
     {
         libvlc_priv (p_this->p_libvlc)->p_ml
             = ml_Create( VLC_OBJECT( p_this->p_libvlc ), NULL );
         p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
     }
-    if( p_ml )
-        vlc_object_hold( p_ml );
+    vlc_mutex_unlock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     return p_ml;
 }
 
-#undef ml_Release
-/**
- * @brief Release a reference to the media library singleton
- * @param p_this Object that holds the reference
- */
-void ml_Release( vlc_object_t* p_this )
-{
-    media_library_t* p_ml;
-    p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
-    if( p_ml == NULL )
-    {
-        msg_Warn( p_this->p_libvlc , "Spurious release ML called");
-        return;
-    }
-    assert( VLC_OBJECT( p_ml ) != p_this );
-    vlc_object_release( p_ml );
-}
-
 /**
  * @brief Destructor for ml_media_t
  */