p_demux->pf_control = Control;
p_demux->pf_demux = Demux;
- free( psz_sdp );
+ FREE( psz_sdp );
return VLC_SUCCESS;
error:
- free( psz_sdp );
- if( p_sdp ) FreeSDP( p_sdp );
+ FREE( psz_sdp );
+ if( p_sdp ) FreeSDP( p_sdp ); p_sdp = NULL;
stream_Seek( p_demux->s, 0 );
return VLC_EGENERIC;
}
demux_t *p_demux = (demux_t *)p_this;
if( p_demux->p_sys )
{
- if( p_demux->p_sys->p_sdp ) FreeSDP( p_demux->p_sys->p_sdp );
+ if( p_demux->p_sys->p_sdp ) { FreeSDP( p_demux->p_sys->p_sdp ); p_demux->p_sys->p_sdp = NULL; }
free( p_demux->p_sys );
}
}
{
sdp_t *p_sdp = p_demux->p_sys->p_sdp;
playlist_t *p_playlist;
+ input_thread_t *p_input;
+ input_item_t *p_parent_input;
p_playlist = (playlist_t *)vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
+ if( !p_playlist )
+ {
+ msg_Err( p_demux, "playlist could not be found" );
+ return VLC_EGENERIC;
+ }
+
+ p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT,
+ FIND_PARENT );
+ if( !p_input )
+ {
+ msg_Err( p_demux, "parent input could not be found" );
+ return VLC_EGENERIC;
+ }
+
+ p_parent_input = p_input->input.p_item;
- /* TODO FIXME !! Add at the correct place */
- playlist_PlaylistAdd( p_playlist, p_sdp->psz_uri, EnsureUTF8( p_sdp->psz_sessionname ),
- PLAYLIST_APPEND, PLAYLIST_END );
+ vlc_mutex_lock( &p_parent_input->lock );
+ FREE( p_parent_input->psz_uri );
+ p_parent_input->psz_uri = strdup( p_sdp->psz_uri );
+ FREE( p_parent_input->psz_name );
+ p_parent_input->psz_name = strdup( EnsureUTF8( p_sdp->psz_sessionname ) );
+ p_parent_input->i_type = ITEM_TYPE_NET;
+ if( p_playlist->status.p_item &&
+ p_playlist->status.p_item->p_input == p_parent_input )
+ {
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
+ p_playlist->status.p_node, p_playlist->status.p_item );
+ }
+
+ vlc_mutex_unlock( &p_parent_input->lock );
+ vlc_object_release( p_input );
vlc_object_release( p_playlist );
- if( p_sdp ) FreeSDP( p_sdp );
return VLC_SUCCESS;
}
{
p_sd->p_sys->pp_announces[i]->i_last = mdate();
}
- FreeSDP( p_sdp );
+ FreeSDP( p_sdp ); p_sdp = NULL;
return VLC_SUCCESS;
}
}
if( psz_sdp[1] != '=' )
{
msg_Warn( p_obj, "invalid packet" ) ;
- FreeSDP( p_sdp );
+ FreeSDP( p_sdp ); p_sdp = NULL;
return NULL;
}
if( b_invalid )
{
- FreeSDP( p_sdp );
+ FreeSDP( p_sdp ); p_sdp = NULL;
return NULL;
}
REMOVE_ELEM( p_sdp->pp_attributes, p_sdp->i_attributes, i);
FREE( p_attr );
}
- free( p_sdp );
+ FREE( p_sdp );
}
static int RemoveAnnounce( services_discovery_t *p_sd,
{
int i;
- if( p_announce->p_sdp ) FreeSDP( p_announce->p_sdp );
+ if( p_announce->p_sdp )
+ {
+ FreeSDP( p_announce->p_sdp );
+ p_announce->p_sdp = NULL;
+ }
if( p_announce->i_input_id > -1 )
{