]> git.sesse.net Git - vlc/blobdiff - src/playlist/services_discovery.c
update module LIST file.
[vlc] / src / playlist / services_discovery.c
index 2498ab7fa300e8ddb6b93eedc637c16cbfe3e88b..3c89c48534f9ac61c95371694d7f5cc53031c5c4 100644 (file)
 #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 );
 
@@ -54,7 +56,9 @@ char ** __services_discovery_GetServicesNames( vlc_object_t * p_super,
 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;
 
@@ -76,7 +80,7 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
     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 );
@@ -97,7 +101,7 @@ void services_discovery_Destroy ( services_discovery_t * p_sd )
     free( p_sd->psz_localized_name );
 
     vlc_object_detach( p_sd );
-    vlc_object_destroy( p_sd );
+    vlc_object_release( p_sd );
 }
 
 /***********************************************************************
@@ -110,7 +114,7 @@ int services_discovery_Start ( services_discovery_t * 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;
@@ -142,7 +146,7 @@ services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
 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);
 }
 
@@ -233,8 +237,11 @@ static void playlist_sd_item_added( const vlc_event_t * p_event, void * user_dat
 
     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 */