Commit c6e29a7d authored by Clément Stenac's avatar Clément Stenac

New helper to create nodes for services discovery

parent 28bd3a4a
......@@ -279,6 +279,7 @@ VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlis
VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( void, playlist_NodesCreateForSD, (playlist_t *, char *, playlist_item_t **, playlist_item_t ** ) );
/* Tree walking - These functions are only for playlist, not plugins */
playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
......
......@@ -512,6 +512,7 @@ struct module_symbols_t
void (*playlist_NodeDump_inner) (playlist_t *p_playlist, playlist_item_t *p_item, int i_level);
int (*__intf_UserOkayCancel_inner) (vlc_object_t*, const char*, const char*);
int (*__intf_UserStringInput_inner) (vlc_object_t*, const char*, const char*, char **);
void (*playlist_NodesCreateForSD_inner) (playlist_t *, char *, playlist_item_t **, playlist_item_t **);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -979,6 +980,7 @@ struct module_symbols_t
# define playlist_NodeDump (p_symbols)->playlist_NodeDump_inner
# define __intf_UserOkayCancel (p_symbols)->__intf_UserOkayCancel_inner
# define __intf_UserStringInput (p_symbols)->__intf_UserStringInput_inner
# define playlist_NodesCreateForSD (p_symbols)->playlist_NodesCreateForSD_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1449,6 +1451,7 @@ struct module_symbols_t
((p_symbols)->playlist_NodeDump_inner) = playlist_NodeDump; \
((p_symbols)->__intf_UserOkayCancel_inner) = __intf_UserOkayCancel; \
((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
(p_symbols)->playlist_CopyParents_deprecated = NULL; \
......
......@@ -62,7 +62,7 @@ vlc_module_end();
struct services_discovery_sys_t
{
/* playlist node */
playlist_item_t *p_node;
playlist_item_t *p_node_cat, *p_node_one;
playlist_t *p_playlist;
AvahiSimplePoll *simple_poll;
......@@ -302,14 +302,8 @@ static int Open( vlc_object_t *p_this )
goto error;
}
p_view = playlist_ViewFind( p_sys->p_playlist, VIEW_CATEGORY );
p_sys->p_node = playlist_NodeCreate( p_sys->p_playlist, VIEW_CATEGORY,
_("Bonjour"), p_view->p_root );
p_sys->p_node->i_flags |= PLAYLIST_RO_FLAG;
val.b_bool = VLC_TRUE;
var_Set( p_sys->p_playlist, "intf-change", val );
playlist_NodesCreateForSD( p_playlist, _("Bonjour"), &p_sys->p_node_cat,
&p_sys->p_node_one );
p_sd->pf_run = Run;
return VLC_SUCCESS;
......
......@@ -127,16 +127,8 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_sys->p_node_cat = playlist_NodeCreate( p_playlist, _("Devices"),
p_playlist->p_root_category );
p_sys->p_node_cat->i_flags |= PLAYLIST_RO_FLAG;
p_sys->p_node_one = playlist_NodeCreate( p_playlist, _("Devices"),
p_playlist->p_root_onelevel );
p_sys->p_node_one->i_flags |= PLAYLIST_RO_FLAG;
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
playlist_NodesCreateForSD( p_playlist, _("Devices"),
&p_sys->p_node_cat, &p_sys->p_node_one );
vlc_object_release( p_playlist );
return VLC_SUCCESS;
......
......@@ -318,20 +318,9 @@ static int Open( vlc_object_t *p_this )
msg_Warn( p_sd, "unable to find playlist, cancelling SAP listening");
return VLC_EGENERIC;
}
p_sys->p_node_cat = playlist_NodeCreate( p_sys->p_playlist,
_("SAP sessions"),
p_sys->p_playlist->p_root_category );
p_sys->p_node_cat->i_flags |= PLAYLIST_RO_FLAG;
p_sys->p_node_cat->i_flags |= PLAYLIST_SKIP_FLAG;
p_sys->p_node_one = playlist_NodeCreate( p_sys->p_playlist,
_("SAP sessions"),
p_sys->p_playlist->p_root_onelevel );
p_sys->p_node_one->i_flags |= PLAYLIST_RO_FLAG;
p_sys->p_node_one->i_flags |= PLAYLIST_SKIP_FLAG;
val.b_bool = VLC_TRUE;
var_Set( p_sys->p_playlist, "intf-change", val );
playlist_NodesCreateForSD( p_sys->p_playlist, _("SAP sessions"),
&p_sys->p_node_cat, &p_sys->p_node_one );
p_sys->i_announces = 0;
p_sys->pp_announces = NULL;
......
......@@ -292,6 +292,23 @@ playlist_item_t *playlist_ChildSearchName( playlist_item_t *p_node,
return NULL;
}
void playlist_NodesCreateForSD( playlist_t *p_playlist, char *psz_name,
playlist_item_t **pp_node_cat,
playlist_item_t **pp_node_one )
{
*pp_node_cat = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_root_category );
(*pp_node_cat)->i_flags |= PLAYLIST_RO_FLAG;
(*pp_node_cat)->i_flags |= PLAYLIST_SKIP_FLAG;
*pp_node_one = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_root_onelevel );
(*pp_node_one)->i_flags |= PLAYLIST_RO_FLAG;
(*pp_node_one)->i_flags |= PLAYLIST_SKIP_FLAG;
}
/**********************************************************************
* Tree walking functions
**********************************************************************/
......
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