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