[vlc-devel] commit: VOUT_SET_STAY_ON_TOP: call vout_Control in a thread-safe fashion ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Feb 15 18:26:41 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Feb 15 19:25:42 2009 +0200| [1a11a808f3b9c73dff29e67a335b6308ebfb504e] | committer: Rémi Denis-Courmont
VOUT_SET_STAY_ON_TOP: call vout_Control in a thread-safe fashion
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a11a808f3b9c73dff29e67a335b6308ebfb504e
---
include/vlc_vout.h | 7 +++++--
src/video_output/video_output.c | 8 ++++++++
src/video_output/vout_intf.c | 8 ++++++--
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index cd1a18d..23e98ad 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -506,8 +506,9 @@ struct vout_thread_t
/**@{*/
uint16_t i_changes; /**< changes made to the thread.
\see \ref vout_changes */
- bool b_fullscreen; /**< toogle fullscreen display */
- bool b_autoscale; /**< auto scaling picture or not */
+ unsigned b_fullscreen:1; /**< toogle fullscreen display */
+ unsigned b_autoscale:1; /**< auto scaling picture or not */
+ unsigned b_on_top:1; /**< stay always on top of other windows */
int i_zoom; /**< scaling factor if no auto */
unsigned int i_window_width; /**< video window width */
unsigned int i_window_height; /**< video window height */
@@ -569,6 +570,8 @@ struct vout_thread_t
#define VOUT_INTF_CHANGE 0x0004
/** b_autoscale changed */
#define VOUT_SCALE_CHANGE 0x0008
+/** b_on_top changed */
+#define VOUT_ON_TOP_CHANGE 0x0010
/** b_cursor changed */
#define VOUT_CURSOR_CHANGE 0x0020
/** b_fullscreen changed */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 476eb43..0751e75 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1265,6 +1265,14 @@ static void* RunThread( void *p_this )
break;
}
+ while( p_vout->i_changes & VOUT_ON_TOP_CHANGE )
+ {
+ p_vout->i_changes &= ~VOUT_ON_TOP_CHANGE;
+ vlc_mutex_unlock( &p_vout->change_lock );
+ vout_Control( p_vout, VOUT_SET_STAY_ON_TOP, p_vout->b_on_top );
+ vlc_mutex_lock( &p_vout->change_lock );
+ }
+
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
/* this must only happen when the vout plugin is incapable of
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 8160e85..7cb21e8 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -1221,13 +1221,17 @@ static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- vout_Control( p_vout, VOUT_SET_STAY_ON_TOP, newval.b_bool );
- (void)psz_cmd; (void)oldval; (void)p_data;
+
+ vlc_mutex_lock( &p_vout->change_lock );
+ p_vout->i_changes |= VOUT_ON_TOP_CHANGE;
+ p_vout->b_on_top = newval.b_bool;
+ vlc_mutex_unlock( &p_vout->change_lock );
/* Modify libvlc as well because the vout might have to be restarted */
var_Create( p_vout->p_libvlc, "video-on-top", VLC_VAR_BOOL );
var_Set( p_vout->p_libvlc, "video-on-top", newval );
+ (void)psz_cmd; (void)oldval; (void)p_data;
return VLC_SUCCESS;
}
More information about the vlc-devel
mailing list