[vlc-commits] rd: collapse vlc_rd_start() into vlc_rd_new()

Rémi Denis-Courmont git at videolan.org
Tue May 16 21:43:07 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 16 22:41:38 2017 +0300| [5e407d5f93b187da57201fb4dde7468b128af16f] | committer: Rémi Denis-Courmont

rd: collapse vlc_rd_start() into vlc_rd_new()

Missing bits of previous changeset. Fixes Libvlc.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e407d5f93b187da57201fb4dde7468b128af16f
---

 include/vlc_renderer_discovery.h          |  9 ---------
 modules/gui/macosx/VLCRendererDiscovery.m | 10 +---------
 modules/gui/qt/actions_manager.cpp        | 10 +---------
 src/libvlccore.sym                        |  1 -
 src/misc/renderer_discovery.c             | 19 ++++---------------
 5 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/include/vlc_renderer_discovery.h b/include/vlc_renderer_discovery.h
index 2a9f18f2d8..6193e48625 100644
--- a/include/vlc_renderer_discovery.h
+++ b/include/vlc_renderer_discovery.h
@@ -147,15 +147,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);
 
 /**
- * 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
  * @{
diff --git a/modules/gui/macosx/VLCRendererDiscovery.m b/modules/gui/macosx/VLCRendererDiscovery.m
index f238219324..2a4cfba03a 100644
--- a/modules/gui/macosx/VLCRendererDiscovery.m
+++ b/modules/gui/macosx/VLCRendererDiscovery.m
@@ -89,19 +89,11 @@ static void renderer_event_item_removed(vlc_renderer_discovery_t *rd,
     // Create renderer object
     p_rd = vlc_rd_new(VLC_OBJECT(p_intf), _name.UTF8String, &owner);
 
-    if (p_rd) {
-    } else {
+    if (!p_rd) {
         msg_Err(p_intf, "Could not create '%s' renderer discovery service", _name.UTF8String);
         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;
 }
 
diff --git a/modules/gui/qt/actions_manager.cpp b/modules/gui/qt/actions_manager.cpp
index 8270b69e9b..2986f05d68 100644
--- a/modules/gui/qt/actions_manager.cpp
+++ b/modules/gui/qt/actions_manager.cpp
@@ -329,15 +329,7 @@ void ActionsManager::ScanRendererAction(bool checked)
             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 );
             if( p_rd != NULL )
-            {
-                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 );
-                }
-            }
+                m_rds.push_back( p_rd );
             free( *ppsz_name );
             free( *ppsz_longname );
         }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 77c9a1aaf4..b282c3483c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -762,5 +762,4 @@ vlc_renderer_item_flags
 vlc_rd_get_names
 vlc_rd_new
 vlc_rd_release
-vlc_rd_start
 vlc_rd_probe_add
diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index 6a8448e2f8..b89dca309c 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -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)
 {
-    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);
     free(p_rd->psz_name);
     vlc_object_release(p_rd);
@@ -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));
 
     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->psz_name, true);
     if (p_rd->p_module == NULL)
     {
         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;
 }



More information about the vlc-commits mailing list