]> git.sesse.net Git - vlc/commitdiff
* all: implemented sout asynch support. (ie sout will try to work at
authorLaurent Aimar <fenrir@videolan.org>
Sat, 6 Mar 2004 16:36:37 +0000 (16:36 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 6 Mar 2004 16:36:37 +0000 (16:36 +0000)
the maximum speed if the output can control the pace)

src/input/input.c
src/input/input_clock.c
src/input/input_dec.c
src/stream_output/stream_output.c

index 9fa1a742dc2d3664fc0b1b19f8b4d3961f7e2817..42ebbb3127ae0881c4dd4fe4124be5e33b4ba726 100644 (file)
@@ -88,9 +88,9 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, char *psz_uri,
                                       char **ppsz_options, int i_options )
 
 {
-    input_thread_t *    p_input;                        /* thread descriptor */
-    vlc_value_t val;
-    int i;
+    input_thread_t *p_input;                        /* thread descriptor */
+    vlc_value_t     val;
+    int             i;
 
     /* Allocate descriptor */
     p_input = vlc_object_create( p_parent, VLC_OBJECT_INPUT );
@@ -178,6 +178,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, char *psz_uri,
 
     /* Initialize thread properties */
     p_input->b_eof      = 0;
+    p_input->b_out_pace_control = VLC_FALSE;
     p_input->p_sys      = NULL;
 
     /* Set target */
@@ -1022,6 +1023,20 @@ static int InitThread( input_thread_t * p_input )
                         p_sub_toselect->p_es, VLC_TRUE );
     }
 
+    if( p_input->stream.p_sout )
+    {
+        if( p_input->stream.p_sout->i_out_pace_nocontrol > 0 )
+        {
+            p_input->b_out_pace_control = VLC_FALSE;
+        }
+        else
+        {
+            p_input->b_out_pace_control = VLC_TRUE;
+        }
+        msg_Dbg( p_input, "starting in %s mode",
+                 p_input->b_out_pace_control ? "asynch" : "synch" );
+    }
+
     return VLC_SUCCESS;
 }
 
index 182a00c864c8ff427b5da8b8283f47bdf4ef4556..4c249ddafdeff864b303c479d7f98be69a59b3b1 100644 (file)
@@ -2,7 +2,7 @@
  * input_clock.c: Clock/System date convertions, stream management
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: input_clock.c,v 1.45 2004/01/06 12:02:06 zorglub Exp $
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -248,7 +248,10 @@ void input_ClockManageRef( input_thread_t * p_input,
              && p_input->stream.p_selected_program == p_pgrm )
         {
             p_pgrm->last_cr = i_clock;
-            mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+            if( !p_input->b_out_pace_control )
+            {
+                mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+            }
         }
         else
         {
@@ -280,7 +283,10 @@ void input_ClockManageRef( input_thread_t * p_input,
             /* Wait a while before delivering the packets to the decoder.
              * In case of multiple programs, we arbitrarily follow the
              * clock of the selected program. */
-            mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+            if( !p_input->b_out_pace_control )
+            {
+                mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+            }
 
             /* Now take into account interface changes. */
             input_ClockManageControl( p_input, p_pgrm, i_clock );
index 4c80c32ec39ab566ec0f1cb8008394dc14d236b9..ed46ec9999e8b2d88eb7e720105dead16f3247d9 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: input_dec.c,v 1.94 2004/03/03 20:39:53 gbazin Exp $
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -61,6 +61,8 @@ struct decoder_owner_sys_t
 {
     vlc_bool_t      b_own_thread;
 
+    input_thread_t  *p_input;
+
     aout_instance_t *p_aout;
     aout_input_t    *p_aout_input;
 
@@ -279,6 +281,15 @@ void input_DecodeBlock( decoder_t * p_dec, block_t *p_block )
     if( p_dec->p_owner->b_own_thread )
     {
         block_FifoPut( p_dec->p_owner->p_fifo, p_block );
+
+        if( p_dec->p_owner->p_input->b_out_pace_control )
+        {
+            /* FIXME !!!!! */
+            while( p_dec->p_owner->p_fifo->i_depth > 10 )
+            {
+                msleep( 1000 );
+            }
+        }
     }
     else
     {
@@ -462,12 +473,15 @@ static decoder_t * CreateDecoder( input_thread_t * p_input,
         return NULL;
     }
     p_dec->p_owner->b_own_thread = VLC_TRUE;
+    p_dec->p_owner->p_input = p_input;
     p_dec->p_owner->p_aout = NULL;
     p_dec->p_owner->p_aout_input = NULL;
     p_dec->p_owner->p_vout = NULL;
     p_dec->p_owner->p_sout = p_input->stream.p_sout;
     p_dec->p_owner->p_sout_input = NULL;
     p_dec->p_owner->p_es_descriptor = p_es;
+
+
     /* decoder fifo */
     if( ( p_dec->p_owner->p_fifo = block_FifoNew( p_dec ) ) == NULL )
     {
@@ -619,6 +633,20 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
 
                 p_sout_block = p_next;
             }
+
+            /* For now it's enough, as only sout inpact on this flag */
+            if( p_dec->p_owner->p_sout->i_out_pace_nocontrol > 0 &&
+                p_dec->p_owner->p_input->b_out_pace_control )
+            {
+                msg_Dbg( p_dec, "switching to synch mode" );
+                p_dec->p_owner->p_input->b_out_pace_control = VLC_FALSE;
+            }
+            else if( p_dec->p_owner->p_sout->i_out_pace_nocontrol <= 0 &&
+                     !p_dec->p_owner->p_input->b_out_pace_control )
+            {
+                msg_Dbg( p_dec, "switching to asynch mode" );
+                p_dec->p_owner->p_input->b_out_pace_control = VLC_TRUE;
+            }
         }
     }
     else if( p_dec->fmt_in.i_cat == AUDIO_ES )
index dd6f3db6dd5ca7ae05a801203e8fec4b550a1675..ec6127f78912dea80097113b7a81f1b7d0b48b57 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.c : stream output module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
- * $Id: stream_output.c,v 1.41 2004/03/03 20:39:53 gbazin Exp $
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -119,6 +119,7 @@ sout_instance_t * __sout_NewInstance ( vlc_object_t *p_parent,
     p_sout->psz_sout    = strdup( psz_dest );
     p_sout->i_preheader = 0;
     p_sout->i_padding   = 0;
+    p_sout->i_out_pace_nocontrol = 0;
     p_sout->p_sys       = NULL;
 
     vlc_mutex_init( p_sout, &p_sout->lock );