[vlc-devel] [RFC PATCH 2/8] libvlc: add libvlc_media_discoverer_navigate
Thomas Guillem
thomas at gllm.fr
Thu Nov 27 12:00:12 CET 2014
Discover media on a specified uri.
---
include/vlc/libvlc_media_discoverer.h | 10 ++++++++++
lib/media_discoverer.c | 28 ++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h
index cf263b0..cc21598 100644
--- a/include/vlc/libvlc_media_discoverer.h
+++ b/include/vlc/libvlc_media_discoverer.h
@@ -102,6 +102,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_navigate( libvlc_media_discoverer_t * p_mdis, const char * psz_uri );
+
/**@} */
# ifdef __cplusplus
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index b126c95..16d420c 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
*/
@@ -350,3 +365,16 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis )
{
return p_mdis->running;
}
+
+/**************************************************************************
+ * navigate (Public)
+ **************************************************************************/
+int
+libvlc_media_discoverer_navigate( 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_NAVIGATE, psz_uri );
+}
--
2.1.3
More information about the vlc-devel
mailing list