diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h index d701fbd474963197a9cbbff6099eb8968d94d36c..94b669d63345a2a6fad043127e61a3cf6c1f85b5 100644 --- a/include/vlc_playlist.h +++ b/include/vlc_playlist.h @@ -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, diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 52622d837d7653a707c44bfbbe85c98ebf0335fb..7b828ef5a6b1af47649ff526e1e1814f5a0cea26 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -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; \ diff --git a/modules/services_discovery/bonjour.c b/modules/services_discovery/bonjour.c index ba997fb077f87e1e8acd97aaf7f4428bc203d9a8..a45e60bba2636fbda9ae0f5e2ccba9fee7d545b1 100644 --- a/modules/services_discovery/bonjour.c +++ b/modules/services_discovery/bonjour.c @@ -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; diff --git a/modules/services_discovery/hal.c b/modules/services_discovery/hal.c index a344a7adb9e25e6681f68f3d36fe58a333fa69d0..3729416e1e4cd87634bcf21d53792673dbc0de51 100644 --- a/modules/services_discovery/hal.c +++ b/modules/services_discovery/hal.c @@ -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; diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 9fd77d1fcd4a5849478460ec834d5453c8386bbc..fe639004c5bc7864771aca27aa6e6930e63d29ab 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -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; diff --git a/src/playlist/tree.c b/src/playlist/tree.c index 622137f10342de9a87a4e2d1b47c73dd639ae7e1..7f515aa938453746d49fa802dc4172520f7e7c72 100644 --- a/src/playlist/tree.c +++ b/src/playlist/tree.c @@ -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 **********************************************************************/