}
/**
- * Initialize an input thread and run it. This thread will clean after itself,
- * you can forget about it. It can work either in blocking or non-blocking mode
+ * Initialize an input thread and run it until it stops by itself.
*
* \param p_parent a vlc_object
* \param p_item an input item
- * \param b_block should we block until read is finished ?
* \return an error code, VLC_SUCCESS on success
*/
-int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
- bool b_block )
+int __input_Read( vlc_object_t *p_parent, input_item_t *p_item )
{
input_thread_t *p_input;
if( !p_input )
return VLC_EGENERIC;
- if( b_block )
- {
- RunAndDestroy( VLC_OBJECT(p_input) );
- return VLC_SUCCESS;
- }
- else
- {
- if( vlc_thread_create( p_input, "input", RunAndDestroy,
- VLC_THREAD_PRIORITY_INPUT ) )
- {
- input_ChangeState( p_input, ERROR_S );
- msg_Err( p_input, "cannot create input thread" );
- vlc_object_release( p_input );
- return VLC_EGENERIC;
- }
- }
+ RunAndDestroy( VLC_OBJECT(p_input) );
return VLC_SUCCESS;
}
mtime_t i_start_mdate = mdate();
mtime_t i_intf_update = 0;
mtime_t i_statistic_update = 0;
+ bool b_pause_after_eof = var_CreateGetBool( p_input, "play-and-pause" );
/* Start the timer */
stats_TimerStop( p_input, STATS_TIMER_INPUT_LAUNCHING );
* is paused -> this may cause problem with some of them
* The same problem can be seen when seeking while paused */
b_paused = p_input->p->i_state == PAUSE_S &&
- !es_out_GetBuffering( p_input->p->p_es_out );
+ ( !es_out_GetBuffering( p_input->p->p_es_out ) || p_input->p->input.b_eof );
b_demux_polled = true;
if( !b_paused )
i_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
}
- else if( !p_input->b_eof && !es_out_GetEmpty( p_input->p->p_es_out ) )
+ else if( !es_out_GetEmpty( p_input->p->p_es_out ) )
{
msg_Dbg( p_input, "waiting decoder fifos to empty" );
i_wakeup = mdate() + INPUT_IDLE_SLEEP;
}
+ else if( b_pause_after_eof )
+ {
+ msg_Dbg( p_input, "pausing at EOF (pause after each)");
+ val.i_int = PAUSE_S;
+ Control( p_input, INPUT_CONTROL_SET_STATE, val );
+
+ b_pause_after_eof = false;
+ b_paused = true;
+ }
else
{
if( MainLoopTryRepeat( p_input, &i_start_mdate ) )
break;
+ b_pause_after_eof = var_GetBool( p_input, "play-and-pause" );
}
}