#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include <assert.h>
#include <vlc/vlc.h>
#include "vlc_playlist.h"
#include "vlc_events.h"
#include "playlist_internal.h"
+#include "../libvlc.h"
static void RunSD( services_discovery_t *p_sd );
services_discovery_t *
services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name )
{
- services_discovery_t *p_sd = vlc_object_create( p_super, VLC_OBJECT_SD );
+ services_discovery_t *p_sd;
+ p_sd = vlc_custom_create( p_super, sizeof( *p_sd ), VLC_OBJECT_GENERIC,
+ "services discovery" );
if( !p_sd )
return NULL;
if( p_sd->p_module == NULL )
{
msg_Err( p_super, "no suitable services discovery module" );
- vlc_object_destroy( p_sd );
+ vlc_object_release( p_sd );
return NULL;
}
p_sd->psz_module = strdup( psz_module_name );
free( p_sd->psz_localized_name );
vlc_object_detach( p_sd );
- vlc_object_destroy( p_sd );
+ vlc_object_release( p_sd );
}
/***********************************************************************
VLC_THREAD_PRIORITY_LOW, VLC_FALSE))
{
msg_Err( p_sd, "cannot create services discovery thread" );
- vlc_object_destroy( p_sd );
+ vlc_object_release( p_sd );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
void
services_discovery_SetLocalizedName ( services_discovery_t * p_sd, const char *psz )
{
- if(p_sd->psz_localized_name) free( p_sd->psz_localized_name );
+ free( p_sd->psz_localized_name );
p_sd->psz_localized_name = strdup(psz);
}
p_new_item = playlist_NodeAddInput( p_parent->p_playlist, p_input, p_parent,
PLAYLIST_APPEND, PLAYLIST_END, VLC_FALSE );
- p_new_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
- p_new_item->i_flags &= ~PLAYLIST_SAVE_FLAG;
+ if( p_new_item )
+ {
+ p_new_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
+ p_new_item->i_flags &= ~PLAYLIST_SAVE_FLAG;
+ }
}
/* A new item has been removed from a certain sd */