Changeset 6d9536c7663f926889b44a6deb125152acfb3508
- Timestamp:
- 04/09/08 18:00:29 (3 months ago)
- git-parent:
- Files:
-
- NEWS (modified) (1 diff)
- modules/access/screen/screen.c (modified) (4 diffs)
- modules/access/screen/screen.h (modified) (2 diffs)
- modules/access/screen/x11.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
NEWS
r355d80f r6d9536c 1 1 Changes between 0.9.1 and 1.0.0-git: 2 2 ------------------------------------ 3 4 Inputs: 5 * Mouse cursor support in x11 screen module 3 6 4 7 Decoders: modules/access/screen/screen.c
r62ec225 r6d9536c 74 74 #endif 75 75 76 #ifdef SCREEN_MOUSE 77 #define MOUSE_TEXT N_( "Mouse pointer image" ) 78 #define MOUSE_LONGTEXT N_( \ 79 "If specifed, will use the image to draw the mouse pointer on the " \ 80 "capture." ) 81 #endif 82 76 83 static int Open ( vlc_object_t * ); 77 84 static void Close( vlc_object_t * ); … … 100 107 add_bool( "screen-follow-mouse", false, NULL, FOLLOW_MOUSE_TEXT, 101 108 FOLLOW_MOUSE_LONGTEXT, true ); 109 #endif 110 111 #ifdef SCREEN_MOUSE 112 add_string( "screen-mouse-image", "", NULL, MOUSE_TEXT, MOUSE_LONGTEXT, 113 true ); 102 114 #endif 103 115 … … 190 202 #endif 191 203 204 #ifdef SCREEN_MOUSE 205 char * psz_mouse = var_CreateGetNonEmptyString( p_demux, 206 "screen-mouse-image" ); 207 if( psz_mouse ) 208 { 209 image_handler_t *p_image; 210 video_format_t fmt_in, fmt_out; 211 msg_Dbg( p_demux, "Using %s for the mouse pointer image", psz_mouse ); 212 memset( &fmt_in, 0, sizeof( fmt_in ) ); 213 memset( &fmt_out, 0, sizeof( fmt_out ) ); 214 fmt_out.i_chroma = VLC_FOURCC('R','G','B','A'); 215 p_image = image_HandlerCreate( p_demux ); 216 if( p_image ) 217 { 218 p_sys->p_mouse = 219 image_ReadUrl( p_image, psz_mouse, &fmt_in, &fmt_out ); 220 image_HandlerDelete( p_image ); 221 } 222 if( !p_sys->p_mouse ) 223 msg_Err( p_demux, "Failed to open mouse pointer image (%s)", 224 psz_mouse ); 225 } 226 #endif 227 192 228 p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt ); 193 229 … … 204 240 205 241 screen_CloseCapture( p_demux ); 242 #ifdef SCREEN_MOUSE 243 if( p_sys->p_mouse ) 244 picture_Release( p_sys->p_mouse ); 245 #endif 206 246 free( p_sys ); 207 247 } modules/access/screen/screen.h
r96973d2 r6d9536c 28 28 #if !defined( HAVE_WIN32 ) && !defined( HAVE_BEOS ) && !defined( HAVE_DARWIN ) 29 29 # define SCREEN_SUBSCREEN 30 # define SCREEN_MOUSE 31 #endif 32 33 #ifdef SCREEN_MOUSE 34 # include <vlc_image.h> 30 35 #endif 31 36 … … 52 57 #endif 53 58 59 #ifdef SCREEN_MOUSE 60 picture_t *p_mouse; 61 filter_t *p_blend; 62 picture_t src; 63 picture_t dst; 64 #endif 65 54 66 screen_data_t *p_data; 55 67 }; modules/access/screen/x11.c
r3561b9b r6d9536c 83 83 84 84 es_format_Init( &p_sys->fmt, VIDEO_ES, i_chroma ); 85 p_sys->fmt.video.i_visible_width = 85 86 p_sys->fmt.video.i_width = win_info.width; 87 p_sys->fmt.video.i_visible_height = 86 88 p_sys->fmt.video.i_height = win_info.height; 87 89 p_sys->fmt.video.i_bits_per_pixel = win_info.depth; 90 p_sys->fmt.video.i_chroma = i_chroma; 88 91 89 92 #if 0 … … 103 106 104 107 XCloseDisplay( p_display ); 108 if( p_sys->p_blend ) 109 { 110 module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module ); 111 vlc_object_detach( p_sys->p_blend ); 112 vlc_object_release( p_sys->p_blend ); 113 } 105 114 return VLC_SUCCESS; 106 115 } … … 113 122 XImage *image; 114 123 int i_size; 115 116 if( p_sys->b_follow_mouse ) 124 int root_x = 0, root_y = 0; 125 126 if( p_sys->b_follow_mouse || p_sys->p_mouse ) 117 127 { 118 128 Window root = DefaultRootWindow( p_display ), child; 119 int root_x, root_y;120 129 int win_x, win_y; 121 130 unsigned int mask; … … 124 133 &mask ) ) 125 134 { 126 root_x -= p_sys->i_width/2; 127 if( root_x < 0 ) root_x = 0; 128 p_sys->i_left = __MIN( (unsigned int)root_x, 129 p_sys->i_screen_width - p_sys->i_width ); 130 root_y -= p_sys->i_height/2; 131 if( root_y < 0 ) root_y = 0; 132 p_sys->i_top = __MIN( (unsigned int)root_y, 133 p_sys->i_screen_height - p_sys->i_height ); 135 if( p_sys->b_follow_mouse ) 136 { 137 root_x -= p_sys->i_width/2; 138 if( root_x < 0 ) root_x = 0; 139 p_sys->i_left = __MIN( (unsigned int)root_x, 140 p_sys->i_screen_width - p_sys->i_width ); 141 root_y -= p_sys->i_height/2; 142 if( root_y < 0 ) root_y = 0; 143 p_sys->i_top = __MIN( (unsigned int)root_y, 144 p_sys->i_screen_height - p_sys->i_height ); 145 } 134 146 } 135 147 else … … 157 169 } 158 170 159 vlc_memcpy( p_block->p_buffer, image->data, i_size ); 171 if( !p_sys->p_mouse ) 172 vlc_memcpy( p_block->p_buffer, image->data, i_size ); 173 else 174 { 175 if( !p_sys->src.i_planes ) 176 vout_InitPicture( p_demux, &p_sys->src, 177 p_sys->fmt.video.i_chroma, 178 p_sys->fmt.video.i_width, 179 p_sys->fmt.video.i_height, 180 p_sys->fmt.video.i_aspect ); 181 if( !p_sys->dst.i_planes ) 182 vout_InitPicture( p_demux, &p_sys->dst, 183 p_sys->fmt.video.i_chroma, 184 p_sys->fmt.video.i_width, 185 p_sys->fmt.video.i_height, 186 p_sys->fmt.video.i_aspect ); 187 if( !p_sys->p_blend ) 188 { 189 p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) ); 190 if( !p_sys->p_blend ) 191 msg_Err( p_demux, "Could not allocate memory for blending module" ); 192 else 193 { 194 es_format_Init( &p_sys->p_blend->fmt_in, VIDEO_ES, 195 VLC_FOURCC('R','G','B','A') ); 196 p_sys->p_blend->fmt_in.video = p_sys->p_mouse->format; 197 p_sys->p_blend->fmt_out = p_sys->fmt; 198 p_sys->p_blend->p_module = 199 module_Need( p_sys->p_blend, "video blending", 0, 0 ); 200 if( !p_sys->p_blend->p_module ) 201 { 202 msg_Err( p_demux, "Could not load video blending module" ); 203 vlc_object_detach( p_sys->p_blend ); 204 vlc_object_release( p_sys->p_blend ); 205 p_sys->p_blend = NULL; 206 } 207 } 208 } 209 if( p_sys->p_blend ) 210 { 211 /* FIXME: why is this memcpy needed?!? (bug in blend?) */ 212 vlc_memcpy( p_block->p_buffer, image->data, i_size ); 213 p_sys->dst.p->p_pixels = p_block->p_buffer; 214 p_sys->src.p->p_pixels = image->data; 215 p_sys->p_blend->pf_video_blend( p_sys->p_blend, 216 &p_sys->dst, 217 &p_sys->src, 218 p_sys->p_mouse, 219 root_x, 220 root_y, 221 255 ); 222 } 223 else 224 { 225 picture_Release( p_sys->p_mouse ); 226 p_sys->p_mouse = NULL; 227 vlc_memcpy( p_block->p_buffer, image->data, i_size ); 228 } 229 } 160 230 161 231 XDestroyImage( image );
