Commit 4fbe397b authored by Thomas Guillem's avatar Thomas Guillem

renderer: add vlc_renderer_item_type

parent 832c749a
......@@ -43,6 +43,7 @@
/**
* Create a new renderer item
*
* @param psz_type type of the item
* @param psz_name name of the item
* @param psz_uri uri of the renderer item, must contains a valid protocol and
* a valid host
......@@ -52,9 +53,9 @@
* @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;
vlc_renderer_item_new(const char *psz_type, const char *psz_name,
const char *psz_uri, const char *psz_extra_sout,
const char *psz_icon_uri, int i_flags) VLC_USED;
/**
* Hold a renderer item, i.e. creates a new reference
......@@ -74,6 +75,13 @@ vlc_renderer_item_release(vlc_renderer_item_t *p_item);
VLC_API const char *
vlc_renderer_item_name(const vlc_renderer_item_t *p_item);
/**
* Get the type (not translated) of a renderer item. For now, the type can only
* be "chromecast" ("upnp", "airplay" may come later).
*/
VLC_API const char *
vlc_renderer_item_type(const vlc_renderer_item_t *p_item);
/**
* Get the sout command of a renderer item
*/
......
......@@ -192,7 +192,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( "chromecast", psz_name, psz_uri, psz_extra_uri,
psz_icon_uri, i_flags );
if( p_renderer_item == NULL )
{
free( psz_uri );
......
......@@ -764,6 +764,7 @@ vlc_renderer_item_new
vlc_renderer_item_hold
vlc_renderer_item_release
vlc_renderer_item_name
vlc_renderer_item_type
vlc_renderer_item_sout
vlc_renderer_item_icon_uri
vlc_renderer_item_flags
......
......@@ -35,6 +35,7 @@
struct vlc_renderer_item_t
{
char *psz_name;
char *psz_type;
char *psz_sout;
char *psz_icon_uri;
int i_flags;
......@@ -45,15 +46,16 @@ static void
item_free(vlc_renderer_item_t *p_item)
{
free(p_item->psz_name);
free(p_item->psz_type);
free(p_item->psz_sout);
free(p_item->psz_icon_uri);
free(p_item);
}
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_renderer_item_new(const char *psz_type, const char *psz_name,
const char *psz_uri, const char *psz_extra_sout,
const char *psz_icon_uri, int i_flags)
{
assert(psz_uri != NULL);
vlc_renderer_item_t *p_item = NULL;
......@@ -67,6 +69,9 @@ vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
if (unlikely(p_item == NULL))
goto error;
if ((p_item->psz_type = strdup(psz_type)) == NULL)
goto error;
if (psz_name != NULL)
p_item->psz_name = strdup(psz_name);
else if (asprintf(&p_item->psz_name, "%s (%s)", url.psz_protocol,
......@@ -104,6 +109,14 @@ vlc_renderer_item_name(const vlc_renderer_item_t *p_item)
return p_item->psz_name;
}
const char *
vlc_renderer_item_type(const vlc_renderer_item_t *p_item)
{
assert(p_item != NULL);
return p_item->psz_type;
}
const char *
vlc_renderer_item_sout(const vlc_renderer_item_t *p_item)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment