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

rd: collapse vlc_rd_start() into vlc_rd_new()

Missing bits of previous changeset. Fixes Libvlc.
parent a7c83d6d
...@@ -146,15 +146,6 @@ vlc_rd_new(vlc_object_t *p_obj, const char *psz_name, ...@@ -146,15 +146,6 @@ vlc_rd_new(vlc_object_t *p_obj, const char *psz_name,
VLC_API void vlc_rd_release(vlc_renderer_discovery_t *p_rd); VLC_API void vlc_rd_release(vlc_renderer_discovery_t *p_rd);
/**
* Start the renderer discovery module
*
* Once started, the module can send new vlc_renderer_item_t via the
* vlc_RendererDiscoveryItemAdded event.
*/
VLC_API int
vlc_rd_start(vlc_renderer_discovery_t *p_rd);
/** /**
* @} * @}
* @defgroup vlc_renderer_discovery_module VLC renderer module * @defgroup vlc_renderer_discovery_module VLC renderer module
......
...@@ -89,19 +89,11 @@ static void renderer_event_item_removed(vlc_renderer_discovery_t *rd, ...@@ -89,19 +89,11 @@ static void renderer_event_item_removed(vlc_renderer_discovery_t *rd,
// Create renderer object // Create renderer object
p_rd = vlc_rd_new(VLC_OBJECT(p_intf), _name.UTF8String, &owner); p_rd = vlc_rd_new(VLC_OBJECT(p_intf), _name.UTF8String, &owner);
if (p_rd) { if (!p_rd) {
} else {
msg_Err(p_intf, "Could not create '%s' renderer discovery service", _name.UTF8String); msg_Err(p_intf, "Could not create '%s' renderer discovery service", _name.UTF8String);
return false; return false;
} }
int ret = vlc_rd_start(p_rd);
if (ret != VLC_SUCCESS) {
msg_Err(p_intf, "Could not start '%s' renderer discovery", _name.UTF8String);
vlc_rd_release(p_rd);
p_rd = NULL;
return false;
}
return true; return true;
} }
......
...@@ -329,15 +329,7 @@ void ActionsManager::ScanRendererAction(bool checked) ...@@ -329,15 +329,7 @@ void ActionsManager::ScanRendererAction(bool checked)
msg_Dbg( p_intf, "starting renderer discovery service %s", *ppsz_longname ); msg_Dbg( p_intf, "starting renderer discovery service %s", *ppsz_longname );
vlc_renderer_discovery_t* p_rd = vlc_rd_new( VLC_OBJECT(p_intf), *ppsz_name, &owner ); vlc_renderer_discovery_t* p_rd = vlc_rd_new( VLC_OBJECT(p_intf), *ppsz_name, &owner );
if( p_rd != NULL ) if( p_rd != NULL )
{ m_rds.push_back( p_rd );
if ( vlc_rd_start( p_rd ) == VLC_SUCCESS )
m_rds.push_back( p_rd );
else
{
msg_Err( p_intf, "Could not start renderer discovery service %s", *ppsz_name );
vlc_rd_release( p_rd );
}
}
free( *ppsz_name ); free( *ppsz_name );
free( *ppsz_longname ); free( *ppsz_longname );
} }
......
...@@ -762,5 +762,4 @@ vlc_renderer_item_flags ...@@ -762,5 +762,4 @@ vlc_renderer_item_flags
vlc_rd_get_names vlc_rd_get_names
vlc_rd_new vlc_rd_new
vlc_rd_release vlc_rd_release
vlc_rd_start
vlc_rd_probe_add vlc_rd_probe_add
...@@ -234,9 +234,7 @@ vlc_rd_get_names(vlc_object_t *p_obj, char ***pppsz_names, ...@@ -234,9 +234,7 @@ vlc_rd_get_names(vlc_object_t *p_obj, char ***pppsz_names,
void vlc_rd_release(vlc_renderer_discovery_t *p_rd) void vlc_rd_release(vlc_renderer_discovery_t *p_rd)
{ {
if (p_rd->p_module != NULL) module_unneed(p_rd, p_rd->p_module);
module_unneed(p_rd, p_rd->p_module);
config_ChainDestroy(p_rd->p_cfg); config_ChainDestroy(p_rd->p_cfg);
free(p_rd->psz_name); free(p_rd->psz_name);
vlc_object_release(p_rd); vlc_object_release(p_rd);
...@@ -254,23 +252,14 @@ vlc_rd_new(vlc_object_t *p_obj, const char *psz_name, ...@@ -254,23 +252,14 @@ vlc_rd_new(vlc_object_t *p_obj, const char *psz_name,
free(config_ChainCreate(&p_rd->psz_name, &p_rd->p_cfg, psz_name)); free(config_ChainCreate(&p_rd->psz_name, &p_rd->p_cfg, psz_name));
p_rd->owner = *owner; p_rd->owner = *owner;
p_rd->p_module = NULL;
return p_rd;
}
int
vlc_rd_start(vlc_renderer_discovery_t *p_rd)
{
assert(!p_rd->p_module);
p_rd->p_module = module_need(p_rd, "renderer_discovery", p_rd->p_module = module_need(p_rd, "renderer_discovery",
p_rd->psz_name, true); p_rd->psz_name, true);
if (p_rd->p_module == NULL) if (p_rd->p_module == NULL)
{ {
msg_Err(p_rd, "no suitable renderer discovery module"); msg_Err(p_rd, "no suitable renderer discovery module");
return VLC_EGENERIC; vlc_object_release(p_rd);
p_rd = NULL;
} }
return VLC_SUCCESS; return p_rd;
} }
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