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 ...@@ -397,15 +397,8 @@ struct ml_person_t
* @return The media library object. NULL if the media library * @return The media library object. NULL if the media library
* object could not be loaded * object could not be loaded
*/ */
VLC_EXPORT( media_library_t*, ml_Hold, ( vlc_object_t* p_this ) ); VLC_EXPORT( media_library_t*, ml_Get, ( vlc_object_t* p_this ) );
#define ml_Hold( a ) ml_Hold( VLC_OBJECT(a) ) #define ml_Get( a ) ml_Get( 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) )
/** /**
* @brief Create a Media Library VLC object. * @brief Create a Media Library VLC object.
......
...@@ -88,7 +88,7 @@ MLItem::MLItem( const MLModel *p_model, ...@@ -88,7 +88,7 @@ MLItem::MLItem( const MLModel *p_model,
if( p_media ) if( p_media )
ml_gc_incref( p_media ); ml_gc_incref( p_media );
this->media = p_media; this->media = p_media;
p_ml = ml_Hold( _p_intf ); p_ml = ml_Get( _p_intf );
} }
MLItem::~MLItem() MLItem::~MLItem()
...@@ -96,7 +96,6 @@ MLItem::~MLItem() ...@@ -96,7 +96,6 @@ MLItem::~MLItem()
// Free private data // Free private data
if( this->media ) if( this->media )
ml_gc_decref( this->media ); ml_gc_decref( this->media );
ml_Release( p_intf );
if( !children.isEmpty() ) if( !children.isEmpty() )
clearChildren(); clearChildren();
} }
......
...@@ -58,7 +58,7 @@ static int mediaUpdated( vlc_object_t *p_this, char const *psz_var, ...@@ -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 ) MLModel::MLModel( intf_thread_t* _p_intf, QObject *parent )
:VLCModel( _p_intf, 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(); vlc_array_t *p_result_array = vlc_array_new();
ml_Find( p_ml, p_result_array, ML_MEDIA ); ml_Find( p_ml, p_result_array, ML_MEDIA );
insertResultArray( p_result_array ); insertResultArray( p_result_array );
...@@ -76,7 +76,6 @@ MLModel::~MLModel() ...@@ -76,7 +76,6 @@ MLModel::~MLModel()
var_DelCallback( p_ml, "media-meta-change", mediaUpdated, this ); var_DelCallback( p_ml, "media-meta-change", mediaUpdated, this );
var_DelCallback( p_ml, "media-deleted", mediaDeleted, this ); var_DelCallback( p_ml, "media-deleted", mediaDeleted, this );
var_DelCallback( p_ml, "media-added", mediaAdded, this ); var_DelCallback( p_ml, "media-added", mediaAdded, this );
ml_Release( p_intf );
} }
void MLModel::clear() void MLModel::clear()
......
...@@ -230,7 +230,7 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf ) ...@@ -230,7 +230,7 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf )
main_layout->addWidget( recursivity, 1, 0 ); main_layout->addWidget( recursivity, 1, 0 );
main_layout->addWidget( buttonsBox, 2, 0 ); main_layout->addWidget( buttonsBox, 2, 0 );
p_ml = ml_Hold( p_intf ); p_ml = ml_Get( p_intf );
init(); init();
BUTTONACT( save, save() ); BUTTONACT( save, save() );
...@@ -241,7 +241,6 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf ) ...@@ -241,7 +241,6 @@ MLConfDialog::MLConfDialog( QWidget *parent, intf_thread_t *_p_intf )
MLConfDialog::~MLConfDialog() MLConfDialog::~MLConfDialog()
{ {
ml_Release( p_intf );
} }
void MLConfDialog::init() void MLConfDialog::init()
......
...@@ -243,8 +243,7 @@ make_path ...@@ -243,8 +243,7 @@ make_path
mdate mdate
ml_Create ml_Create
ml_Destroy ml_Destroy
ml_Hold ml_Get
ml_Release
media_New media_New
ml_OpConnectChilds ml_OpConnectChilds
ml_FtreeSpec ml_FtreeSpec
......
...@@ -98,14 +98,14 @@ media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name ) ...@@ -98,14 +98,14 @@ media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
return p_ml; return p_ml;
} }
#undef ml_Hold #undef ml_Get
/** /**
* @brief Acquire a reference to the media library singleton * @brief Acquire a reference to the media library singleton
* @param p_this Object that holds the reference * @param p_this Object that holds the reference
* @return media_library_t The ml object. NULL if not compiled with * @return media_library_t The ml object. NULL if not compiled with
* media library or if unable to load * 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; media_library_t* p_ml;
vlc_mutex_lock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) ); 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 ) ...@@ -118,30 +118,10 @@ media_library_t* ml_Hold( vlc_object_t* p_this )
= ml_Create( VLC_OBJECT( p_this->p_libvlc ), NULL ); = ml_Create( VLC_OBJECT( p_this->p_libvlc ), NULL );
p_ml = libvlc_priv (p_this->p_libvlc)->p_ml; 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 ) ); vlc_mutex_unlock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
return p_ml; 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 * @brief Destructor for ml_media_t
*/ */
......
...@@ -387,20 +387,13 @@ vlm_t *vlm_New (vlc_object_t *obj) ...@@ -387,20 +387,13 @@ vlm_t *vlm_New (vlc_object_t *obj)
#ifndef MEDIA_LIBRARY #ifndef MEDIA_LIBRARY
#include<vlc_media_library.h> #include<vlc_media_library.h>
#undef ml_Hold #undef ml_Get
media_library_t* ml_Hold ( vlc_object_t* p_this ) media_library_t* ml_Get ( vlc_object_t* p_this )
{ {
VLC_UNUSED( p_this ); VLC_UNUSED( p_this );
return NULL; 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 ) media_library_t* ml_Create ( vlc_object_t *p_this, char* psz_name )
{ {
VLC_UNUSED( p_this ); 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