[vlc-commits] lib: renderer_discoverer: allocate event manager in-place
Rémi Denis-Courmont
git at videolan.org
Mon May 15 21:32:34 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 15 20:16:45 2017 +0300| [8f67aeff0faafe44da69ce9069fd97855a258623] | committer: Rémi Denis-Courmont
lib: renderer_discoverer: allocate event manager in-place
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8f67aeff0faafe44da69ce9069fd97855a258623
---
lib/renderer_discoverer.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/lib/renderer_discoverer.c b/lib/renderer_discoverer.c
index 63614c40a0..ee5c80752b 100644
--- a/lib/renderer_discoverer.c
+++ b/lib/renderer_discoverer.c
@@ -34,9 +34,9 @@
struct libvlc_renderer_discoverer_t
{
+ libvlc_event_manager_t event_manager;
vlc_object_t * p_object;
vlc_renderer_discovery_t *p_rd;
- libvlc_event_manager_t *p_event_manager;
int i_items;
vlc_renderer_item_t ** pp_items;
@@ -67,7 +67,7 @@ static void renderer_discovery_item_added( vlc_renderer_discovery_t *rd,
.u.renderer_discoverer_item_added.item =
(libvlc_renderer_item_t*) p_item,
};
- libvlc_event_send( p_lrd->p_event_manager, &event );
+ libvlc_event_send( &p_lrd->event_manager, &event );
}
static void renderer_discovery_item_removed( vlc_renderer_discovery_t *rd,
@@ -85,7 +85,7 @@ static void renderer_discovery_item_removed( vlc_renderer_discovery_t *rd,
.u.renderer_discoverer_item_deleted.item =
(libvlc_renderer_item_t*) p_item,
};
- libvlc_event_send( p_lrd->p_event_manager, &event );
+ libvlc_event_send( &p_lrd->event_manager, &event );
vlc_renderer_item_release( p_item );
}
@@ -128,26 +128,16 @@ libvlc_renderer_discoverer_new( libvlc_instance_t *p_inst,
memcpy( p_lrd->name, psz_name, len );
TAB_INIT( p_lrd->i_items, p_lrd->pp_items );
p_lrd->p_rd = NULL;
-
- p_lrd->p_event_manager = libvlc_event_manager_new( p_lrd );
- if( unlikely(p_lrd->p_event_manager == NULL) )
- goto error;
+ libvlc_event_manager_init( &p_lrd->event_manager, p_lrd );
return p_lrd;
-
-error:
- libvlc_renderer_discoverer_release( p_lrd );
- return NULL;
}
void
libvlc_renderer_discoverer_release( libvlc_renderer_discoverer_t *p_lrd )
{
libvlc_renderer_discoverer_stop( p_lrd );
-
- if( p_lrd->p_event_manager == NULL )
- libvlc_event_manager_release( p_lrd->p_event_manager );
-
+ libvlc_event_manager_destroy( &p_lrd->event_manager );
free( p_lrd );
}
@@ -181,7 +171,7 @@ libvlc_renderer_discoverer_stop( libvlc_renderer_discoverer_t *p_lrd )
libvlc_event_manager_t *
libvlc_renderer_discoverer_event_manager( libvlc_renderer_discoverer_t *p_lrd )
{
- return p_lrd->p_event_manager;
+ return &p_lrd->event_manager;
}
void
More information about the vlc-commits
mailing list