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

lib: media_discoverer: allocate event manager in-place

parent db28adc7
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
struct libvlc_media_discoverer_t struct libvlc_media_discoverer_t
{ {
libvlc_event_manager_t * p_event_manager; libvlc_event_manager_t event_manager;
libvlc_instance_t * p_libvlc_instance; libvlc_instance_t * p_libvlc_instance;
services_discovery_t * p_sd; services_discovery_t * p_sd;
libvlc_media_list_t * p_mlist; libvlc_media_list_t * p_mlist;
...@@ -164,13 +164,7 @@ libvlc_media_discoverer_new( libvlc_instance_t * p_inst, const char * psz_name ) ...@@ -164,13 +164,7 @@ libvlc_media_discoverer_new( libvlc_instance_t * p_inst, const char * psz_name )
p_mdis->p_sd = NULL; p_mdis->p_sd = NULL;
vlc_dictionary_init( &p_mdis->catname_to_submedialist, 0 ); vlc_dictionary_init( &p_mdis->catname_to_submedialist, 0 );
libvlc_event_manager_init( &p_mdis->event_manager, p_mdis );
p_mdis->p_event_manager = libvlc_event_manager_new( p_mdis );
if( unlikely(p_mdis->p_event_manager == NULL) )
{
free( p_mdis );
return NULL;
}
libvlc_retain( p_inst ); libvlc_retain( p_inst );
strcpy( p_mdis->name, psz_name ); strcpy( p_mdis->name, psz_name );
...@@ -200,7 +194,7 @@ libvlc_media_discoverer_start( libvlc_media_discoverer_t * p_mdis ) ...@@ -200,7 +194,7 @@ libvlc_media_discoverer_start( libvlc_media_discoverer_t * p_mdis )
libvlc_event_t event; libvlc_event_t event;
event.type = libvlc_MediaDiscovererStarted; event.type = libvlc_MediaDiscovererStarted;
libvlc_event_send( p_mdis->p_event_manager, &event ); libvlc_event_send( &p_mdis->event_manager, &event );
return 0; return 0;
} }
...@@ -217,7 +211,7 @@ libvlc_media_discoverer_stop( libvlc_media_discoverer_t * p_mdis ) ...@@ -217,7 +211,7 @@ libvlc_media_discoverer_stop( libvlc_media_discoverer_t * p_mdis )
libvlc_event_t event; libvlc_event_t event;
event.type = libvlc_MediaDiscovererEnded; event.type = libvlc_MediaDiscovererEnded;
libvlc_event_send( p_mdis->p_event_manager, &event ); libvlc_event_send( &p_mdis->event_manager, &event );
vlc_sd_Destroy( p_mdis->p_sd ); vlc_sd_Destroy( p_mdis->p_sd );
p_mdis->p_sd = NULL; p_mdis->p_sd = NULL;
...@@ -268,7 +262,7 @@ libvlc_media_discoverer_release( libvlc_media_discoverer_t * p_mdis ) ...@@ -268,7 +262,7 @@ libvlc_media_discoverer_release( libvlc_media_discoverer_t * p_mdis )
free( all_keys ); free( all_keys );
vlc_dictionary_clear( &p_mdis->catname_to_submedialist, NULL, NULL ); vlc_dictionary_clear( &p_mdis->catname_to_submedialist, NULL, NULL );
libvlc_event_manager_release( p_mdis->p_event_manager ); libvlc_event_manager_destroy( &p_mdis->event_manager );
libvlc_release( p_mdis->p_libvlc_instance ); libvlc_release( p_mdis->p_libvlc_instance );
free( p_mdis ); free( p_mdis );
...@@ -301,7 +295,7 @@ libvlc_media_discoverer_media_list( libvlc_media_discoverer_t * p_mdis ) ...@@ -301,7 +295,7 @@ libvlc_media_discoverer_media_list( libvlc_media_discoverer_t * p_mdis )
libvlc_event_manager_t * libvlc_event_manager_t *
libvlc_media_discoverer_event_manager( libvlc_media_discoverer_t * p_mdis ) libvlc_media_discoverer_event_manager( libvlc_media_discoverer_t * p_mdis )
{ {
return p_mdis->p_event_manager; return &p_mdis->event_manager;
} }
......
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