Commit 92960f7e authored by Gildas Bazin's avatar Gildas Bazin

* src/input/input.c, src/video_output/video_output.c: when the input thread
   ends, it will also destroy the vout if one was spawned.
parent 8bc47474
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.226 2003/03/24 17:15:30 gbazin Exp $ * $Id: input.c,v 1.227 2003/03/25 17:07:45 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -552,6 +552,8 @@ static void ErrorThread( input_thread_t *p_input ) ...@@ -552,6 +552,8 @@ static void ErrorThread( input_thread_t *p_input )
*****************************************************************************/ *****************************************************************************/
static void EndThread( input_thread_t * p_input ) static void EndThread( input_thread_t * p_input )
{ {
vlc_object_t *p_object;
#ifdef HAVE_SYS_TIMES_H #ifdef HAVE_SYS_TIMES_H
/* Display statistics */ /* Display statistics */
struct tms cpu_usage; struct tms cpu_usage;
...@@ -586,6 +588,16 @@ static void EndThread( input_thread_t * p_input ) ...@@ -586,6 +588,16 @@ static void EndThread( input_thread_t * p_input )
input_AccessEnd( p_input ); input_AccessEnd( p_input );
/* Close the video output that should have been re-attached
* to our object */
p_object = vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_object )
{
vlc_object_detach( p_object );
vlc_object_release( p_object );
vout_Destroy( p_object );
}
free( p_input->psz_source ); free( p_input->psz_source );
if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource ); if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource );
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.215 2003/03/25 00:43:26 gbazin Exp $ * $Id: video_output.c,v 1.216 2003/03/25 17:07:45 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -69,15 +69,18 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -69,15 +69,18 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
{ {
if( !i_width || !i_height || !i_chroma ) if( !i_width || !i_height || !i_chroma )
{ {
/* Reattach video output to p_vlc before bailing out */ /* Reattach video output to input before bailing out */
if( p_vout ) if( p_vout )
{ {
vlc_object_t *p_input;
char *psz_sout = config_GetPsz( p_this, "sout" ); char *psz_sout = config_GetPsz( p_this, "sout" );
if( !psz_sout || !*psz_sout ) p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input && (!psz_sout || !*psz_sout) )
{ {
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_this->p_vlc ); vlc_object_attach( p_vout, p_input );
} }
else else
{ {
...@@ -86,6 +89,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -86,6 +89,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
vout_Destroy( p_vout ); vout_Destroy( p_vout );
} }
if( psz_sout ) free( psz_sout ); if( psz_sout ) free( psz_sout );
if( p_input ) vlc_object_release( p_input );
} }
return NULL; return NULL;
...@@ -102,7 +106,15 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -102,7 +106,15 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
if( !p_vout ) if( !p_vout )
{ {
p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT, FIND_ANYWHERE ); vlc_object_t *p_input;
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input )
{
p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT,
FIND_CHILD );
vlc_object_release( 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