Commit 6563f89c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: replace vlc_object_alive() with a dedicated getter

This is interlocked with the control queue as it most probably should.
parent e970e01e
......@@ -2036,8 +2036,10 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
/* We don't try to reselect */
if( es->p_dec )
{
while( vlc_object_alive(p_sys->p_input) && !p_sys->b_buffering )
{ /* FIXME: This might hold the ES output caller (i.e. the demux), and
* the corresponding thread (typically the input thread), for a little
* bit too long if the ES is deleted in the middle of a stream. */
while( !input_Stopped(p_sys->p_input) && !p_sys->b_buffering )
{
if( input_DecoderIsEmpty( es->p_dec ) &&
( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) ))
......
......@@ -548,6 +548,17 @@ static void *Run( void *obj )
return NULL;
}
bool input_Stopped( input_thread_t *input )
{
input_thread_private_t *sys = input->p;
bool ret;
vlc_mutex_lock( &sys->lock_control );
ret = sys->is_stopped;
vlc_mutex_unlock( &sys->lock_control );
return ret;
}
/*****************************************************************************
* Main loop: Fill buffers from access, and demux
*****************************************************************************/
......@@ -698,7 +709,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
bool b_pause_after_eof = b_interactive &&
var_InheritBool( p_input, "play-and-pause" );
while( vlc_object_alive( p_input ) && p_input->p->i_state != ERROR_S )
while( !input_Stopped( p_input ) && p_input->p->i_state != ERROR_S )
{
mtime_t i_wakeup = -1;
bool b_paused = p_input->p->i_state == PAUSE_S;
......@@ -2247,14 +2258,11 @@ static int InputSourceInit( input_thread_t *p_input,
psz_access, psz_demux, psz_path );
if( p_access == NULL )
{
if( vlc_object_alive( p_input ) )
{
msg_Err( p_input, "open of `%s' failed", psz_mrl );
if( !b_in_can_fail )
dialog_Fatal( p_input, _("Your input can't be opened"),
_("VLC is unable to open the MRL '%s'."
" Check the log for details."), psz_mrl );
}
msg_Err( p_input, "open of `%s' failed", psz_mrl );
if( !b_in_can_fail && !input_Stopped( p_input ) )
dialog_Fatal( p_input, _("Your input can't be opened"),
_("VLC is unable to open the MRL '%s'."
" Check the log for details."), psz_mrl );
goto error;
}
......@@ -2358,16 +2366,14 @@ static int InputSourceInit( input_thread_t *p_input,
if( in->p_demux == NULL )
{
if( vlc_object_alive( p_input ) )
{
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
if( !b_in_can_fail )
dialog_Fatal( VLC_OBJECT( p_input ),
_("VLC can't recognize the input's format"),
_("The format of '%s' cannot be detected. "
"Have a look at the log for details."), psz_mrl );
}
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
if( !b_in_can_fail && !input_Stopped( p_input ) )
dialog_Fatal( VLC_OBJECT( p_input ),
_("VLC can't recognize the input's format"),
_("The format of '%s' cannot be detected. "
"Have a look at the log for details."),
psz_mrl );
stream_Delete( p_stream );
goto error;
}
......
......@@ -219,6 +219,8 @@ enum input_control_e
*/
void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
bool input_Stopped( input_thread_t * );
/* Bound pts_delay */
#define INPUT_PTS_DELAY_MAX INT64_C(60000000)
......
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