]> git.sesse.net Git - vlc/blobdiff - src/playlist/thread.c
Remove config_GetUserDataDir()...
[vlc] / src / playlist / thread.c
index fc9617aca3edf1dccb9c6918e61de49c9d25c66f..3e7bf06ed0e06cfdb0ab55d019f7c658cdbd85d6 100644 (file)
@@ -251,14 +251,17 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
 
     assert( p_sys->p_input == NULL );
 
-    input_thread_t *p_input_thread =
-        input_CreateThreadExtended( p_playlist, p_input, NULL, p_sys->p_input_resource );
-
+    input_thread_t *p_input_thread = input_Create( p_playlist, p_input, NULL, p_sys->p_input_resource );
     if( p_input_thread )
     {
         p_sys->p_input = p_input_thread;
-
         var_AddCallback( p_input_thread, "intf-event", InputEvent, p_playlist );
+
+        if( input_Start( p_sys->p_input ) )
+        {
+            vlc_object_release( p_input_thread );
+            p_sys->p_input = p_input_thread = NULL;
+        }
     }
 
     p_sys->p_input_resource = NULL;
@@ -294,7 +297,7 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
     }
 
     PL_UNLOCK;
-    var_SetInteger( p_playlist, "item-current", p_input->i_id );
+    var_SetAddress( p_playlist, "item-current", p_input );
     PL_LOCK;
 
     return VLC_SUCCESS;
@@ -473,7 +476,7 @@ static int LoopInput( playlist_t *p_playlist )
     if( ( p_sys->request.b_request || !vlc_object_alive( p_playlist ) ) && !p_input->b_die )
     {
         PL_DEBUG( "incoming request - stopping current input" );
-        input_StopThread( p_input );
+        input_Stop( p_input, true );
     }
 
     /* This input is dead. Remove it ! */
@@ -514,7 +517,7 @@ static int LoopInput( playlist_t *p_playlist )
     else if( p_input->b_error || p_input->b_eof )
     {
         PL_DEBUG( "finished input" );
-        input_StopThread( p_input );
+        input_Stop( p_input, false );
     }
     return VLC_SUCCESS;
 }
@@ -552,8 +555,7 @@ static void LoopRequest( playlist_t *p_playlist )
         else
         {
             if( vlc_object_alive( p_playlist ) )
-                vlc_cond_wait( &pl_priv(p_playlist)->signal,
-                               &vlc_internals(p_playlist)->lock );
+                vlc_cond_wait( &p_sys->signal, &p_sys->lock );
         }
         return;
     }
@@ -584,7 +586,7 @@ static void *Thread ( void *data )
     playlist_t *p_playlist = data;
     playlist_private_t *p_sys = pl_priv(p_playlist);
 
-    vlc_object_lock( p_playlist );
+    playlist_Lock( p_playlist );
     while( vlc_object_alive( p_playlist ) || p_sys->p_input )
     {
         /* FIXME: what's that ! */
@@ -598,12 +600,11 @@ static void *Thread ( void *data )
 
         /* If there is an input, check that it doesn't need to die. */
         while( !LoopInput( p_playlist ) )
-            vlc_cond_wait( &pl_priv(p_playlist)->signal,
-                           &vlc_internals(p_playlist)->lock );
+            vlc_cond_wait( &p_sys->signal, &p_sys->lock );
 
         LoopRequest( p_playlist );
     }
-    vlc_object_unlock( p_playlist );
+    playlist_Unlock( p_playlist );
 
     return NULL;
 }