Commit 1e5b4699 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: trigger callbacks also when reinitializing (fixes #6181)

The values and choices of video output variables are still all there.
But we need to resend the control request to video output thread
so that they apply to the new video output display.
parent 4ca46b85
...@@ -221,6 +221,7 @@ vout_thread_t *(vout_Request)(vlc_object_t *object, ...@@ -221,6 +221,7 @@ vout_thread_t *(vout_Request)(vlc_object_t *object,
if (!vout->p->dead) { if (!vout->p->dead) {
msg_Dbg(object, "reusing provided vout"); msg_Dbg(object, "reusing provided vout");
vout_IntfReinit(vout);
return vout; return vout;
} }
vout_CloseAndRelease(vout); vout_CloseAndRelease(vout);
......
...@@ -154,6 +154,7 @@ void vout_ControlChangeSubMargin(vout_thread_t *, int); ...@@ -154,6 +154,7 @@ void vout_ControlChangeSubMargin(vout_thread_t *, int);
/* */ /* */
void vout_IntfInit( vout_thread_t * ); void vout_IntfInit( vout_thread_t * );
void vout_IntfReinit( vout_thread_t * );
/* */ /* */
int vout_OpenWrapper (vout_thread_t *, const char *, const vout_display_state_t *); int vout_OpenWrapper (vout_thread_t *, const char *, const vout_display_state_t *);
......
...@@ -197,7 +197,6 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -197,7 +197,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
} }
var_AddCallback( p_vout, "zoom", ZoomCallback, NULL ); var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
var_TriggerCallback( p_vout, "zoom" );
/* Crop offset vars */ /* Crop offset vars */
var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
...@@ -236,10 +235,6 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -236,10 +235,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
} }
var_AddCallback( p_vout, "crop", CropCallback, NULL ); var_AddCallback( p_vout, "crop", CropCallback, NULL );
var_Get( p_vout, "crop", &old_val );
if( old_val.psz_string && *old_val.psz_string )
var_TriggerCallback( p_vout, "crop" );
free( old_val.psz_string );
/* Monitor pixel aspect-ratio */ /* Monitor pixel aspect-ratio */
var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
...@@ -270,10 +265,6 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -270,10 +265,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
} }
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL ); var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
var_Get( p_vout, "aspect-ratio", &old_val );
if( (old_val.psz_string && *old_val.psz_string) )
var_TriggerCallback( p_vout, "aspect-ratio" );
free( old_val.psz_string );
/* Add a variable to indicate if the window should be on top of others */ /* Add a variable to indicate if the window should be on top of others */
var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
...@@ -281,7 +272,6 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -281,7 +272,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
text.psz_string = _("Always on top"); text.psz_string = _("Always on top");
var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL ); var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL ); var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL );
var_TriggerCallback( p_vout, "video-on-top" );
/* Add a variable to indicate whether we want window decoration or not */ /* Add a variable to indicate whether we want window decoration or not */
var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
...@@ -303,31 +293,43 @@ void vout_IntfInit( vout_thread_t *p_vout ) ...@@ -303,31 +293,43 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Create( p_vout, "video-filter", var_Create( p_vout, "video-filter",
VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL ); var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL );
var_TriggerCallback( p_vout, "video-filter" );
/* Add a sub-source variable */ /* Add a sub-source variable */
var_Create( p_vout, "sub-source", var_Create( p_vout, "sub-source",
VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
var_AddCallback( p_vout, "sub-source", SubSourceCallback, NULL ); var_AddCallback( p_vout, "sub-source", SubSourceCallback, NULL );
var_TriggerCallback( p_vout, "sub-source" );
/* Add a sub-filter variable */ /* Add a sub-filter variable */
var_Create( p_vout, "sub-filter", var_Create( p_vout, "sub-filter",
VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL ); var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL );
var_TriggerCallback( p_vout, "sub-filter" );
/* Add sub-margin variable */ /* Add sub-margin variable */
var_Create( p_vout, "sub-margin", var_Create( p_vout, "sub-margin",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL ); var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
var_TriggerCallback( p_vout, "sub-margin" );
/* Mouse coordinates */ /* Mouse coordinates */
var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS ); var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
var_Create( p_vout, "mouse-clicked", VLC_VAR_COORDS ); var_Create( p_vout, "mouse-clicked", VLC_VAR_COORDS );
var_Create( p_vout, "mouse-object", VLC_VAR_BOOL ); var_Create( p_vout, "mouse-object", VLC_VAR_BOOL );
vout_IntfReinit( p_vout );
}
void vout_IntfReinit( vout_thread_t *p_vout )
{
var_TriggerCallback( p_vout, "zoom" );
var_TriggerCallback( p_vout, "crop" );
var_TriggerCallback( p_vout, "aspect-ratio" );
var_TriggerCallback( p_vout, "video-on-top" );
var_TriggerCallback( p_vout, "video-filter" );
var_TriggerCallback( p_vout, "sub-source" );
var_TriggerCallback( p_vout, "sub-filter" );
var_TriggerCallback( p_vout, "sub-margin" );
} }
/***************************************************************************** /*****************************************************************************
......
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