Commit a47715a1 authored by Laurent Aimar's avatar Laurent Aimar

Converted input to vlc_clone().

parent 998746af
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
*****************************************************************************/ *****************************************************************************/
static void Destructor( input_thread_t * p_input ); static void Destructor( input_thread_t * p_input );
static void *Run ( vlc_object_t *p_this ); static void *Run ( void * );
static input_thread_t * Create ( vlc_object_t *, input_item_t *, static input_thread_t * Create ( vlc_object_t *, input_item_t *,
const char *, bool, input_resource_t * ); const char *, bool, input_resource_t * );
...@@ -217,7 +217,9 @@ int input_Preparse( vlc_object_t *p_parent, input_item_t *p_item ) ...@@ -217,7 +217,9 @@ int input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
int input_Start( input_thread_t *p_input ) int input_Start( input_thread_t *p_input )
{ {
/* Create thread and wait for its readiness. */ /* Create thread and wait for its readiness. */
if( vlc_thread_create( p_input, Run, VLC_THREAD_PRIORITY_INPUT ) ) p_input->p->is_running = !vlc_clone( &p_input->p->thread,
Run, p_input, VLC_THREAD_PRIORITY_INPUT );
if( !p_input->p->is_running )
{ {
input_ChangeState( p_input, ERROR_S ); input_ChangeState( p_input, ERROR_S );
msg_Err( p_input, "cannot create input thread" ); msg_Err( p_input, "cannot create input thread" );
...@@ -257,7 +259,8 @@ void input_Stop( input_thread_t *p_input, bool b_abort ) ...@@ -257,7 +259,8 @@ void input_Stop( input_thread_t *p_input, bool b_abort )
*/ */
int input_Close( input_thread_t *p_input ) int input_Close( input_thread_t *p_input )
{ {
vlc_thread_join( p_input ); if( p_input->p->is_running )
vlc_join( p_input->p->thread, NULL );
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
...@@ -417,6 +420,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -417,6 +420,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
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->b_abort = false;
p_input->p->is_running = false;
/* Create Object Variables for private use only */ /* Create Object Variables for private use only */
input_ConfigVarInit( p_input ); input_ConfigVarInit( p_input );
...@@ -542,9 +546,9 @@ static void Destructor( input_thread_t * p_input ) ...@@ -542,9 +546,9 @@ static void Destructor( input_thread_t * p_input )
* This is the "normal" thread that spawns the input processing chain, * This is the "normal" thread that spawns the input processing chain,
* reads the stream, cleans up and waits * reads the stream, cleans up and waits
*****************************************************************************/ *****************************************************************************/
static void *Run( vlc_object_t *p_this ) static void *Run( void *obj )
{ {
input_thread_t *p_input = (input_thread_t *)p_this; input_thread_t *p_input = (input_thread_t *)obj;
const int canc = vlc_savecancel(); const int canc = vlc_savecancel();
if( Init( p_input ) ) if( Init( p_input ) )
......
...@@ -164,6 +164,8 @@ struct input_thread_private_t ...@@ -164,6 +164,8 @@ struct input_thread_private_t
input_control_t control[INPUT_CONTROL_FIFO_SIZE]; input_control_t control[INPUT_CONTROL_FIFO_SIZE];
bool b_abort; bool b_abort;
bool is_running;
vlc_thread_t thread;
}; };
/*************************************************************************** /***************************************************************************
......
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