]> git.sesse.net Git - vlc/blobdiff - src/input/input.c
Beginning of Interface II
[vlc] / src / input / input.c
index 3d15f429c109806f32612a7265729cad626d92b6..43bff2eed1ce2ca71071bd105b0e53877f3a9fb0 100644 (file)
@@ -4,9 +4,9 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.77 2001/02/08 13:08:02 massiot Exp $
+ * $Id: input.c,v 1.79 2001/02/11 01:15:11 sam Exp $
  *
- * Authors: 
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -115,7 +115,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
 
     /* Initialize default settings for spawned decoders */
     p_input->p_default_aout = p_main->p_aout;
-    p_input->p_default_vout = p_main->p_intf->p_vout;
+    p_input->p_default_vout = p_main->p_vout;
 
     /* Create thread and set locks. */
     vlc_mutex_init( &p_input->stream.stream_lock );
@@ -197,14 +197,28 @@ static void RunThread( input_thread_t *p_input )
         p_input->c_loops++;
 #endif
 
-        vlc_mutex_lock( &p_input->stream.control.control_lock );
-        if( p_input->stream.control.i_status == BACKWARD_S
-             && p_input->pf_rewind != NULL )
+        vlc_mutex_lock( &p_input->stream.stream_lock );
+        if( p_input->stream.i_seek )
         {
-            p_input->pf_rewind( p_input );
-            /* FIXME: probably don't do it every loop, but when ? */
+            if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
+            {
+                p_input->pf_seek( p_input, p_input->stream.i_seek );
+
+                for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+                {
+                    pgrm_descriptor_t * p_pgrm
+                                            = p_input->stream.pp_programs[i];
+                    /* Escape all decoders for the stream discontinuity they
+                     * will encounter. */
+                    input_EscapeDiscontinuity( p_input, p_pgrm );
+
+                    /* Reinitialize synchro. */
+                    p_pgrm->i_synchro_state = SYNCHRO_REINIT;
+                }
+            }
+            p_input->stream.i_seek = 0;
         }
-        vlc_mutex_unlock( &p_input->stream.control.control_lock );
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
 
         i_error = p_input->pf_read( p_input, pp_packets );
 
@@ -254,7 +268,7 @@ static void InitThread( input_thread_t * p_input )
     p_input->c_packets_trashed          = 0;
 #endif
 
-    p_input->p_input_module = module_Need( p_main->p_module_bank,
+    p_input->p_input_module = module_Need( p_main->p_bank,
                                            MODULE_CAPABILITY_INPUT, NULL );
 
     if( p_input->p_input_module == NULL )
@@ -283,7 +297,7 @@ static void InitThread( input_thread_t * p_input )
 
     if( p_input->b_error )
     {
-        module_Unneed( p_main->p_module_bank, p_input->p_input_module );
+        module_Unneed( p_main->p_bank, p_input->p_input_module );
     }
     else
     {
@@ -338,7 +352,7 @@ static void EndThread( input_thread_t * p_input )
     p_input->pf_end( p_input );
 
     /* Release modules */
-    module_Unneed( p_main->p_module_bank, p_input->p_input_module );
+    module_Unneed( p_main->p_bank, p_input->p_input_module );
 
     /* Destroy Mutex locks */
     vlc_mutex_destroy( &p_input->stream.control.control_lock );