[vlc-devel] [PATCH 3/8] renderer: add vlc_renderer_item_uri
Rémi Denis-Courmont
remi at remlab.net
Mon Sep 19 22:36:01 CEST 2016
Le maanantaina 19. syyskuuta 2016, 19.09.46 EEST Thomas Guillem a écrit :
> For display purpose
URL are meant to be human-readable, but are mostly meant to locate things, not
to be displayed.
In any case, I don´t see what this adds over the existing name property.
> ---
> 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);
--
Rémi Denis-Courmont
Nonsponsored VLC developer
http://www.remlab.net/CV.pdf
More information about the vlc-devel
mailing list