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

input: remove useless parameter to input_Stop()

parent bdcdf970
...@@ -494,7 +494,7 @@ VLC_API input_thread_t * input_CreateAndStart( vlc_object_t *p_parent, input_ite ...@@ -494,7 +494,7 @@ VLC_API input_thread_t * input_CreateAndStart( vlc_object_t *p_parent, input_ite
VLC_API int input_Start( input_thread_t * ); VLC_API int input_Start( input_thread_t * );
VLC_API void input_Stop( input_thread_t *, bool b_abort ); VLC_API void input_Stop( input_thread_t * );
VLC_API int input_Read( vlc_object_t *, input_item_t * ); VLC_API int input_Read( vlc_object_t *, input_item_t * );
#define input_Read(a,b) input_Read(VLC_OBJECT(a),b) #define input_Read(a,b) input_Read(VLC_OBJECT(a),b)
......
...@@ -124,7 +124,7 @@ static inline void unlock_input(libvlc_media_player_t *mp) ...@@ -124,7 +124,7 @@ static inline void unlock_input(libvlc_media_player_t *mp)
* Object lock is NOT held. * Object lock is NOT held.
* Input lock is held or instance is being destroyed. * Input lock is held or instance is being destroyed.
*/ */
static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abort ) static void release_input_thread( libvlc_media_player_t *p_mi )
{ {
assert( p_mi ); assert( p_mi );
...@@ -144,7 +144,7 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor ...@@ -144,7 +144,7 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
del_es_callbacks( p_input_thread, p_mi ); del_es_callbacks( p_input_thread, p_mi );
/* We owned this one */ /* We owned this one */
input_Stop( p_input_thread, b_input_abort ); input_Stop( p_input_thread );
input_Close( p_input_thread ); input_Close( p_input_thread );
} }
...@@ -685,7 +685,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi ) ...@@ -685,7 +685,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
/* No need for lock_input() because no other threads knows us anymore */ /* No need for lock_input() because no other threads knows us anymore */
if( p_mi->input.p_thread ) if( p_mi->input.p_thread )
release_input_thread(p_mi, true); release_input_thread(p_mi);
input_resource_Terminate( p_mi->input.p_resource ); input_resource_Terminate( p_mi->input.p_resource );
input_resource_Release( p_mi->input.p_resource ); input_resource_Release( p_mi->input.p_resource );
vlc_mutex_destroy( &p_mi->input.lock ); vlc_mutex_destroy( &p_mi->input.lock );
...@@ -742,12 +742,7 @@ void libvlc_media_player_set_media( ...@@ -742,12 +742,7 @@ void libvlc_media_player_set_media(
{ {
lock_input(p_mi); lock_input(p_mi);
/* FIXME I am not sure if it is a user request or on die(eof/error) release_input_thread( p_mi );
* request here */
release_input_thread( p_mi,
p_mi->input.p_thread &&
!p_mi->input.p_thread->b_eof &&
!p_mi->input.p_thread->b_error );
lock( p_mi ); lock( p_mi );
set_state( p_mi, libvlc_NothingSpecial, true ); set_state( p_mi, libvlc_NothingSpecial, true );
...@@ -899,7 +894,7 @@ void libvlc_media_player_set_pause( libvlc_media_player_t *p_mi, int paused ) ...@@ -899,7 +894,7 @@ void libvlc_media_player_set_pause( libvlc_media_player_t *p_mi, int paused )
if( libvlc_media_player_can_pause( p_mi ) ) if( libvlc_media_player_can_pause( p_mi ) )
input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S ); input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
else else
input_Stop( p_input_thread, true ); input_Stop( p_input_thread );
} }
} }
else else
...@@ -941,7 +936,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi ) ...@@ -941,7 +936,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi )
libvlc_state_t state = libvlc_media_player_get_state( p_mi ); libvlc_state_t state = libvlc_media_player_get_state( p_mi );
lock_input(p_mi); lock_input(p_mi);
release_input_thread( p_mi, true ); /* This will stop the input thread */ release_input_thread( p_mi ); /* This will stop the input thread */
/* Force to go to stopped state, in case we were in Ended, or Error /* Force to go to stopped state, in case we were in Ended, or Error
* state. */ * state. */
......
...@@ -143,7 +143,7 @@ static void cancelDoFingerprint( void *p_arg ) ...@@ -143,7 +143,7 @@ static void cancelDoFingerprint( void *p_arg )
fingerprinter_sys_t *p_sys = ( fingerprinter_sys_t * ) p_arg; fingerprinter_sys_t *p_sys = ( fingerprinter_sys_t * ) p_arg;
if ( p_sys->p_input ) if ( p_sys->p_input )
{ {
input_Stop( p_sys->p_input, true ); input_Stop( p_sys->p_input );
input_Close( p_sys->p_input ); input_Close( p_sys->p_input );
} }
/* cleanup temporary result */ /* cleanup temporary result */
...@@ -217,7 +217,7 @@ static void DoFingerprint( vlc_object_t *p_this, fingerprinter_sys_t *p_sys, aco ...@@ -217,7 +217,7 @@ static void DoFingerprint( vlc_object_t *p_this, fingerprinter_sys_t *p_sys, aco
} }
var_DelCallback( p_sys->p_input, "intf-event", inputStateCallback, p_sys ); var_DelCallback( p_sys->p_input, "intf-event", inputStateCallback, p_sys );
} }
input_Stop( p_sys->p_input, true ); input_Stop( p_sys->p_input );
input_Close( p_sys->p_input ); input_Close( p_sys->p_input );
p_sys->p_input = NULL; p_sys->p_input = NULL;
......
...@@ -186,7 +186,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -186,7 +186,7 @@ static void Close( vlc_object_t *p_this )
if( !p_input ) if( !p_input )
continue; continue;
input_Stop( p_input, true ); input_Stop( p_input );
input_Close( p_input ); input_Close( p_input );
p_sd->p_sys->pp_input[i] = NULL; p_sd->p_sys->pp_input[i] = NULL;
...@@ -237,7 +237,7 @@ static void *Run( void *data ) ...@@ -237,7 +237,7 @@ static void *Run( void *data )
if( p_input->b_eof || p_input->b_error ) if( p_input->b_eof || p_input->b_error )
{ {
input_Stop( p_input, false ); input_Stop( p_input );
input_Close( p_input ); input_Close( p_input );
p_sd->p_sys->pp_input[i] = NULL; p_sd->p_sys->pp_input[i] = NULL;
......
...@@ -235,24 +235,14 @@ int input_Start( input_thread_t *p_input ) ...@@ -235,24 +235,14 @@ int input_Start( input_thread_t *p_input )
/** /**
* Request a running input thread to stop and die * Request a running input thread to stop and die
* *
* b_abort must be true when a user stop is requested and not because you have
* detected an error or an eof. It will be used to properly send the
* INPUT_EVENT_ABORT event.
*
* \param p_input the input thread to stop * \param p_input the input thread to stop
* \param b_abort true if the input has been aborted by a user request
*/ */
void input_Stop( input_thread_t *p_input, bool b_abort ) void input_Stop( input_thread_t *p_input )
{ {
/* Set die for input and ALL of this childrens (even (grand-)grand-childrens) /* Set die for input and ALL of this childrens (even (grand-)grand-childrens)
* It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to * It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to
* unlock the control loop */ * unlock the control loop */
ObjectKillChildrens( VLC_OBJECT(p_input) ); ObjectKillChildrens( VLC_OBJECT(p_input) );
vlc_mutex_lock( &p_input->p->lock_control );
p_input->p->b_abort |= b_abort;
vlc_mutex_unlock( &p_input->p->lock_control );
input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL ); input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL );
} }
...@@ -397,7 +387,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -397,7 +387,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
vlc_mutex_init( &p_input->p->lock_control ); vlc_mutex_init( &p_input->p->lock_control );
vlc_cond_init( &p_input->p->wait_control ); vlc_cond_init( &p_input->p->wait_control );
p_input->p->i_control = 0; p_input->p->i_control = 0;
p_input->p->b_abort = false;
p_input->p->is_running = false; p_input->p->is_running = false;
/* Create Object Variables for private use only */ /* Create Object Variables for private use only */
......
...@@ -161,7 +161,6 @@ struct input_thread_private_t ...@@ -161,7 +161,6 @@ struct input_thread_private_t
int i_control; int i_control;
input_control_t control[INPUT_CONTROL_FIFO_SIZE]; input_control_t control[INPUT_CONTROL_FIFO_SIZE];
bool b_abort;
bool is_running; bool is_running;
vlc_thread_t thread; vlc_thread_t thread;
}; };
......
...@@ -662,7 +662,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media ) ...@@ -662,7 +662,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
var_DelCallback( p_input, "intf-event", InputEventPreparse, var_DelCallback( p_input, "intf-event", InputEventPreparse,
&preparse ); &preparse );
input_Stop( p_input, true ); input_Stop( p_input );
input_Close( p_input ); input_Close( p_input );
vlc_sem_destroy( &sem_preparse ); vlc_sem_destroy( &sem_preparse );
} }
...@@ -904,7 +904,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc ...@@ -904,7 +904,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
input_thread_t *p_input = p_instance->p_input; input_thread_t *p_input = p_instance->p_input;
if( p_input ) if( p_input )
{ {
input_Stop( p_input, true ); input_Stop( p_input );
input_Join( p_input ); input_Join( p_input );
var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media ); var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
input_Release( p_input ); input_Release( p_input );
...@@ -996,7 +996,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char * ...@@ -996,7 +996,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
} }
input_Stop( p_input, true ); input_Stop( p_input );
input_Join( p_input ); input_Join( p_input );
var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media ); var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
input_Release( p_input ); input_Release( p_input );
......
...@@ -755,7 +755,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode, ...@@ -755,7 +755,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
sys->request.i_skip = 0; sys->request.i_skip = 0;
sys->request.p_item = p_item; sys->request.p_item = p_item;
if( sys->p_input != NULL ) if( sys->p_input != NULL )
input_Stop( sys->p_input, true ); input_Stop( sys->p_input );
vlc_cond_signal( &sys->signal ); vlc_cond_signal( &sys->signal );
} }
/* Preparse if no artist/album info, and hasn't been preparsed allready /* Preparse if no artist/album info, and hasn't been preparsed allready
......
...@@ -438,7 +438,7 @@ static void LoopInput( playlist_t *p_playlist ) ...@@ -438,7 +438,7 @@ static void LoopInput( playlist_t *p_playlist )
if( p_sys->request.b_request || p_sys->killed ) if( p_sys->request.b_request || p_sys->killed )
{ {
PL_DEBUG( "incoming request - stopping current input" ); PL_DEBUG( "incoming request - stopping current input" );
input_Stop( p_input, true ); input_Stop( p_input );
} }
#warning Unsynchronized access to *p_input flags... #warning Unsynchronized access to *p_input flags...
...@@ -466,7 +466,7 @@ static void LoopInput( playlist_t *p_playlist ) ...@@ -466,7 +466,7 @@ static void LoopInput( playlist_t *p_playlist )
else if( p_input->b_error || p_input->b_eof ) else if( p_input->b_error || p_input->b_eof )
{ {
PL_DEBUG( "finished input" ); PL_DEBUG( "finished input" );
input_Stop( p_input, false ); input_Stop( p_input );
} }
vlc_cond_wait( &p_sys->signal, &p_sys->lock ); vlc_cond_wait( &p_sys->signal, &p_sys->lock );
......
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