- if( config_GetInt( p_sd, "sap-ipv4" ) )
- {
- InitSocket( p_sd, SAP_V4_ADDRESS, SAP_PORT );
- }
- if( config_GetInt( p_sd, "sap-ipv6" ) )
- {
- /* [ + 8x4+7*':' + ] */
- char psz_address[42];
- char c_scope;
- char *psz_scope = config_GetPsz( p_sd, "sap-ipv6-scope" );
-
- if( psz_scope == NULL || *psz_scope == '\0')
- {
- c_scope = '8';
- }
- else
- {
- c_scope = psz_scope[0];
- }
- snprintf( psz_address, 42, "[%s%c%s]", IPV6_ADDR_1, c_scope,
- IPV6_ADDR_2 );
- InitSocket( p_sd, psz_address, SAP_PORT );
- }
-
- psz_addr = config_GetPsz( p_sd, "sap-addr" );
- if( psz_addr && *psz_addr )
- {
- InitSocket( p_sd, psz_addr, SAP_PORT );
- }
-
- if( p_sys->i_fd == 0 )
- {
- msg_Err( p_sd, "unable to read on any address");
- return VLC_EGENERIC;
- }
-
- /* Create our playlist node */
- p_playlist = (playlist_t *)vlc_object_find( p_sd, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( !p_playlist )
- {
- msg_Warn( p_sd, "unable to find playlist, cancelling SAP listening");
- return VLC_EGENERIC;
- }
-
- p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
- p_sys->p_node = playlist_NodeCreate( p_playlist, VIEW_CATEGORY,
- _("SAP"), p_view->p_root );
- p_sys->p_node->i_flags |= PLAYLIST_RO_FLAG;
- val.b_bool = VLC_TRUE;
- var_Set( p_playlist, "intf-change", val );