[vlc-commits] Add libvlc_media_list_player_retain() to libvlc.

Alexey Sokolov git at videolan.org
Sat Jun 18 15:38:33 CEST 2011


vlc | branch: master | Alexey Sokolov <alexey at alexeysokolov.co.cc> | Tue May 31 15:00:20 2011 +0700| [db493e335a711cf6bef52cc2a7f365495dcbb21b] | committer: Rémi Duraffort

Add libvlc_media_list_player_retain() to libvlc.

There was only release() before.

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

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

 include/vlc/libvlc_media_list_player.h |   15 ++++++++++++++-
 src/control/media_list_player.c        |   13 +++++++++++++
 src/libvlc.sym                         |    1 +
 3 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/include/vlc/libvlc_media_list_player.h b/include/vlc/libvlc_media_list_player.h
index a488562..66ccca6 100644
--- a/include/vlc/libvlc_media_list_player.h
+++ b/include/vlc/libvlc_media_list_player.h
@@ -68,7 +68,11 @@ LIBVLC_API libvlc_media_list_player_t *
     libvlc_media_list_player_new( libvlc_instance_t * p_instance );
 
 /**
- * Release media_list_player.
+ * Release a media_list_player after use
+ * Decrement the reference count of a media player object. If the
+ * reference count is 0, then libvlc_media_list_player_release() will
+ * release the media player object. If the media player object
+ * has been released, then it should not be used again.
  *
  * \param p_mlp media list player instance
  */
@@ -76,6 +80,15 @@ LIBVLC_API void
     libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp );
 
 /**
+ * Retain a reference to a media player list object. Use
+ * libvlc_media_list_player_release() to decrement reference count.
+ *
+ * \param p_mlp media player list object
+ */
+LIBVLC_API void
+    libvlc_media_list_player_retain( libvlc_media_list_player_t *p_mlp );
+
+/**
  * Return the event manager of this media_list_player.
  *
  * \param p_mlp media list player instance
diff --git a/src/control/media_list_player.c b/src/control/media_list_player.c
index a6d5098..343866b 100644
--- a/src/control/media_list_player.c
+++ b/src/control/media_list_player.c
@@ -520,6 +520,19 @@ void libvlc_media_list_player_release(libvlc_media_list_player_t * p_mlp)
 }
 
 /**************************************************************************
+ *        retain (Public)
+ **************************************************************************/
+void libvlc_media_list_player_retain(libvlc_media_list_player_t * p_mlp)
+{
+    if (!p_mlp)
+        return;
+
+    lock(p_mlp);
+    p_mlp->i_refcount++;
+    unlock(p_mlp);
+}
+
+/**************************************************************************
  *        event_manager (Public)
  **************************************************************************/
 libvlc_event_manager_t *
diff --git a/src/libvlc.sym b/src/libvlc.sym
index d04a69e..8e3d835 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -95,6 +95,7 @@ libvlc_media_list_player_play_item
 libvlc_media_list_player_play_item_at_index
 libvlc_media_list_player_previous
 libvlc_media_list_player_release
+libvlc_media_list_player_retain
 libvlc_media_list_player_set_media_list
 libvlc_media_list_player_set_media_player
 libvlc_media_list_player_set_playback_mode



More information about the vlc-commits mailing list