Commit 77592b7d authored by Laurent Aimar's avatar Laurent Aimar

Fixed --input-repeat and large --*-caching value.

The repeat was done before buffered data were consumed.
parent 1a033fe0
......@@ -592,14 +592,14 @@ exit:
* MainLoopDemux
* It asks the demuxer to demux some data
*/
static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t *pi_start_mdate )
static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_start_mdate )
{
int i_ret;
*pb_changed = false;
if( ( p_input->p->i_stop > 0 && p_input->p->i_time >= p_input->p->i_stop ) ||
( p_input->p->i_run > 0 && *pi_start_mdate+p_input->p->i_run < mdate() ) )
( p_input->p->i_run > 0 && i_start_mdate+p_input->p->i_run < mdate() ) )
i_ret = 0; /* EOF */
else
i_ret = demux_Demux( p_input->p->input.p_demux );
......@@ -629,16 +629,26 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t *p
if( i_ret == 0 ) /* EOF */
{
int i_repeat = var_GetInteger( p_input, "input-repeat" );
if( i_repeat == 0 )
{
/* End of file - we do not set b_die because only the
* playlist is allowed to do so. */
msg_Dbg( p_input, "EOF reached" );
p_input->p->input.b_eof = true;
}
else
else if( i_ret < 0 )
{
input_ChangeState( p_input, ERROR_S );
}
if( i_ret > 0 && p_input->p->i_slave > 0 )
{
SlaveDemux( p_input );
}
}
static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
{
int i_repeat = var_GetInteger( p_input, "input-repeat" );
if( i_repeat == 0 )
return VLC_EGENERIC;
vlc_value_t val;
msg_Dbg( p_input, "repeating the same input (%d)", i_repeat );
......@@ -666,29 +676,17 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t *p
if( p_input->p->i_start > 0 )
{
val.i_time = p_input->p->i_start;
input_ControlPush( p_input, INPUT_CONTROL_SET_TIME,
&val );
input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &val );
}
else
{
val.f_float = 0.0;
input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION,
&val );
input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &val );
}
/* */
*pi_start_mdate = mdate();
}
}
else if( i_ret < 0 )
{
input_ChangeState( p_input, ERROR_S );
}
if( i_ret > 0 && p_input->p->i_slave > 0 )
{
SlaveDemux( p_input );
}
return VLC_SUCCESS;
}
/**
......@@ -771,7 +769,7 @@ static void MainLoop( input_thread_t *p_input )
{
if( !p_input->p->input.b_eof )
{
MainLoopDemux( p_input, &b_force_update, &i_start_mdate );
MainLoopDemux( p_input, &b_force_update, i_start_mdate );
i_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
}
......@@ -782,6 +780,7 @@ static void MainLoop( input_thread_t *p_input )
}
else
{
if( MainLoopTryRepeat( p_input, &i_start_mdate ) )
break;
}
}
......
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