* src/video_output/*: fixed race condition in spu initialization which affected DVD...
authorGildas Bazin <gbazin@videolan.org>
Wed, 8 Sep 2004 21:01:11 +0000 (21:01 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 8 Sep 2004 21:01:11 +0000 (21:01 +0000)
include/video_output.h
src/video_output/video_output.c
src/video_output/vout_subpictures.c

index b3b8712..8f1e2cb 100644 (file)
@@ -278,7 +278,7 @@ VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * )
 
 void           vout_InitSPU( vout_thread_t * );
 void           vout_DestroySPU( vout_thread_t * );
-void           vout_AttachSPU( vout_thread_t *, vlc_bool_t );
+void           vout_AttachSPU( vout_thread_t *, vlc_object_t *, vlc_bool_t );
 subpicture_t * vout_SortSubPictures  ( vout_thread_t *, mtime_t );
 void           vout_RenderSubPictures( vout_thread_t *, picture_t *,
                                        picture_t *, subpicture_t * );
index 92860be..7b50235 100644 (file)
@@ -99,7 +99,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
 
             if( p_playlist )
             {
-                vout_AttachSPU( p_vout, VLC_FALSE );
+                vout_AttachSPU( p_vout, p_this, VLC_FALSE );
                 vlc_object_detach( p_vout );
                 vlc_object_attach( p_vout, p_playlist );
 
@@ -194,8 +194,8 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
         {
             /* This video output is cool! Hijack it. */
             vlc_object_detach( p_vout );
+            vout_AttachSPU( p_vout, p_this, VLC_TRUE );
             vlc_object_attach( p_vout, p_this );
-            vout_AttachSPU( p_vout, VLC_TRUE );
             vlc_object_release( p_vout );
         }
     }
@@ -304,6 +304,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
     var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL );
     var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER );
 
+    /* Initialize subpicture unit */
+    vout_InitSPU( p_vout );
+    vout_AttachSPU( p_vout, p_parent, VLC_TRUE );
+
     /* Attach the new object now so we can use var inheritance below */
     vlc_object_attach( p_vout, p_parent );
 
@@ -408,9 +412,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
         return NULL;
     }
 
-    /* Initialize subpicture unit */
-    vout_InitSPU( p_vout );
-
     /* Create a few object variables for interface interaction */
     var_Create( p_vout, "deinterlace", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
     text.psz_string = _("Deinterlace");
index 89e0afe..f9581e8 100644 (file)
@@ -67,8 +67,6 @@ void vout_InitSPU( vout_thread_t *p_vout )
         p_vout->i_crop_width = p_vout->i_crop_height = 0;
     p_vout->b_force_alpha = VLC_FALSE;
     p_vout->b_force_crop = VLC_FALSE;
-
-    vout_AttachSPU( p_vout, VLC_TRUE );
 }
 
 /**
@@ -108,7 +106,7 @@ void vout_DestroySPU( vout_thread_t *p_vout )
         vlc_object_destroy( p_vout->p_text );
     }
 
-    vout_AttachSPU( p_vout, VLC_FALSE );
+    vout_AttachSPU( p_vout, VLC_OBJECT(p_vout), VLC_FALSE );
 }
 
 /**
@@ -117,11 +115,12 @@ void vout_DestroySPU( vout_thread_t *p_vout )
  * \param p_vout the vout in which to destroy the subpicture unit
  * \param b_attach to select attach or detach
  */
-void vout_AttachSPU( vout_thread_t *p_vout, vlc_bool_t b_attach )
+void vout_AttachSPU( vout_thread_t *p_vout, vlc_object_t *p_this,
+                     vlc_bool_t b_attach )
 {
     vlc_object_t *p_input;
 
-    p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
+    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
     if( !p_input ) return;
 
     if( b_attach )