Commit 3b31041c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lib: media_list: allocate event manager in-place

parent 91e8335e
......@@ -78,7 +78,7 @@ notify_item_addition( libvlc_media_list_t * p_mlist,
}
/* Send the event */
libvlc_event_send( p_mlist->p_event_manager, &event );
libvlc_event_send( &p_mlist->event_manager, &event );
}
/**************************************************************************
......@@ -109,7 +109,7 @@ notify_item_deletion( libvlc_media_list_t * p_mlist,
}
/* Send the event */
libvlc_event_send( p_mlist->p_event_manager, &event );
libvlc_event_send( &p_mlist->event_manager, &event );
}
/* LibVLC internal */
......@@ -120,7 +120,7 @@ void libvlc_media_list_internal_end_reached( libvlc_media_list_t * p_mlist )
event.type = libvlc_MediaListEndReached;
/* Send the event */
libvlc_event_send( p_mlist->p_event_manager, &event );
libvlc_event_send( &p_mlist->event_manager, &event );
}
/**************************************************************************
......@@ -160,13 +160,7 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
}
p_mlist->p_libvlc_instance = p_inst;
p_mlist->p_event_manager = libvlc_event_manager_new( p_mlist );
if( unlikely(p_mlist->p_event_manager == NULL) )
{
free(p_mlist);
return NULL;
}
libvlc_event_manager_init( &p_mlist->event_manager, p_mlist );
p_mlist->b_read_only = false;
vlc_mutex_init( &p_mlist->object_lock );
......@@ -200,8 +194,7 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
/* Refcount null, time to free */
libvlc_event_manager_release( p_mlist->p_event_manager );
libvlc_event_manager_destroy( &p_mlist->event_manager );
libvlc_media_release( p_mlist->p_md );
for( size_t i = 0; i < vlc_array_count( &p_mlist->items ); i++ )
......@@ -481,12 +474,12 @@ void libvlc_media_list_unlock( libvlc_media_list_t * p_mlist )
/**************************************************************************
* libvlc_media_list_p_event_manager (Public)
* libvlc_media_list_event_manager (Public)
*
* The p_event_manager is immutable, so you don't have to hold the lock
**************************************************************************/
libvlc_event_manager_t *
libvlc_media_list_event_manager( libvlc_media_list_t * p_mlist )
{
return p_mlist->p_event_manager;
return &p_mlist->event_manager;
}
......@@ -36,7 +36,7 @@
struct libvlc_media_list_t
{
libvlc_event_manager_t * p_event_manager;
libvlc_event_manager_t event_manager;
libvlc_instance_t * p_libvlc_instance;
int i_refcount;
vlc_mutex_t object_lock;
......
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