Commit b9c13322 authored by Gildas Bazin's avatar Gildas Bazin

* src/video_output/vout_subpictures.c, video_output.c: fixed a crash with dvd menus.

parent 1e5b412a
...@@ -278,6 +278,7 @@ VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) ...@@ -278,6 +278,7 @@ VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * )
void vout_InitSPU( vout_thread_t * ); void vout_InitSPU( vout_thread_t * );
void vout_DestroySPU( vout_thread_t * ); void vout_DestroySPU( vout_thread_t * );
void vout_AttachSPU( vout_thread_t *, vlc_bool_t );
subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t ); subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t );
void vout_RenderSubPictures( vout_thread_t *, picture_t *, void vout_RenderSubPictures( vout_thread_t *, picture_t *,
picture_t *, subpicture_t * ); picture_t *, subpicture_t * );
......
...@@ -94,11 +94,12 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -94,11 +94,12 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
{ {
vlc_object_t *p_playlist; vlc_object_t *p_playlist;
p_playlist = vlc_object_find( p_this, p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist ) if( p_playlist )
{ {
vout_AttachSPU( p_vout, VLC_FALSE );
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_playlist ); vlc_object_attach( p_vout, p_playlist );
...@@ -194,6 +195,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -194,6 +195,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
/* This video output is cool! Hijack it. */ /* This video output is cool! Hijack it. */
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_this ); vlc_object_attach( p_vout, p_this );
vout_AttachSPU( p_vout, VLC_TRUE );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
} }
...@@ -1420,4 +1422,3 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1420,4 +1422,3 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
var_Set( p_vout, "intf-change", val ); var_Set( p_vout, "intf-change", val );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -51,7 +51,6 @@ static void spu_del_buffer( filter_t *, subpicture_t * ); ...@@ -51,7 +51,6 @@ static void spu_del_buffer( filter_t *, subpicture_t * );
*/ */
void vout_InitSPU( vout_thread_t *p_vout ) void vout_InitSPU( vout_thread_t *p_vout )
{ {
vlc_object_t *p_input;
int i_index; int i_index;
for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++) for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++)
...@@ -83,14 +82,7 @@ void vout_InitSPU( vout_thread_t *p_vout ) ...@@ -83,14 +82,7 @@ void vout_InitSPU( vout_thread_t *p_vout )
p_vout->b_force_alpha = VLC_FALSE; p_vout->b_force_alpha = VLC_FALSE;
p_vout->b_force_crop = VLC_FALSE; p_vout->b_force_crop = VLC_FALSE;
/* Create callback */ vout_AttachSPU( p_vout, VLC_TRUE );
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input )
{
UpdateSPU( p_vout, VLC_OBJECT(p_input) );
var_AddCallback( p_input, "highlight", CropCallback, p_vout );
vlc_object_release( p_input );
}
} }
/** /**
...@@ -100,7 +92,6 @@ void vout_InitSPU( vout_thread_t *p_vout ) ...@@ -100,7 +92,6 @@ void vout_InitSPU( vout_thread_t *p_vout )
*/ */
void vout_DestroySPU( vout_thread_t *p_vout ) void vout_DestroySPU( vout_thread_t *p_vout )
{ {
vlc_object_t *p_input;
int i_index; int i_index;
/* Destroy all remaining subpictures */ /* Destroy all remaining subpictures */
...@@ -131,13 +122,35 @@ void vout_DestroySPU( vout_thread_t *p_vout ) ...@@ -131,13 +122,35 @@ void vout_DestroySPU( vout_thread_t *p_vout )
vlc_object_destroy( p_vout->p_blend ); vlc_object_destroy( p_vout->p_blend );
} }
/* Delete callback */ vout_AttachSPU( p_vout, VLC_FALSE );
}
/**
* Attach/Detach the SPU from any input
*
* \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 )
{
vlc_object_t *p_input;
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input ) if( !p_input ) return;
if( b_attach )
{ {
UpdateSPU( p_vout, VLC_OBJECT(p_input) );
var_AddCallback( p_input, "highlight", CropCallback, p_vout );
vlc_object_release( p_input );
}
else
{
/* Delete callback */
var_DelCallback( p_input, "highlight", CropCallback, p_vout ); var_DelCallback( p_input, "highlight", CropCallback, p_vout );
vlc_object_release( p_input ); 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