[vlc-devel] [PATCH 03/14] lib: add libvlc_media_discoverer_browse

Thomas Guillem thomas at gllm.fr
Fri Dec 5 14:42:54 CET 2014


Discover media on a specified uri.
---
 include/vlc/libvlc_media_discoverer.h | 10 ++++++++++
 lib/libvlc.sym                        |  1 +
 lib/media_discoverer.c                | 28 ++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h
index 0f3b379..bc0d9e9 100644
--- a/include/vlc/libvlc_media_discoverer.h
+++ b/include/vlc/libvlc_media_discoverer.h
@@ -126,6 +126,16 @@ LIBVLC_API libvlc_event_manager_t *
 LIBVLC_API int
         libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis );
 
+/**
+ * Discover media on a specified uri.
+ *
+ * \param p_mdis media service discover object
+ * \param psz_uri uri
+ * \return -1 in case of error, 0 otherwise
+ */
+LIBVLC_API int
+        libvlc_media_discoverer_browse( libvlc_media_discoverer_t * p_mdis, const char * psz_uri );
+
 /**@} */
 
 # ifdef __cplusplus
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index f0512c6..6222a12 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -72,6 +72,7 @@ libvlc_log_iterator_next
 libvlc_log_open
 libvlc_media_add_option
 libvlc_media_add_option_flag
+libvlc_media_discoverer_browse
 libvlc_media_discoverer_event_manager
 libvlc_media_discoverer_is_running
 libvlc_media_discoverer_localized_name
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index a2532cb..8eb76ac 100644
--- a/lib/media_discoverer.c
+++ b/lib/media_discoverer.c
@@ -175,6 +175,21 @@ static void services_discovery_ended( const vlc_event_t * p_event,
     libvlc_event_send( p_mdis->p_event_manager, &event );
 }
 
+/**************************************************************************
+ *       services_discovery_control (Private)
+ **************************************************************************/
+static int services_discovery_control( services_discovery_t *p_sd,
+                                       int i_control, ...)
+{
+    va_list args;
+    int i_ret;
+
+    va_start( args, i_control );
+    i_ret = vlc_sd_control( p_sd, i_control, args );
+    va_end( args );
+    return i_ret == VLC_SUCCESS ? 0 : -1;
+}
+
 /*
  * Public libvlc functions
  */
@@ -381,3 +396,16 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis )
 {
     return p_mdis->running;
 }
+
+/**************************************************************************
+ * browse (Public)
+ **************************************************************************/
+int
+libvlc_media_discoverer_browse( libvlc_media_discoverer_t * p_mdis,
+                                const char *psz_uri )
+{
+    if( !p_mdis->running )
+        return -1;
+
+    return services_discovery_control( p_mdis->p_sd, SD_CMD_BROWSE, psz_uri );
+}
-- 
2.1.3




More information about the vlc-devel mailing list