]> git.sesse.net Git - vlc/commitdiff
playlist: move SD loading/unloading to playlist code...
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 26 Nov 2012 22:01:11 +0000 (00:01 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 26 Nov 2012 22:16:42 +0000 (00:16 +0200)
...instead of libvlc.c. Note that this only concerns the playlist SD.
The LibVLC SD were always dealt with separately.

src/libvlc.c
src/playlist/engine.c

index 9a3d03cdda11115fc72460eb3e9154d449b0a6bf..716f75218c879d0773aeb3c198239f41fc17ad4d 100644 (file)
@@ -452,16 +452,6 @@ dbus_out:
     }
 #endif
 
-    /* Add service discovery modules */
-    psz_modules = var_InheritString( p_libvlc, "services-discovery" );
-    if( psz_modules )
-    {
-        char *p = psz_modules, *m;
-        while( ( m = strsep( &p, " :," ) ) != NULL )
-            playlist_ServicesDiscoveryAdd( pl_Get(p_libvlc), m );
-        free( psz_modules );
-    }
-
 #ifdef ENABLE_VLM
     /* Initialize VLM if vlm-conf is specified */
     psz_parser = var_CreateGetNonEmptyString( p_libvlc, "vlm-conf" );
@@ -587,14 +577,6 @@ dbus_out:
 void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 {
     libvlc_priv_t *priv = libvlc_priv (p_libvlc);
-    playlist_t    *p_playlist = libvlc_priv (p_libvlc)->p_playlist;
-
-    /* Remove all services discovery */
-    if( p_playlist != NULL )
-    {
-        msg_Dbg( p_libvlc, "removing all services discovery tasks" );
-        playlist_ServicesDiscoveryKillAll( p_playlist );
-    }
 
     /* Ask the interfaces to stop and destroy them */
     msg_Dbg( p_libvlc, "removing all interfaces" );
@@ -620,6 +602,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 #endif
 
     /* Free playlist now, all threads are gone */
+    playlist_t *p_playlist = libvlc_priv (p_libvlc)->p_playlist;
     if( p_playlist != NULL )
         playlist_Destroy( p_playlist );
 
index dc5b0e92fa2ffa541aafd3b5f094e267de90b4a9..c4aa7c8330f7f66c30860176957b0bb08c1854aa 100644 (file)
@@ -304,6 +304,16 @@ static playlist_t *playlist_Create( vlc_object_t *p_parent )
     /* Thread */
     playlist_Activate (p_playlist);
 
+    /* Add service discovery modules */
+    char *mods = var_InheritString( p_playlist, "services-discovery" );
+    if( mods != NULL )
+    {
+        char *p = mods, *m;
+        while( (m = strsep( &p, " :," )) != NULL )
+            playlist_ServicesDiscoveryAdd( p_playlist, m );
+        free( mods );
+    }
+
     return p_playlist;
 }
 
@@ -318,6 +328,9 @@ void playlist_Destroy( playlist_t *p_playlist )
 {
     playlist_private_t *p_sys = pl_priv(p_playlist);
 
+    /* Remove all services discovery */
+    playlist_ServicesDiscoveryKillAll( p_playlist );
+
     msg_Dbg( p_playlist, "destroying" );
 
     playlist_Deactivate( p_playlist );