diff --git a/include/vlc_vout.h b/include/vlc_vout.h index aa144d509a..f42d319481 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -52,6 +52,7 @@ */ typedef struct { vout_thread_t *vout; + vlc_object_t *input; const video_format_t *fmt; } vout_configuration_t; diff --git a/src/audio_output/input.c b/src/audio_output/input.c index 2f4d216848..85d439bbcb 100644 --- a/src/audio_output/input.c +++ b/src/audio_output/input.c @@ -816,8 +816,9 @@ static vout_thread_t *RequestVout( void *p_private, aout_instance_t *p_aout = p_private; VLC_UNUSED(b_recycle); vout_configuration_t cfg = { - .vout = p_vout, - .fmt = p_fmt, + .vout = p_vout, + .input = NULL, + .fmt = p_fmt, }; return vout_Request( p_aout, &cfg ); } diff --git a/src/input/resource.c b/src/input/resource.c index f4ae531fb1..b015be8fba 100644 --- a/src/input/resource.c +++ b/src/input/resource.c @@ -243,8 +243,9 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource, /* */ vout_configuration_t cfg = { - .vout = p_vout, - .fmt = p_fmt, + .vout = p_vout, + .input = VLC_OBJECT(p_resource->p_input), + .fmt = p_fmt, }; p_vout = vout_Request( p_resource->p_input, &cfg ); if( !p_vout ) @@ -279,7 +280,12 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource, vout_Flush( p_vout, 1 ); vout_FlushSubpictureChannel( p_vout, -1 ); - p_resource->p_vout_free = p_vout; + vout_configuration_t cfg = { + .vout = p_vout, + .input = NULL, + .fmt = p_fmt, + }; + p_resource->p_vout_free = vout_Request( p_resource->p_input, &cfg ); } return NULL; } diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index cb17af39d4..d827b41db8 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -157,7 +157,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, vlc_object_release(vout); return NULL; } - spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), true); vout_control_WaitEmpty(&vout->p->control); @@ -167,6 +166,10 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, return NULL; } + vout->p->input = cfg->input; + if (vout->p->input) + spu_Attach(vout->p->p_spu, vout->p->input, true); + return vout; } @@ -182,10 +185,16 @@ vout_thread_t *(vout_Request)(vlc_object_t *object, /* If a vout is provided, try reusing it */ if (vout) { - spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), false); vlc_object_detach(vout); vlc_object_attach(vout, object); - spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), true); + + if (vout->p->input != cfg->input) { + if (vout->p->input) + spu_Attach(vout->p->p_spu, vout->p->input, false); + vout->p->input = cfg->input; + if (vout->p->input) + spu_Attach(vout->p->p_spu, vout->p->input, true); + } vout_control_cmd_t cmd; vout_control_cmd_Init(&cmd, VOUT_CONTROL_REINIT); @@ -216,7 +225,8 @@ void vout_Close(vout_thread_t *vout) { assert(vout); - spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), false); + if (vout->p->input) + spu_Attach(vout->p->p_spu, vout->p->input, false); vlc_object_detach(vout->p->p_spu); vout_snapshot_End(&vout->p->snapshot); diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h index c5e6d965f6..0caa915666 100644 --- a/src/video_output/vout_internal.h +++ b/src/video_output/vout_internal.h @@ -46,8 +46,11 @@ struct vout_thread_sys_t /* Splitter module if used */ char *splitter_name; + /* Input thread for dvd menu interactions */ + vlc_object_t *input; + /* */ - video_format_t original; /* Original format ie coming from the decoder */ + video_format_t original; /* Original format ie coming from the decoder */ /* Snapshot interface */ vout_snapshot_t snapshot; @@ -153,7 +156,7 @@ void vout_DisplayWrapper(vout_thread_t *, picture_t *); /* */ int spu_ProcessMouse(spu_t *, const vlc_mouse_t *, const video_format_t *); -void spu_Attach( spu_t *, vlc_object_t *, bool ); +void spu_Attach( spu_t *, vlc_object_t *input, bool ); #endif diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index ee608b907e..123d4da3e1 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -274,14 +274,8 @@ void spu_Destroy( spu_t *p_spu ) * \param p_this the object in which to destroy the subpicture unit * \param b_attach to select attach or detach */ -void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach ) +void spu_Attach( spu_t *p_spu, vlc_object_t *p_input, bool b_attach ) { - vlc_object_t *p_input; - - p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT ); - if( !p_input ) - return; - if( b_attach ) { UpdateSPU( p_spu, VLC_OBJECT(p_input) ); @@ -292,8 +286,6 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach ) vlc_mutex_lock( &p_spu->p->lock ); p_spu->p->i_margin = var_GetInteger( p_input, "sub-margin" ); vlc_mutex_unlock( &p_spu->p->lock ); - - vlc_object_release( p_input ); } else { @@ -301,7 +293,6 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach ) var_DelCallback( p_input, "sub-margin", MarginCallback, p_spu->p ); var_DelCallback( p_input, "highlight", CropCallback, p_spu ); var_Destroy( p_input, "highlight" ); - vlc_object_release( p_input ); } }