[vlc-devel] commit: "fullscreen" callback: do nothing if value is unchanged ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Feb 10 18:56:30 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 10 18:03:47 2010 +0200| [49334e07d05bb5e4770a95b8b4f57d84c192cdc9] | committer: Rémi Denis-Courmont
"fullscreen" callback: do nothing if value is unchanged
The old video output core assumes that the fullscreen state must be
toggled if the VOUT_FULLSCREEN_CHANGE bit is set. So we need to check
that the target state is not already correct, as the VLC variables core
does NOT do it internally. This commit provides rare exception to the
rule that oldval is useless.
This fixes a whole class of race conditions where two threads try to
change fullscreen status at the same time.
In the video filter case, we now enable fullscreen on all childrens, not
just one. This seems a bit more logical for wall. Without this, toggling
fullscreen would only ever work on the first video output. With this,
things should work great if the different pieces of the wall are on
different video ports, and OK (Alt+Tab is your friend) otherwise.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=49334e07d05bb5e4770a95b8b4f57d84c192cdc9
---
modules/control/hotkeys.c | 2 +-
modules/video_filter/filter_common.h | 17 ++---------------
modules/video_filter/wrapper.c | 19 ++++---------------
src/video_output/event.h | 3 +--
src/video_output/vout_intf.c | 4 +++-
5 files changed, 11 insertions(+), 34 deletions(-)
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index f50b995..8f7c3f5 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -236,7 +236,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
}
case ACTIONID_LEAVE_FULLSCREEN:
- if( p_vout && var_GetBool( p_vout, "fullscreen" ) )
+ if( p_vout )
var_SetBool( p_vout, "fullscreen", false );
break;
diff --git a/modules/video_filter/filter_common.h b/modules/video_filter/filter_common.h
index 5413cc7..326ebad 100644
--- a/modules/video_filter/filter_common.h
+++ b/modules/video_filter/filter_common.h
@@ -83,19 +83,6 @@ static inline int ForwardEvent( vlc_object_t *p_this, char const *psz_var,
return var_Set( p_dst, psz_var, newval );
}
/**
- * Internal helper to forward fullscreen event from p_this to p_data.
- */
-static inline int ForwardFullscreen( vlc_object_t *p_this, char const *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
-{
- VLC_UNUSED(p_this); VLC_UNUSED(oldval);
- vlc_object_t *p_dst = (vlc_object_t*)p_data;
-
- if( !var_GetBool( p_dst, "fullscreen" ) != !newval.b_bool )
- return var_SetBool( p_dst, psz_var, newval.b_bool );
- return VLC_SUCCESS;
-}
-/**
* Install/remove all callbacks needed for proper event handling inside
* a vout-filter.
*/
@@ -129,9 +116,9 @@ static inline void vout_filter_SetupChild( vout_thread_t *p_parent, vout_thread_
/* */
if( !pf_fullscreen_up )
- pf_fullscreen_up = ForwardFullscreen;
+ pf_fullscreen_up = ForwardEvent;
if( !pf_fullscreen_down )
- pf_fullscreen_down = ForwardFullscreen;
+ pf_fullscreen_down = ForwardEvent;
pf_execute( VLC_OBJECT(p_child), "fullscreen", pf_fullscreen_up, p_parent );
pf_execute( VLC_OBJECT(p_parent), "fullscreen", pf_fullscreen_down, p_child );
}
diff --git a/modules/video_filter/wrapper.c b/modules/video_filter/wrapper.c
index 9271c97..26c078a 100644
--- a/modules/video_filter/wrapper.c
+++ b/modules/video_filter/wrapper.c
@@ -562,9 +562,7 @@ static int FullscreenEventUp( vlc_object_t *p_this, char const *psz_var,
VLC_UNUSED(oldval); VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(newval);
const bool b_fullscreen = IsFullscreenActive( p_vout );
- if( !var_GetBool( p_vout, "fullscreen" ) != !b_fullscreen )
- return var_SetBool( p_vout, "fullscreen", b_fullscreen );
- return VLC_SUCCESS;
+ return var_SetBool( p_vout, "fullscreen", b_fullscreen );
}
static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
@@ -573,19 +571,10 @@ static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
vout_sys_t *p_sys = p_vout->p_sys;
VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(psz_var);
- const bool b_fullscreen = IsFullscreenActive( p_vout );
- if( !b_fullscreen != !newval.b_bool )
+ for( int i = 0; i < p_sys->i_vout; i++ )
{
- for( int i = 0; i < p_sys->i_vout; i++ )
- {
- vout_thread_t *p_child = p_sys->pp_vout[i];
- if( !var_GetBool( p_child, "fullscreen" ) != !newval.b_bool )
- {
- var_SetBool( p_child, "fullscreen", newval.b_bool );
- if( newval.b_bool )
- return VLC_SUCCESS;
- }
- }
+ vout_thread_t *p_child = p_sys->pp_vout[i];
+ var_SetBool( p_child, "fullscreen", newval.b_bool );
}
return VLC_SUCCESS;
}
diff --git a/src/video_output/event.h b/src/video_output/event.h
index 2ac3b3f..6614d5d 100644
--- a/src/video_output/event.h
+++ b/src/video_output/event.h
@@ -100,8 +100,7 @@ static inline void vout_SendEventMouseHidden(vout_thread_t *vout)
static inline void vout_SendEventFullscreen(vout_thread_t *vout, bool is_fullscreen)
{
- if (!var_GetBool(vout, "fullscreen") != !is_fullscreen)
- var_SetBool(vout, "fullscreen", is_fullscreen);
+ var_SetBool(vout, "fullscreen", is_fullscreen);
}
static inline void vout_SendEventDisplayFilled(vout_thread_t *vout, bool is_display_filled)
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index ceaa7e1..4577b1e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -978,8 +978,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ (void)psz_cmd; (void)p_data;
+ if( oldval.b_bool == newval.b_bool )
+ return VLC_SUCCESS; /* no-op */
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
/* Modify libvlc as well because the vout might have to be restarted */
More information about the vlc-devel
mailing list