Also fix mouse pointer position when capture a subscreen in x11.
------------------------------------
Inputs:
- * Mouse cursor support in x11 screen module
+ * Mouse cursor support in x11 and win32 screen modules
* Screen module now supports partial screen capture and mouse following on
windows.
{
p_sys->i_screen_width = p_sys->fmt.video.i_width;
p_sys->i_screen_height = p_sys->fmt.video.i_height;
+ p_sys->fmt.video.i_visible_width =
p_sys->fmt.video.i_width = p_sys->i_width;
+ p_sys->fmt.video.i_visible_height =
p_sys->fmt.video.i_height = p_sys->i_height;
p_sys->b_follow_mouse = var_CreateGetInteger( p_demux,
"screen-follow-mouse" );
p_sys->i_screen_height - p_sys->i_height );
}
#endif
+
+#ifdef SCREEN_MOUSE
+void RenderCursor( demux_t *p_demux, int i_x, int i_y,
+ uint8_t *p_dst )
+{
+ demux_sys_t *p_sys = p_demux->p_sys;
+ if( !p_sys->dst.i_planes )
+ vout_InitPicture( p_demux, &p_sys->dst,
+ p_sys->fmt.video.i_chroma,
+ p_sys->fmt.video.i_width,
+ p_sys->fmt.video.i_height,
+ p_sys->fmt.video.i_aspect );
+ if( !p_sys->p_blend )
+ {
+ p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
+ if( !p_sys->p_blend )
+ msg_Err( p_demux, "Could not allocate memory for blending module" );
+ else
+ {
+ es_format_Init( &p_sys->p_blend->fmt_in, VIDEO_ES,
+ VLC_FOURCC('R','G','B','A') );
+ p_sys->p_blend->fmt_in.video = p_sys->p_mouse->format;
+ p_sys->p_blend->fmt_out = p_sys->fmt;
+ p_sys->p_blend->p_module =
+ module_Need( p_sys->p_blend, "video blending", 0, 0 );
+ if( !p_sys->p_blend->p_module )
+ {
+ msg_Err( p_demux, "Could not load video blending module" );
+ vlc_object_detach( p_sys->p_blend );
+ vlc_object_release( p_sys->p_blend );
+ p_sys->p_blend = NULL;
+ }
+ }
+ }
+ if( p_sys->p_blend )
+ {
+ p_sys->dst.p->p_pixels = p_dst;
+ p_sys->p_blend->pf_video_blend( p_sys->p_blend,
+ &p_sys->dst,
+ p_sys->p_mouse,
+#ifdef SCREEN_SUBSCREEN
+ i_x-p_sys->i_left,
+#else
+ i_x,
+#endif
+#ifdef SCREEN_SUBSCREEN
+ i_y-p_sys->i_top,
+#else
+ i_y,
+#endif
+ 255 );
+ }
+ else
+ {
+ picture_Release( p_sys->p_mouse );
+ p_sys->p_mouse = NULL;
+ }
+}
+#endif
#if !defined( HAVE_BEOS ) && !defined( HAVE_DARWIN )
# define SCREEN_SUBSCREEN
-#endif
-
-#if !defined( HAVE_WIN32 ) && !defined( HAVE_BEOS ) && !defined( HAVE_DARWIN )
# define SCREEN_MOUSE
#endif
#ifdef SCREEN_SUBSCREEN
void FollowMouse( demux_sys_t *, int, int );
#endif
+#ifdef SCREEN_MOUSE
+void RenderCursor( demux_t *, int, int, uint8_t * );
+#endif
/*****************************************************************************
* win32.c: Screen capture module.
*****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
+ * Copyright (C) 2004-2008 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
}
es_format_Init( &p_sys->fmt, VIDEO_ES, i_chroma );
+ p_sys->fmt.video.i_visible_width =
p_sys->fmt.video.i_width = GetDeviceCaps( p_data->hdc_src, HORZRES );
+ p_sys->fmt.video.i_visible_height =
p_sys->fmt.video.i_height = GetDeviceCaps( p_data->hdc_src, VERTRES );
p_sys->fmt.video.i_bits_per_pixel = i_bits_per_pixel;
+ p_sys->fmt.video.i_chroma = i_chroma;
switch( i_chroma )
{
block_t *p_block = p_data->p_block;
p_data->i_fragment = 0;
p_data->p_block = 0;
+
+ if( p_sys->p_mouse )
+ {
+ POINT pos;
+ GetCursorPos( &pos );
+ RenderCursor( p_demux, pos.x, pos.y,
+ p_block->p_buffer );
+ }
+
return p_block;
}
return 0;
}
- if( !p_sys->p_mouse )
- vlc_memcpy( p_block->p_buffer, image->data, i_size );
- else
- {
- if( !p_sys->dst.i_planes )
- vout_InitPicture( p_demux, &p_sys->dst,
- p_sys->fmt.video.i_chroma,
- p_sys->fmt.video.i_width,
- p_sys->fmt.video.i_height,
- p_sys->fmt.video.i_aspect );
- if( !p_sys->p_blend )
- {
- p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
- if( !p_sys->p_blend )
- msg_Err( p_demux, "Could not allocate memory for blending module" );
- else
- {
- es_format_Init( &p_sys->p_blend->fmt_in, VIDEO_ES,
- VLC_FOURCC('R','G','B','A') );
- p_sys->p_blend->fmt_in.video = p_sys->p_mouse->format;
- p_sys->p_blend->fmt_out = p_sys->fmt;
- p_sys->p_blend->p_module =
- module_Need( p_sys->p_blend, "video blending", 0, 0 );
- if( !p_sys->p_blend->p_module )
- {
- msg_Err( p_demux, "Could not load video blending module" );
- vlc_object_detach( p_sys->p_blend );
- vlc_object_release( p_sys->p_blend );
- p_sys->p_blend = NULL;
- }
- }
- }
- if( p_sys->p_blend )
- {
- vlc_memcpy( p_block->p_buffer, image->data, i_size );
- p_sys->dst.p->p_pixels = p_block->p_buffer;
- p_sys->p_blend->pf_video_blend( p_sys->p_blend,
- &p_sys->dst,
- p_sys->p_mouse,
- root_x,
- root_y,
- 255 );
- }
- else
- {
- picture_Release( p_sys->p_mouse );
- p_sys->p_mouse = NULL;
- vlc_memcpy( p_block->p_buffer, image->data, i_size );
- }
- }
+ vlc_memcpy( p_block->p_buffer, image->data, i_size );
+
+ if( p_sys->p_mouse )
+ RenderCursor( p_demux, root_x, root_y,
+ p_block->p_buffer );
XDestroyImage( image );