[vlc-devel] [PATCH 4/8] renderer: tell when a demux-filter should be used with a renderer
Thomas Guillem
thomas at gllm.fr
Mon Sep 19 19:09:47 CEST 2016
From: Steve Lhomme <robUx4 at videolabs.io>
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
include/vlc_renderer_discovery.h | 11 +++++++++--
modules/services_discovery/microdns.c | 10 +++++++---
src/libvlccore.sym | 1 +
src/misc/renderer_discovery.c | 18 ++++++++++++++++--
4 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/include/vlc_renderer_discovery.h b/include/vlc_renderer_discovery.h
index 7e8c45f..ff32b2b 100644
--- a/include/vlc_renderer_discovery.h
+++ b/include/vlc_renderer_discovery.h
@@ -49,12 +49,13 @@
* @param psz_extra_sout extra sout options
* @param psz_icon_uri icon uri of the renderer item
* @param i_flags flags for the item
+ * @param psz_demux_filter demux filter to use with the renderer
* @return a renderer item or NULL in case of error
*/
VLC_API vlc_renderer_item_t *
vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
- const char *psz_extra_sout, const char *psz_icon_uri,
- int i_flags) VLC_USED;
+ const char *psz_extra_sout, const char *psz_demux_filter,
+ const char *psz_icon_uri, int i_flags) VLC_USED;
/**
* Hold a renderer item, i.e. creates a new reference
@@ -81,6 +82,12 @@ VLC_API const char *
vlc_renderer_item_sout(const vlc_renderer_item_t *p_item);
/**
+ * Get the demux filter to use with a renderer item
+ */
+VLC_API const char *
+vlc_renderer_item_demux_filter(const vlc_renderer_item_t *p_item);
+
+/**
* Get the uri of a renderer item
*/
VLC_API const char *
diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index 641e306..8b18200 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -183,7 +183,8 @@ items_add_input( struct discovery_sys *p_sys, services_discovery_t *p_sd,
static int
items_add_renderer( struct discovery_sys *p_sys, vlc_renderer_discovery_t *p_rd,
const char *psz_name, char *psz_uri,
- const char *psz_icon_uri, int i_flags )
+ const char *psz_demux_filter, const char *psz_icon_uri,
+ int i_flags )
{
struct item *p_item = malloc( sizeof(struct item) );
if( p_item == NULL )
@@ -192,7 +193,8 @@ items_add_renderer( struct discovery_sys *p_sys, vlc_renderer_discovery_t *p_rd,
const char *psz_extra_uri = i_flags & VLC_RENDERER_CAN_VIDEO ? NULL : "video=0";
vlc_renderer_item_t *p_renderer_item =
- vlc_renderer_item_new( psz_name, psz_uri, psz_extra_uri, psz_icon_uri, i_flags );
+ vlc_renderer_item_new( psz_name, psz_uri, psz_extra_uri,
+ psz_demux_filter, psz_icon_uri, i_flags );
if( p_renderer_item == NULL )
{
free( psz_uri );
@@ -483,6 +485,7 @@ new_entries_rd_cb( void *p_this, int i_status, const struct rr_entry *p_entries
char *psz_icon_uri = NULL;
char *psz_uri = create_uri( p_srv->psz_protocol, psz_ip, b_ipv6,
p_srv->i_port );
+ const char *psz_demux_filter = NULL;
if( psz_uri == NULL )
break;
@@ -507,7 +510,8 @@ new_entries_rd_cb( void *p_this, int i_status, const struct rr_entry *p_entries
p_srv->i_renderer_flags |= VLC_RENDERER_CAN_VIDEO;
items_add_renderer( p_sys, p_rd, p_srv->psz_device_name, psz_uri,
- psz_icon_uri, p_srv->i_renderer_flags );
+ psz_demux_filter, psz_icon_uri,
+ p_srv->i_renderer_flags );
free(psz_icon_uri);
}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 3222730..37e4c1f 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -767,6 +767,7 @@ vlc_renderer_item_name
vlc_renderer_item_sout
vlc_renderer_item_uri
vlc_renderer_item_icon_uri
+vlc_renderer_item_demux_filter
vlc_renderer_item_flags
vlc_rd_get_names
vlc_rd_new
diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index fa17b32..f5b529c 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -38,14 +38,15 @@ struct vlc_renderer_item_t
char *psz_uri;
char *psz_sout;
char *psz_icon_uri;
+ char *psz_demux_filter;
int i_flags;
atomic_uint refs;
};
vlc_renderer_item_t *
vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
- const char *psz_extra_sout, const char *psz_icon_uri,
- int i_flags)
+ const char *psz_extra_sout, const char *psz_demux_filter,
+ const char *psz_icon_uri, int i_flags)
{
assert(psz_uri != NULL);
vlc_renderer_item_t *p_item = NULL;
@@ -79,6 +80,9 @@ vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
if ((p_item->psz_icon_uri = strdup(psz_icon_uri)) == NULL)
goto error;
+ if ((p_item->psz_demux_filter = strdup(psz_demux_filter)) == NULL)
+ goto error;
+
p_item->i_flags = i_flags;
atomic_init(&p_item->refs, 1);
vlc_UrlClean(&url);
@@ -92,6 +96,7 @@ error:
free(p_item->psz_uri);
free(p_item->psz_sout);
free(p_item->psz_icon_uri);
+ free(p_item->psz_demux_filter);
free(p_item);
}
return NULL;
@@ -129,6 +134,14 @@ vlc_renderer_item_icon_uri(const vlc_renderer_item_t *p_item)
return p_item->psz_icon_uri;
}
+const char *
+vlc_renderer_item_demux_filter(const vlc_renderer_item_t *p_item)
+{
+ assert(p_item != NULL);
+
+ return p_item->psz_demux_filter;
+}
+
int
vlc_renderer_item_flags(const vlc_renderer_item_t *p_item)
{
@@ -157,6 +170,7 @@ vlc_renderer_item_release(vlc_renderer_item_t *p_item)
free(p_item->psz_uri);
free(p_item->psz_sout);
free(p_item->psz_icon_uri);
+ free(p_item->psz_demux_filter);
free(p_item);
}
--
2.9.3
More information about the vlc-devel
mailing list