]> git.sesse.net Git - vlc/blobdiff - src/playlist/engine.c
Move intf-popupmenu and video-on-top variables from playlist to libvlc.
[vlc] / src / playlist / engine.c
index a4d2e18bf2c4e1f8a7e30a0f880da011181119b9..f22d76036ed3cc705e525123732f845d169e04d6 100644 (file)
@@ -1,8 +1,7 @@
 /*****************************************************************************
  * engine.c : Run the playlist and handle its control
  *****************************************************************************
- * Copyright (C) 1999-2007 the VideoLAN team
- * $Id$
+ * Copyright (C) 1999-2008 the VideoLAN team
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          ClĂ©ment Stenac <zorglub@videolan.org>
@@ -68,10 +67,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     p_playlist = vlc_custom_create( p_parent, sizeof( *p_playlist ),
                                     VLC_OBJECT_GENERIC, playlist_name );
     if( !p_playlist )
-    {
-        msg_Err( p_parent, "out of memory" );
         return NULL;
-    }
 
     TAB_INIT( p_playlist->i_sds, p_playlist->pp_sds );
 
@@ -199,6 +195,16 @@ static void ObjectGarbageCollector( playlist_t *p_playlist, bool b_force )
     }
 
     vlc_mutex_lock( &p_playlist->gc_lock );
+    while( ( p_obj = vlc_object_find( p_playlist->p_libvlc, VLC_OBJECT_VOUT,
+                                                  FIND_CHILD ) ) )
+    {
+        vlc_object_release( p_obj );
+        if( p_obj->p_parent == VLC_OBJECT(p_playlist->p_libvlc) )
+        {
+            msg_Dbg( p_playlist, "garbage collector destroying 1 vout" );
+            vlc_object_release( p_obj ); /* Hmm, is this (thread-)safe?? */
+        }
+    }
     p_playlist->b_cant_sleep = false;
     vlc_mutex_unlock( &p_playlist->gc_lock );
 }
@@ -225,7 +231,7 @@ static void input_selected_stream_changed( const vlc_event_t * event, void * dat
 /* Internals */
 void playlist_release_current_input( playlist_t * p_playlist )
 {
-    vlc_assert_locked( &p_playlist->object_lock );
+    vlc_assert_locked( &(vlc_internals(p_playlist)->lock) );
 
     if( !p_playlist->p_input ) return;
 
@@ -248,7 +254,7 @@ void playlist_release_current_input( playlist_t * p_playlist )
 void playlist_set_current_input(
     playlist_t * p_playlist, input_thread_t * p_input )
 {
-    vlc_assert_locked( &p_playlist->object_lock );
+    vlc_assert_locked( &(vlc_internals(p_playlist)->lock) );
 
     playlist_release_current_input( p_playlist );
 
@@ -477,7 +483,8 @@ void playlist_LastLoop( playlist_t *p_playlist )
 #endif
 
     /* Core should have terminated all SDs before the playlist */
-    assert( p_playlist->i_sds == 0 );
+    /* TODO: It fails to do so when not playing anything -- Courmisch */
+    playlist_ServicesDiscoveryKillAll( p_playlist );
     playlist_MLDump( p_playlist );
 
     PL_LOCK;
@@ -596,7 +603,7 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
     input_item_t *p_item;
     int i_activity;
 
-    vlc_mutex_lock( &p_obj->object_lock );
+    vlc_object_lock( p_obj );
 
     while( vlc_object_alive( p_obj ) )
     {
@@ -608,7 +615,7 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
 
         p_item = p_obj->pp_waiting[0];
         REMOVE_ELEM( p_obj->pp_waiting, p_obj->i_waiting, 0 );
-        vlc_mutex_unlock( &p_obj->object_lock );
+        vlc_object_unlock( p_obj );
         if( p_item )
         {
             int i_ret;
@@ -659,9 +666,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
         vlc_object_unlock( p_obj );
         /* Sleep at least 1ms */
         msleep( (i_activity+1) * 1000 );
-        vlc_mutex_lock( &p_obj->object_lock );
+        vlc_object_lock( p_obj );
     }
-    vlc_mutex_unlock( &p_obj->object_lock );
+    vlc_object_unlock( p_obj );
 }
 
 static void VariablesInit( playlist_t *p_playlist )
@@ -686,8 +693,6 @@ static void VariablesInit( playlist_t *p_playlist )
     val.i_int = -1;
     var_Set( p_playlist, "playlist-current", val );
 
-    var_Create( p_playlist, "intf-popupmenu", VLC_VAR_BOOL );
-
     var_Create( p_playlist, "activity", VLC_VAR_INTEGER );
     var_SetInteger( p_playlist, "activity", 0 );