Commit 1cdb7f8b authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

control/media_instance.c: Remove access to p_input_thread->p_internals. (which...

control/media_instance.c: Remove access to p_input_thread->p_internals. (which was a broken hack by the way).
parent f516f420
...@@ -172,6 +172,8 @@ struct libvlc_media_instance_t ...@@ -172,6 +172,8 @@ struct libvlc_media_instance_t
libvlc_media_descriptor_t * p_md; /* current media descriptor */ libvlc_media_descriptor_t * p_md; /* current media descriptor */
libvlc_event_manager_t * p_event_manager; libvlc_event_manager_t * p_event_manager;
libvlc_drawable_t drawable; libvlc_drawable_t drawable;
vlc_bool_t b_own_its_input_thread;
}; };
struct libvlc_media_list_player_t struct libvlc_media_list_player_t
......
...@@ -52,13 +52,11 @@ static void release_input_thread( libvlc_media_instance_t *p_mi ) ...@@ -52,13 +52,11 @@ static void release_input_thread( libvlc_media_instance_t *p_mi )
/* release for previous vlc_object_get */ /* release for previous vlc_object_get */
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
should_destroy = p_input_thread->p_internals->i_refcount == 1;
/* release for initial p_input_thread yield (see _new()) */ /* release for initial p_input_thread yield (see _new()) */
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
/* No one is tracking this input_thread appart us. Destroy it */ /* No one is tracking this input_thread appart us. Destroy it */
if( should_destroy ) if( p_mi->b_own_its_input_thread )
{ {
/* We owned this one */ /* We owned this one */
input_StopThread( p_input_thread ); input_StopThread( p_input_thread );
...@@ -69,7 +67,7 @@ static void release_input_thread( libvlc_media_instance_t *p_mi ) ...@@ -69,7 +67,7 @@ static void release_input_thread( libvlc_media_instance_t *p_mi )
{ {
/* XXX: hack the playlist doesn't retain the input thread, /* XXX: hack the playlist doesn't retain the input thread,
* so we did it for the playlist (see _new_from_input_thread), * so we did it for the playlist (see _new_from_input_thread),
* revert that here. */ * revert that here. This will be deleted with the playlist API */
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
} }
} }
...@@ -199,6 +197,7 @@ libvlc_media_instance_new( libvlc_instance_t * p_libvlc_instance, ...@@ -199,6 +197,7 @@ libvlc_media_instance_new( libvlc_instance_t * p_libvlc_instance,
* operation the refcount is 0, the object is destroyed. * operation the refcount is 0, the object is destroyed.
* - Accessor _retain increase the refcount by 1 (XXX: to implement) */ * - Accessor _retain increase the refcount by 1 (XXX: to implement) */
p_mi->i_refcount = 1; p_mi->i_refcount = 1;
p_mi->b_own_its_input_thread = VLC_TRUE;
/* object_lock strategy: /* object_lock strategy:
* - No lock held in constructor * - No lock held in constructor
* - Lock when accessing all variable this lock is held * - Lock when accessing all variable this lock is held
...@@ -271,6 +270,7 @@ libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread( ...@@ -271,6 +270,7 @@ libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
} }
p_mi->i_input_id = p_input->i_object_id; p_mi->i_input_id = p_input->i_object_id;
p_mi->b_own_its_input_thread = VLC_FALSE;
/* will be released in media_instance_release() */ /* will be released in media_instance_release() */
vlc_object_yield( p_input ); vlc_object_yield( p_input );
......
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