X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fservices_discovery%2Fsap.c;h=23b8c946238a85387737fb9b505ce951f5f1d5a7;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=117835ce4d411db6e5ffebcfc3b07d7a6c74d818;hpb=5cfa9d1c925806f33bd5aee8c15811c31327ef04;p=vlc diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 117835ce4d..23b8c94623 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -27,7 +27,6 @@ * Includes *****************************************************************************/ #include -#include /* malloc(), free() */ #include #include @@ -219,8 +218,6 @@ struct sap_announce_t sdp_t *p_sdp; int i_input_id; - int i_item_id_cat; - int i_item_id_one; }; struct services_discovery_sys_t @@ -229,10 +226,6 @@ struct services_discovery_sys_t int i_fd; int *pi_fd; - /* playlist node */ - playlist_item_t *p_node_cat; - playlist_item_t *p_node_one; - /* Table of announces */ int i_announces; struct sap_announce_t **pp_announces; @@ -309,13 +302,9 @@ static int Open( vlc_object_t *p_this ) /* Cache sap_timeshift value */ p_sys->b_timeshift = var_CreateGetInteger( p_sd, "sap-timeshift" ); - /* Create our playlist node */ - pl_Yield( p_sd ); + /* Set our name */ + services_discovery_SetLocalizedName( p_sd, _("SAP") ); - playlist_NodesPairCreate( pl_Get( p_sd ), _("SAP sessions"), - &p_sys->p_node_cat, &p_sys->p_node_one, - VLC_TRUE ); - p_sys->p_node_cat->p_input->b_prefers_tree = VLC_TRUE; p_sys->i_announces = 0; p_sys->pp_announces = NULL; @@ -328,7 +317,7 @@ static int Open( vlc_object_t *p_this ) static int OpenDemux( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; - uint8_t *p_peek; + const uint8_t *p_peek; char *psz_sdp = NULL; sdp_t *p_sdp = NULL; int errval = VLC_EGENERIC; @@ -438,10 +427,6 @@ static void Close( vlc_object_t *p_this ) } FREENULL( p_sys->pp_announces ); - playlist_NodeDelete( pl_Get(p_sd), p_sys->p_node_cat, VLC_TRUE, - VLC_TRUE ); - playlist_NodeDelete( pl_Get(p_sd), p_sys->p_node_one, VLC_TRUE, - VLC_TRUE ); pl_Release( p_sd ); free( p_sys ); } @@ -509,7 +494,7 @@ static void Run( services_discovery_t *p_sd ) if( s != INVALID_SOCKET ) { INTERFACE_INFO ifaces[10]; // Assume there will be no more than 10 IP interfaces - size_t len = sizeof(ifaces); + size_t len = sizeof(ifaces); if( SOCKET_ERROR != WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0, &ifaces, len, &len, NULL, NULL) ) { @@ -605,13 +590,13 @@ static int Demux( demux_t *p_demux ) return VLC_EGENERIC; } - p_parent_input = input_GetItem(p_input); + p_parent_input = input_GetItem( p_input ); + + input_item_SetURI( p_parent_input, p_sdp->psz_uri ); + input_item_SetName( p_parent_input, p_sdp->psz_sessionname ); vlc_mutex_lock( &p_parent_input->lock ); - FREENULL( p_parent_input->psz_uri ); - p_parent_input->psz_uri = strdup( p_sdp->psz_uri ); - FREENULL( p_parent_input->psz_name ); - p_parent_input->psz_name = strdup( p_sdp->psz_sessionname ); + p_parent_input->i_type = ITEM_TYPE_NET; if( p_playlist->status.p_item && @@ -780,7 +765,6 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash, sdp_t *p_sdp ) { input_item_t *p_input; - playlist_item_t *p_item, *p_child; const char *psz_value; sap_announce_t *p_sap = (sap_announce_t *)malloc( sizeof(sap_announce_t ) ); @@ -827,34 +811,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash, else psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "x-plgroup" ); - if( psz_value != NULL ) - { - p_child = playlist_ChildSearchName( p_sys->p_node_cat, psz_value ); - - if( p_child == NULL ) - { - p_child = playlist_NodeCreate( pl_Get( p_sd ), psz_value, - p_sys->p_node_cat, 0 ); - p_child->i_flags &= ~PLAYLIST_SKIP_FLAG; - } - } - else - { - p_child = p_sys->p_node_cat; - } - - p_item = playlist_NodeAddInput( pl_Get( p_sd ), p_input, p_child, - PLAYLIST_APPEND, PLAYLIST_END, VLC_FALSE ); - p_item->i_flags &= ~PLAYLIST_SKIP_FLAG; - p_item->i_flags &= ~PLAYLIST_SAVE_FLAG; - p_sap->i_item_id_cat = p_item->i_id; - - p_item = playlist_NodeAddInput( pl_Get( p_sd ), p_input, - p_sys->p_node_one, PLAYLIST_APPEND, PLAYLIST_END, - VLC_FALSE ); - p_item->i_flags &= ~PLAYLIST_SKIP_FLAG; - p_item->i_flags &= ~PLAYLIST_SAVE_FLAG; - p_sap->i_item_id_one = p_item->i_id; + services_discovery_AddItem( p_sd, p_input, psz_value /* category name */ ); TAB_APPEND( p_sys->i_announces, p_sys->pp_announces, p_sap );