p_input->p->i_start = 0;
p_input->i_time = 0;
p_input->p->i_stop = 0;
+ p_input->p->i_run = 0;
p_input->p->i_title = 0;
p_input->p->title = NULL;
p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
*****************************************************************************/
static void MainLoop( input_thread_t *p_input )
{
+ int64_t i_start_mdate = mdate();
int64_t i_intf_update = 0;
int i_updates = 0;
/* Do the read */
if( p_input->i_state != PAUSE_S )
{
- if( p_input->p->i_stop <= 0 || p_input->i_time < p_input->p->i_stop )
- i_ret=p_input->p->input.p_demux->pf_demux(p_input->p->input.p_demux);
+ if( ( p_input->p->i_stop > 0 && p_input->i_time >= p_input->p->i_stop ) ||
+ ( p_input->p->i_run > 0 && i_start_mdate+p_input->p->i_run < mdate() ) )
+ i_ret = 0; /* EOF */
else
- i_ret = 0; /* EOF */
+ i_ret = p_input->p->input.p_demux->pf_demux(p_input->p->input.p_demux);
if( i_ret > 0 )
{
input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION,
&val );
}
+
+ /* */
+ i_start_mdate = mdate();
}
}
else if( i_ret < 0 )
/* Start time*/
/* Set start time */
- p_input->p->i_start = (int64_t)var_GetInteger( p_input, "start-time" ) *
- I64C(1000000);
- p_input->p->i_stop = (int64_t)var_GetInteger( p_input, "stop-time" ) *
- I64C(1000000);
+ p_input->p->i_start = I64C(1000000) * var_GetInteger( p_input, "start-time" );
+ p_input->p->i_stop = I64C(1000000) * var_GetInteger( p_input, "stop-time" );
+ p_input->p->i_run = I64C(1000000) * var_GetInteger( p_input, "run-time" );
+ if( p_input->p->i_run < 0 )
+ {
+ msg_Warn( p_input, "invalid run-time ignored" );
+ p_input->p->i_run = 0;
+ }
if( p_input->p->i_start > 0 )
{
/* */
int64_t i_start; /* :start-time,0 by default */
int64_t i_stop; /* :stop-time, 0 if none */
+ int64_t i_run; /* :run-time, 0 if none */
/* Title infos FIXME multi-input (not easy) ? */
int i_title;
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "start-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "stop-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
+ var_Create( p_input, "run-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "input-slave",
VLC_VAR_STRING | VLC_VAR_DOINHERIT );
#define STOP_TIME_LONGTEXT N_( \
"The stream will stop at this position (in seconds)." )
+#define RUN_TIME_TEXT N_("Run time")
+#define RUN_TIME_LONGTEXT N_( \
+ "The stream will run this duration (in seconds)." )
+
#define INPUT_LIST_TEXT N_("Input list")
#define INPUT_LIST_LONGTEXT N_( \
"You can give a comma-separated list " \
START_TIME_TEXT, START_TIME_LONGTEXT, VLC_TRUE );
add_integer( "stop-time", 0, NULL,
STOP_TIME_TEXT, STOP_TIME_LONGTEXT, VLC_TRUE );
+ add_integer( "run-time", 0, NULL,
+ RUN_TIME_TEXT, RUN_TIME_LONGTEXT, VLC_TRUE );
add_string( "input-list", NULL, NULL,
INPUT_LIST_TEXT, INPUT_LIST_LONGTEXT, VLC_TRUE );
add_string( "input-slave", NULL, NULL,