[vlc-devel] [PATCH] media_list: remove useless instance
RĂ©mi Denis-Courmont
remi at remlab.net
Wed Jul 15 18:28:41 CEST 2020
This is just instance-independent data.
The player provides the instance.
---
include/vlc/libvlc_media_list.h | 4 +---
lib/media.c | 2 +-
lib/media_discoverer.c | 2 +-
lib/media_list.c | 6 +-----
lib/media_list_internal.h | 1 -
5 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/include/vlc/libvlc_media_list.h b/include/vlc/libvlc_media_list.h
index 95f24a5c03..2a25406af7 100644
--- a/include/vlc/libvlc_media_list.h
+++ b/include/vlc/libvlc_media_list.h
@@ -40,11 +40,9 @@ typedef struct libvlc_media_list_t libvlc_media_list_t;
/**
* Create an empty media list.
*
- * \param p_instance libvlc instance
* \return empty media list, or NULL on error
*/
-LIBVLC_API libvlc_media_list_t *
- libvlc_media_list_new( libvlc_instance_t *p_instance );
+LIBVLC_API libvlc_media_list_t *libvlc_media_list_new(void);
/**
* Release media list created with libvlc_media_list_new().
diff --git a/lib/media.c b/lib/media.c
index e25d439a8a..e84f0e7398 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -141,7 +141,7 @@ static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
vlc_mutex_lock( &p_md->subitems_lock );
if( p_md->p_subitems == NULL && b_create )
{
- p_md->p_subitems = libvlc_media_list_new( p_md->p_libvlc_instance );
+ p_md->p_subitems = libvlc_media_list_new();
if( p_md->p_subitems != NULL )
{
p_md->p_subitems->b_read_only = true;
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index 763e955590..6fcab48eca 100644
--- a/lib/media_discoverer.c
+++ b/lib/media_discoverer.c
@@ -158,7 +158,7 @@ libvlc_media_discoverer_new( libvlc_instance_t * p_inst, const char * psz_name )
}
p_mdis->p_libvlc_instance = p_inst;
- p_mdis->p_mlist = libvlc_media_list_new( p_inst );
+ p_mdis->p_mlist = libvlc_media_list_new();
p_mdis->p_mlist->b_read_only = true;
p_mdis->p_sd = NULL;
diff --git a/lib/media_list.c b/lib/media_list.c
index e8a8a25881..c747778d47 100644
--- a/lib/media_list.c
+++ b/lib/media_list.c
@@ -146,8 +146,7 @@ bool mlist_is_writable( libvlc_media_list_t *p_mlist )
*
* Init an object.
**************************************************************************/
-libvlc_media_list_t *
-libvlc_media_list_new( libvlc_instance_t * p_inst )
+libvlc_media_list_t *libvlc_media_list_new(void)
{
libvlc_media_list_t * p_mlist;
@@ -158,7 +157,6 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
return NULL;
}
- p_mlist->p_libvlc_instance = p_inst;
libvlc_event_manager_init( &p_mlist->event_manager, p_mlist );
p_mlist->b_read_only = false;
@@ -171,7 +169,6 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
p_mlist->p_md = NULL;
p_mlist->p_internal_md = NULL;
- libvlc_retain( p_inst );
return p_mlist;
}
@@ -204,7 +201,6 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
vlc_array_clear( &p_mlist->items );
- libvlc_release( p_mlist->p_libvlc_instance );
free( p_mlist );
}
diff --git a/lib/media_list_internal.h b/lib/media_list_internal.h
index 0321558916..82c1482148 100644
--- a/lib/media_list_internal.h
+++ b/lib/media_list_internal.h
@@ -36,7 +36,6 @@
struct libvlc_media_list_t
{
libvlc_event_manager_t event_manager;
- libvlc_instance_t * p_libvlc_instance;
int i_refcount;
vlc_mutex_t object_lock;
vlc_mutex_t refcount_lock;
--
2.28.0.rc0
More information about the vlc-devel
mailing list