[vlc-devel] [RFC PATCHv2 6/6] services_discovery: handle vlc_renderer_item

Thomas Guillem thomas at gllm.fr
Wed Mar 2 15:58:24 CET 2016


Services discoveries are now able to discover renderer items, this struct
contains all informations to connect to a renderer: the module to load, the
host, and the port.

Also-by: Steve Lhomme <robux4 at videolabs.io>
---
 include/vlc_events.h                            | 10 +++++++++
 include/vlc_services_discovery.h                |  8 +++++--
 modules/gui/qt/components/playlist/selector.cpp |  3 +++
 src/libvlccore.sym                              |  2 ++
 src/playlist/services_discovery.c               | 30 +++++++++++++++++++++++++
 5 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/include/vlc_events.h b/include/vlc_events.h
index bca1b2a..0ca0ba3 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -129,6 +129,8 @@ typedef enum vlc_event_type_t {
     vlc_ServicesDiscoveryItemAdded,
     vlc_ServicesDiscoveryItemRemoved,
     vlc_ServicesDiscoveryItemRemoveAll,
+    vlc_ServicesDiscoveryRendererAdded,
+    vlc_ServicesDiscoveryRendererRemoved,
     vlc_ServicesDiscoveryStarted,
     vlc_ServicesDiscoveryEnded,
 
@@ -199,6 +201,14 @@ typedef struct vlc_event_t
         {
             input_item_t * p_item;
         } services_discovery_item_removed;
+        struct vlc_services_discovery_renderer_added
+        {
+            vlc_renderer_item * p_new_item;
+        } services_discovery_renderer_added;
+        struct vlc_services_discovery_renderer_removed
+        {
+            vlc_renderer_item * p_item;
+        } services_discovery_renderer_removed;
         struct vlc_services_discovery_started
         {
             void * unused;
diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index d9c231b..62ad870 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -73,7 +73,8 @@ enum services_discovery_category_e
     SD_CAT_DEVICES = 1,           /**< Devices, like portable music players */
     SD_CAT_LAN,                   /**< LAN/WAN services, like Upnp or SAP */
     SD_CAT_INTERNET,              /**< Internet or Website channels services */
-    SD_CAT_MYCOMPUTER             /**< Computer services, like Discs or Apps */
+    SD_CAT_MYCOMPUTER,            /**< Computer services, like Discs or Apps */
+    SD_CAT_RENDERER               /**< Network Devices to send audio/video to */
 };
 
 /**
@@ -158,7 +159,10 @@ VLC_API vlc_event_manager_t * services_discovery_EventManager( services_discover
 VLC_API void services_discovery_AddItem( services_discovery_t * p_this, input_item_t * p_item, const char * psz_category );
 VLC_API void services_discovery_RemoveItem( services_discovery_t * p_this, input_item_t * p_item );
 VLC_API void services_discovery_RemoveAll( services_discovery_t * p_sd );
-
+VLC_API void services_discovery_AddRenderer( services_discovery_t * p_this,
+                                             vlc_renderer_item * p_item );
+VLC_API void services_discovery_RemoveRenderer( services_discovery_t * p_this,
+                                                vlc_renderer_item * p_item );
 
 /* SD probing */
 
diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp
index a5be6a0..037f8f7 100644
--- a/modules/gui/qt/components/playlist/selector.cpp
+++ b/modules/gui/qt/components/playlist/selector.cpp
@@ -323,6 +323,9 @@ void PLSelector::createItems()
             else
                 icon = QIcon( ":/sidebar/movie" );
             break;
+        case SD_CAT_RENDERER:
+            /* do not show renderers in the sources dialog */
+            break;
         default:
             selItem = addItem( SD_TYPE, *ppsz_longname );
         }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 412b09b..e3e7e9e 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -359,10 +359,12 @@ sdp_AddAttribute
 sdp_AddMedia
 secstotimestr
 services_discovery_AddItem
+services_discovery_AddRenderer
 services_discovery_EventManager
 services_discovery_GetLocalizedName
 services_discovery_RemoveAll
 services_discovery_RemoveItem
+services_discovery_RemoveRenderer
 sout_AccessOutControl
 sout_AccessOutDelete
 sout_AccessOutNew
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index e413f9b..eff4adf 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -121,6 +121,8 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super,
     vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemAdded);
     vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemRemoved);
     vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemRemoveAll);
+    vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryRendererAdded);
+    vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryRendererRemoved);
     vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryStarted);
     vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryEnded);
 
@@ -248,6 +250,34 @@ services_discovery_RemoveItem ( services_discovery_t * p_sd, input_item_t * p_it
     vlc_event_send( &p_sd->event_manager, &event );
 }
 
+/*******************************************************************//**
+ * Add a renderer to the Service Discovery listing
+ ***********************************************************************/
+void
+services_discovery_AddRenderer ( services_discovery_t * p_sd,
+                                 vlc_renderer_item * p_item )
+{
+    vlc_event_t event;
+    event.type = vlc_ServicesDiscoveryRendererAdded;
+    event.u.services_discovery_renderer_added.p_new_item = p_item;
+
+    vlc_event_send( &p_sd->event_manager, &event );
+}
+
+/*******************************************************************//**
+ * Remove a renderer from the Service Discovery listing
+ ***********************************************************************/
+void
+services_discovery_RemoveRenderer ( services_discovery_t * p_sd,
+                                    vlc_renderer_item *p_item )
+{
+    vlc_event_t event;
+    event.type = vlc_ServicesDiscoveryRendererRemoved;
+    event.u.services_discovery_renderer_removed.p_item = p_item;
+
+    vlc_event_send( &p_sd->event_manager, &event );
+}
+
 /*
  * Playlist - Services discovery bridge
  */
-- 
2.7.0



More information about the vlc-devel mailing list