[vlc-devel] [PATCH 3/8] renderer: add vlc_renderer_item_uri
Thomas Guillem
thomas at gllm.fr
Mon Sep 19 19:09:46 CEST 2016
For display purpose
---
include/vlc_renderer_discovery.h | 6 ++++++
src/libvlccore.sym | 1 +
src/misc/renderer_discovery.c | 14 ++++++++++++++
3 files changed, 21 insertions(+)
diff --git a/include/vlc_renderer_discovery.h b/include/vlc_renderer_discovery.h
index 585dcf2..7e8c45f 100644
--- a/include/vlc_renderer_discovery.h
+++ b/include/vlc_renderer_discovery.h
@@ -81,6 +81,12 @@ VLC_API const char *
vlc_renderer_item_sout(const vlc_renderer_item_t *p_item);
/**
+ * Get the uri of a renderer item
+ */
+VLC_API const char *
+vlc_renderer_item_uri(const vlc_renderer_item_t *p_item);
+
+/**
* Get the icon uri of a renderer item
*/
VLC_API const char *
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index e3fd6e5..3222730 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -765,6 +765,7 @@ vlc_renderer_item_hold
vlc_renderer_item_release
vlc_renderer_item_name
vlc_renderer_item_sout
+vlc_renderer_item_uri
vlc_renderer_item_icon_uri
vlc_renderer_item_flags
vlc_rd_get_names
diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index 7b43177..fa17b32 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -35,6 +35,7 @@
struct vlc_renderer_item_t
{
char *psz_name;
+ char *psz_uri;
char *psz_sout;
char *psz_icon_uri;
int i_flags;
@@ -66,6 +67,9 @@ vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
if (p_item->psz_name == NULL)
goto error;
+ if ((p_item->psz_uri = strdup(psz_uri)) == NULL)
+ goto error;
+
if (asprintf(&p_item->psz_sout, "%s{ip=%s,port=%d%s%s}",
url.psz_protocol, url.psz_host, url.i_port,
psz_extra_sout != NULL ? "," : "",
@@ -85,6 +89,7 @@ error:
if (p_item != NULL)
{
free(p_item->psz_name);
+ free(p_item->psz_uri);
free(p_item->psz_sout);
free(p_item->psz_icon_uri);
free(p_item);
@@ -109,6 +114,14 @@ vlc_renderer_item_sout(const vlc_renderer_item_t *p_item)
}
const char *
+vlc_renderer_item_uri(const vlc_renderer_item_t *p_item)
+{
+ assert(p_item != NULL);
+
+ return p_item->psz_uri;
+}
+
+const char *
vlc_renderer_item_icon_uri(const vlc_renderer_item_t *p_item)
{
assert(p_item != NULL);
@@ -141,6 +154,7 @@ vlc_renderer_item_release(vlc_renderer_item_t *p_item)
if (atomic_fetch_sub(&p_item->refs, 1) != 1)
return;
free(p_item->psz_name);
+ free(p_item->psz_uri);
free(p_item->psz_sout);
free(p_item->psz_icon_uri);
free(p_item);
--
2.9.3
More information about the vlc-devel
mailing list