[vlc-devel] [PATCH 3/8] renderer: add vlc_renderer_item_uri
Thomas Guillem
thomas at gllm.fr
Tue Sep 20 08:46:35 CEST 2016
On Mon, Sep 19, 2016, at 22:36, Rémi Denis-Courmont wrote:
> 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.
I hesitated with vlc_renderer_item_protocol() to get the protocol
(chromecast, upnp...). I decided to use an uri since you can get the
protocol from it. But just getting the protocol may be more convenient
finally. I do really think that getting the protocol is really important
for the lib user.
By the way, the name may be not enough. Currently, it's just the name of
the device like ("Shield", "Chromecast Audio"...). Maybe I could add the
host to the name, so a name will be like "Shield (192.168.1.42)".
>
> > ---
> > 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
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list