[vlc-commits] [Git][videolan/vlc][master] 7 commits: lib: return the same object in libvlc_picture_retain()

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Mar 24 13:11:25 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
448e8b92 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_picture_retain()

- - - - -
e793a324 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_retain()

- - - - -
d5b78783 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_media_retain()

- - - - -
2ad8ef54 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_media_list_retain()

- - - - -
098855b2 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_media_player_retain()

- - - - -
ad56ab86 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: assert instead of doing a dynamic check

- - - - -
817edbb1 by Thomas Guillem at 2023-03-24T12:42:38+00:00
lib: return the same object in libvlc_media_player_list_retain()

- - - - -


12 changed files:

- include/vlc/libvlc.h
- include/vlc/libvlc_media.h
- include/vlc/libvlc_media_list.h
- include/vlc/libvlc_media_list_player.h
- include/vlc/libvlc_media_player.h
- include/vlc/libvlc_picture.h
- lib/core.c
- lib/media.c
- lib/media_list.c
- lib/media_list_player.c
- lib/media_player.c
- lib/picture.c


Changes:

=====================================
include/vlc/libvlc.h
=====================================
@@ -181,8 +181,9 @@ LIBVLC_API void libvlc_release( libvlc_instance_t *p_instance );
  * The initial reference count is 1 after libvlc_new() returns.
  *
  * \param p_instance the instance to reference
+ * \return the same object
  */
-LIBVLC_API void libvlc_retain( libvlc_instance_t *p_instance );
+LIBVLC_API libvlc_instance_t *libvlc_retain( libvlc_instance_t *p_instance );
 
 /**
  * Get the ABI version of the libvlc library.


=====================================
include/vlc/libvlc_media.h
=====================================
@@ -413,8 +413,9 @@ LIBVLC_API void libvlc_media_add_option_flag(
  * media descriptor object.
  *
  * \param p_md the media descriptor
+ * \return the same object
  */
-LIBVLC_API void libvlc_media_retain( libvlc_media_t *p_md );
+LIBVLC_API libvlc_media_t *libvlc_media_retain( libvlc_media_t *p_md );
 
 /**
  * Decrement the reference count of a media descriptor object. If the


=====================================
include/vlc/libvlc_media_list.h
=====================================
@@ -56,8 +56,9 @@ LIBVLC_API void
  * Retain reference to a media list
  *
  * \param p_ml a media list created with libvlc_media_list_new()
+ * \return the same object
  */
-LIBVLC_API void
+LIBVLC_API libvlc_media_list_t *
     libvlc_media_list_retain( libvlc_media_list_t *p_ml );
 
 /**


=====================================
include/vlc/libvlc_media_list_player.h
=====================================
@@ -78,8 +78,9 @@ LIBVLC_API void
  * libvlc_media_list_player_release() to decrement reference count.
  *
  * \param p_mlp media player list object
+ * \return the same object
  */
-LIBVLC_API void
+LIBVLC_API libvlc_media_list_player_t *
     libvlc_media_list_player_retain( libvlc_media_list_player_t *p_mlp );
 
 /**


=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -191,8 +191,9 @@ LIBVLC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
  * libvlc_media_player_release() to decrement reference count.
  *
  * \param p_mi media player object
+ * \return the same object
  */
-LIBVLC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
+LIBVLC_API libvlc_media_player_t *libvlc_media_player_retain( libvlc_media_player_t *p_mi );
 
 /**
  * Set the media that will be used by the media_player. If any,


=====================================
include/vlc/libvlc_picture.h
=====================================
@@ -42,8 +42,9 @@ typedef enum libvlc_picture_type_t
  *
  * \see libvlc_picture_release()
  * \param pic A picture object
+ * \return the same object
  */
-LIBVLC_API void
+LIBVLC_API libvlc_picture_t *
 libvlc_picture_retain( libvlc_picture_t* pic );
 
 /**


=====================================
lib/core.c
=====================================
@@ -82,11 +82,12 @@ error:
     return NULL;
 }
 
-void libvlc_retain( libvlc_instance_t *p_instance )
+libvlc_instance_t *libvlc_retain( libvlc_instance_t *p_instance )
 {
     assert( p_instance != NULL );
 
     vlc_atomic_rc_inc( &p_instance->ref_count );
+    return p_instance;
 }
 
 void libvlc_release( libvlc_instance_t *p_instance )


=====================================
lib/media.c
=====================================
@@ -641,10 +641,11 @@ void libvlc_media_release( libvlc_media_t *p_md )
 }
 
 // Retain a media descriptor object
-void libvlc_media_retain( libvlc_media_t *p_md )
+libvlc_media_t *libvlc_media_retain( libvlc_media_t *p_md )
 {
     assert (p_md);
     vlc_atomic_rc_inc( &p_md->rc );
+    return p_md;
 }
 
 // Duplicate a media descriptor object


=====================================
lib/media_list.c
=====================================
@@ -203,9 +203,10 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
  *
  * Increase an object refcount.
  **************************************************************************/
-void libvlc_media_list_retain( libvlc_media_list_t * p_mlist )
+libvlc_media_list_t *libvlc_media_list_retain( libvlc_media_list_t * p_mlist )
 {
     vlc_atomic_rc_inc( &p_mlist->rc );
+    return p_mlist;
 }
 
 /**************************************************************************


=====================================
lib/media_list_player.c
=====================================
@@ -542,12 +542,11 @@ 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)
+libvlc_media_list_player_t *libvlc_media_list_player_retain(libvlc_media_list_player_t * p_mlp)
 {
-    if (!p_mlp)
-        return;
-
+    assert(p_mlp);
     vlc_atomic_rc_inc(&p_mlp->rc);
+    return p_mlp;
 }
 
 /**************************************************************************


=====================================
lib/media_player.c
=====================================
@@ -871,10 +871,11 @@ void libvlc_media_player_release( libvlc_media_player_t *p_mi )
  *
  * Caller must hold the lock.
  **************************************************************************/
-void libvlc_media_player_retain( libvlc_media_player_t *p_mi )
+libvlc_media_player_t *libvlc_media_player_retain( libvlc_media_player_t *p_mi )
 {
     assert( p_mi );
     vlc_atomic_rc_inc( &p_mi->rc );
+    return p_mi;
 }
 
 /**************************************************************************


=====================================
lib/picture.c
=====================================
@@ -135,9 +135,10 @@ static libvlc_picture_t* libvlc_picture_from_attachment( input_attachment_t* att
     return pic;
 }
 
-void libvlc_picture_retain( libvlc_picture_t* pic )
+libvlc_picture_t *libvlc_picture_retain( libvlc_picture_t* pic )
 {
     vlc_atomic_rc_inc( &pic->rc );
+    return pic;
 }
 
 void libvlc_picture_release( libvlc_picture_t* pic )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f93de3ef234c010a8e3788985ed9d0ae2e5b0aca...817edbb11657c46f083c2bc2ddbd7093c10504c5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f93de3ef234c010a8e3788985ed9d0ae2e5b0aca...817edbb11657c46f083c2bc2ddbd7093c10504c5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list