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 @@
*/
typedef struct {
vout_thread_t *vout;
vlc_object_t *input;
const video_format_t *fmt;
} vout_configuration_t;
......
......@@ -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 );
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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
......@@ -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 );
}
}
......
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