Commit 3a1efde2 authored by Srikanth Raju's avatar Srikanth Raju

ML/Core: Change ml_Hold/ml_Release to ml_Get

Similar to pl_Get
parent 7b21f9d5
......@@ -397,15 +397,8 @@ struct ml_person_t
* @return The media library object. NULL if the media library
* object could not be loaded
*/
VLC_EXPORT( media_library_t*, ml_Hold, ( vlc_object_t* p_this ) );
#define ml_Hold( a ) ml_Hold( VLC_OBJECT(a) )
/**
* @brief Discard your ref to media library
* @param p_this The object holding the media library
*/
VLC_EXPORT( void, ml_Release, ( vlc_object_t* p_this ) );
#define ml_Release(a) ml_Release( VLC_OBJECT(a) )
VLC_EXPORT( media_library_t*, ml_Get, ( vlc_object_t* p_this ) );
#define ml_Get( a ) ml_Get( VLC_OBJECT(a) )
/**
* @brief Create a Media Library VLC object.
......
......@@ -88,7 +88,7 @@ MLItem::MLItem( const MLModel *p_model,
if( p_media )
ml_gc_incref( p_media );
this->media = p_media;
p_ml = ml_Hold( _p_intf );
p_ml = ml_Get( _p_intf );
}
MLItem::~MLItem()
......@@ -96,7 +96,6 @@ MLItem::~MLItem()
// Free private data
if( this->media )
ml_gc_decref( this->media );
ml_Release( p_intf );
if( !children.isEmpty() )
clearChildren();
}
......
......@@ -58,7 +58,7 @@ static int mediaUpdated( vlc_object_t *p_this, char const *psz_var,
MLModel::MLModel( intf_thread_t* _p_intf, QObject *parent )
:VLCModel( _p_intf, parent )
{
p_ml = ml_Hold( p_intf );
p_ml = ml_Get( p_intf );
vlc_array_t *p_result_array = vlc_array_new();
ml_Find( p_ml, p_result_array, ML_MEDIA );
insertResultArray( p_result_array );
......@@ -76,7 +76,6 @@ MLModel::~MLModel()
var_DelCallback( p_ml, "media-meta-change", mediaUpdated, this );
var_DelCallback( p_ml, "media-deleted", mediaDeleted, this );
var_DelCallback( p_ml, "media-added", mediaAdded, this );
ml_Release( p_intf );
}
void MLModel::clear()
......
......@@ -230,7 +230,7 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf )
main_layout->addWidget( recursivity, 1, 0 );
main_layout->addWidget( buttonsBox, 2, 0 );
p_ml = ml_Hold( p_intf );
p_ml = ml_Get( p_intf );
init();
BUTTONACT( save, save() );
......@@ -241,7 +241,6 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf )
MLConfDialog::~MLConfDialog()
{
ml_Release( p_intf );
}
void MLConfDialog::init()
......
......@@ -243,8 +243,7 @@ make_path
mdate
ml_Create
ml_Destroy
ml_Hold
ml_Release
ml_Get
media_New
ml_OpConnectChilds
ml_FtreeSpec
......
......@@ -98,14 +98,14 @@ 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 ) );
......@@ -118,30 +118,10 @@ media_library_t* ml_Hold( vlc_object_t* p_this )
= 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
*/
......
......@@ -387,20 +387,13 @@ vlm_t *vlm_New (vlc_object_t *obj)
#ifndef MEDIA_LIBRARY
#include<vlc_media_library.h>
#undef ml_Hold
media_library_t* ml_Hold ( vlc_object_t* p_this )
#undef ml_Get
media_library_t* ml_Get ( vlc_object_t* p_this )
{
VLC_UNUSED( p_this );
return NULL;
}
#undef ml_Release
void ml_Release ( vlc_object_t* p_this )
{
VLC_UNUSED( p_this );
assert( 0 );
}
media_library_t* ml_Create ( vlc_object_t *p_this, char* psz_name )
{
VLC_UNUSED( p_this );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment