* Includes
*****************************************************************************/
#include <vlc/vlc.h>
-#include <stdlib.h> /* malloc(), free() */
#include <assert.h>
#include <vlc_playlist.h>
sdp_t *p_sdp;
int i_input_id;
- int i_item_id_cat;
- int i_item_id_one;
};
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;
/* 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;
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;
}
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 );
}
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) )
{
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 &&
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 ) );
psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "tool" );
if( psz_value != NULL )
{
- input_ItemAddInfo( p_input, _("Session"),_("Tool"), psz_value );
+ input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s",
+ psz_value );
}
if( strcmp( p_sdp->username, "-" ) )
{
- input_ItemAddInfo( p_input, _("Session"),
- _("User"), p_sdp->username );
+ input_ItemAddInfo( p_input, _("Session"), _("User"), "%s",
+ p_sdp->username );
}
/* Handle group */
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 );