]> git.sesse.net Git - vlc/commitdiff
* src/input/input.c, src/video_output/video_output.c: when the input thread
authorGildas Bazin <gbazin@videolan.org>
Tue, 25 Mar 2003 17:07:45 +0000 (17:07 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 25 Mar 2003 17:07:45 +0000 (17:07 +0000)
   ends, it will also destroy the vout if one was spawned.

src/input/input.c
src/video_output/video_output.c

index 55cf7c01f634ac4e97e34e0924dd95831a318f1e..5be33f12d7d479c41526bc68664a22f8db0a53df 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * 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>
  *
@@ -552,6 +552,8 @@ static void ErrorThread( input_thread_t *p_input )
  *****************************************************************************/
 static void EndThread( input_thread_t * p_input )
 {
+    vlc_object_t *p_object;
+
 #ifdef HAVE_SYS_TIMES_H
     /* Display statistics */
     struct tms  cpu_usage;
@@ -586,6 +588,16 @@ static void EndThread( input_thread_t * 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 );
     if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource );
 
index 5a2fbb8cc403e98049a7056759365972f465f51f..5c15fd99b7bfcf231aeb3267df9d1c2fe6b771d6 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * 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>
  *
@@ -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 )
     {
-        /* Reattach video output to p_vlc before bailing out */
+        /* Reattach video output to input before bailing out */
         if( p_vout )
         {
+            vlc_object_t *p_input;
             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_attach( p_vout, p_this->p_vlc );
+                vlc_object_attach( p_vout, p_input );
             }
             else
             {
@@ -86,6 +89,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
                 vout_Destroy( p_vout );
             }
             if( psz_sout ) free( psz_sout );
+            if( p_input ) vlc_object_release( p_input );
         }
 
         return NULL;
@@ -102,7 +106,15 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *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 );
+            }
         }
     }