Commit 4b9c63a3 authored by Laurent Aimar's avatar Laurent Aimar

Gives the input_thread_t to use to vout_Request().

This removes a dangerous vlc_object_find(PARENT) and potentially
invalids var_DelCallback().
It also avoids useless callback destructions and so fixes some dvd menus.
parent 37a27cc6
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
*/ */
typedef struct { typedef struct {
vout_thread_t *vout; vout_thread_t *vout;
vlc_object_t *input;
const video_format_t *fmt; const video_format_t *fmt;
} vout_configuration_t; } vout_configuration_t;
......
...@@ -816,8 +816,9 @@ static vout_thread_t *RequestVout( void *p_private, ...@@ -816,8 +816,9 @@ static vout_thread_t *RequestVout( void *p_private,
aout_instance_t *p_aout = p_private; aout_instance_t *p_aout = p_private;
VLC_UNUSED(b_recycle); VLC_UNUSED(b_recycle);
vout_configuration_t cfg = { vout_configuration_t cfg = {
.vout = p_vout, .vout = p_vout,
.fmt = p_fmt, .input = NULL,
.fmt = p_fmt,
}; };
return vout_Request( p_aout, &cfg ); return vout_Request( p_aout, &cfg );
} }
......
...@@ -243,8 +243,9 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource, ...@@ -243,8 +243,9 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
/* */ /* */
vout_configuration_t cfg = { vout_configuration_t cfg = {
.vout = p_vout, .vout = p_vout,
.fmt = p_fmt, .input = VLC_OBJECT(p_resource->p_input),
.fmt = p_fmt,
}; };
p_vout = vout_Request( p_resource->p_input, &cfg ); p_vout = vout_Request( p_resource->p_input, &cfg );
if( !p_vout ) if( !p_vout )
...@@ -279,7 +280,12 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource, ...@@ -279,7 +280,12 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
vout_Flush( p_vout, 1 ); vout_Flush( p_vout, 1 );
vout_FlushSubpictureChannel( 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; return NULL;
} }
......
...@@ -157,7 +157,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, ...@@ -157,7 +157,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
vlc_object_release(vout); vlc_object_release(vout);
return NULL; return NULL;
} }
spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), true);
vout_control_WaitEmpty(&vout->p->control); vout_control_WaitEmpty(&vout->p->control);
...@@ -167,6 +166,10 @@ static vout_thread_t *VoutCreate(vlc_object_t *object, ...@@ -167,6 +166,10 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
return NULL; return NULL;
} }
vout->p->input = cfg->input;
if (vout->p->input)
spu_Attach(vout->p->p_spu, vout->p->input, true);
return vout; return vout;
} }
...@@ -182,10 +185,16 @@ vout_thread_t *(vout_Request)(vlc_object_t *object, ...@@ -182,10 +185,16 @@ vout_thread_t *(vout_Request)(vlc_object_t *object,
/* If a vout is provided, try reusing it */ /* If a vout is provided, try reusing it */
if (vout) { if (vout) {
spu_Attach(vout->p->p_spu, VLC_OBJECT(vout), false);
vlc_object_detach(vout); vlc_object_detach(vout);
vlc_object_attach(vout, object); 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_t cmd;
vout_control_cmd_Init(&cmd, VOUT_CONTROL_REINIT); vout_control_cmd_Init(&cmd, VOUT_CONTROL_REINIT);
...@@ -216,7 +225,8 @@ void vout_Close(vout_thread_t *vout) ...@@ -216,7 +225,8 @@ void vout_Close(vout_thread_t *vout)
{ {
assert(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); vlc_object_detach(vout->p->p_spu);
vout_snapshot_End(&vout->p->snapshot); vout_snapshot_End(&vout->p->snapshot);
......
...@@ -46,8 +46,11 @@ struct vout_thread_sys_t ...@@ -46,8 +46,11 @@ struct vout_thread_sys_t
/* Splitter module if used */ /* Splitter module if used */
char *splitter_name; 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 */ /* Snapshot interface */
vout_snapshot_t snapshot; vout_snapshot_t snapshot;
...@@ -153,7 +156,7 @@ void vout_DisplayWrapper(vout_thread_t *, picture_t *); ...@@ -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 *); 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 #endif
...@@ -274,14 +274,8 @@ void spu_Destroy( spu_t *p_spu ) ...@@ -274,14 +274,8 @@ void spu_Destroy( spu_t *p_spu )
* \param p_this the object in which to destroy the subpicture unit * \param p_this the object in which to destroy the subpicture unit
* \param b_attach to select attach or detach * \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 ) if( b_attach )
{ {
UpdateSPU( p_spu, VLC_OBJECT(p_input) ); 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 ) ...@@ -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 ); vlc_mutex_lock( &p_spu->p->lock );
p_spu->p->i_margin = var_GetInteger( p_input, "sub-margin" ); p_spu->p->i_margin = var_GetInteger( p_input, "sub-margin" );
vlc_mutex_unlock( &p_spu->p->lock ); vlc_mutex_unlock( &p_spu->p->lock );
vlc_object_release( p_input );
} }
else else
{ {
...@@ -301,7 +293,6 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach ) ...@@ -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, "sub-margin", MarginCallback, p_spu->p );
var_DelCallback( p_input, "highlight", CropCallback, p_spu ); var_DelCallback( p_input, "highlight", CropCallback, p_spu );
var_Destroy( p_input, "highlight" ); var_Destroy( p_input, "highlight" );
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