Commit 1d7b91d6 authored by Laurent Aimar's avatar Laurent Aimar

* all: implemented sout asynch support. (ie sout will try to work at

the maximum speed if the output can control the pace)
parent cb50d64a
......@@ -88,7 +88,7 @@ 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 */
input_thread_t *p_input; /* thread descriptor */
vlc_value_t val;
int i;
......@@ -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;
}
......
......@@ -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,8 +248,11 @@ void input_ClockManageRef( input_thread_t * p_input,
&& p_input->stream.p_selected_program == p_pgrm )
{
p_pgrm->last_cr = i_clock;
if( !p_input->b_out_pace_control )
{
mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
}
}
else
{
p_pgrm->last_cr = 0;
......@@ -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. */
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 );
......
......@@ -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 )
......
......@@ -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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment