* 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
#include <assert.h>
#include <vlc_media_library.h>
+#include <vlc_modules.h>
#include "../libvlc.h"
/**
*/
media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
{
- media_library_t *p_ml = NULL;
+ media_library_t *p_ml;
p_ml = ( media_library_t * ) vlc_custom_create(
p_this, sizeof( media_library_t ),
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 = NULL;
+ 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
*/
const char* psz_lvalue,
int id, ... )
{
- ml_element_t *update = NULL;
+ ml_element_t *update;
vlc_array_t *array = vlc_array_new();
int i_ret = VLC_SUCCESS;