[vlc-commits] ML/Core: Change ml_Hold/ml_Release to ml_Get

Srikanth Raju git at videolan.org
Mon Jan 24 17:35:09 CET 2011


vlc | branch: master | Srikanth Raju <srikiraju at gmail.com> | Mon Jan 24 21:50:11 2011 +0530| [3a1efde26b05fb3471c527e56fd49db3b1503446] | committer: Srikanth Raju

ML/Core: Change ml_Hold/ml_Release to ml_Get

Similar to pl_Get

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a1efde26b05fb3471c527e56fd49db3b1503446
---

 include/vlc_media_library.h                      |   11 +--------
 modules/gui/qt4/components/playlist/ml_item.cpp  |    3 +-
 modules/gui/qt4/components/playlist/ml_model.cpp |    3 +-
 modules/gui/qt4/dialogs/ml_configuration.cpp     |    3 +-
 src/libvlccore.sym                               |    3 +-
 src/misc/media_library.c                         |   24 +--------------------
 src/missing.c                                    |   11 +--------
 7 files changed, 10 insertions(+), 48 deletions(-)

diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index 1d58bcc..f682753 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -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.
diff --git a/modules/gui/qt4/components/playlist/ml_item.cpp b/modules/gui/qt4/components/playlist/ml_item.cpp
index aa0afaa..ddf3148 100644
--- a/modules/gui/qt4/components/playlist/ml_item.cpp
+++ b/modules/gui/qt4/components/playlist/ml_item.cpp
@@ -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();
 }
diff --git a/modules/gui/qt4/components/playlist/ml_model.cpp b/modules/gui/qt4/components/playlist/ml_model.cpp
index 09f6a07..ea339b2 100644
--- a/modules/gui/qt4/components/playlist/ml_model.cpp
+++ b/modules/gui/qt4/components/playlist/ml_model.cpp
@@ -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()
diff --git a/modules/gui/qt4/dialogs/ml_configuration.cpp b/modules/gui/qt4/dialogs/ml_configuration.cpp
index 142d43e..6500ae7 100644
--- a/modules/gui/qt4/dialogs/ml_configuration.cpp
+++ b/modules/gui/qt4/dialogs/ml_configuration.cpp
@@ -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()
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 30c1107..a59f8af 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -243,8 +243,7 @@ make_path
 mdate
 ml_Create
 ml_Destroy
-ml_Hold
-ml_Release
+ml_Get
 media_New
 ml_OpConnectChilds
 ml_FtreeSpec
diff --git a/src/misc/media_library.c b/src/misc/media_library.c
index ef5e8e0..4aa4123 100644
--- a/src/misc/media_library.c
+++ b/src/misc/media_library.c
@@ -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
  */
diff --git a/src/missing.c b/src/missing.c
index 34f3925..3bfb41f 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -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 );



More information about the vlc-commits mailing list