comparison libvo/vo_x11.c @ 12582:162c80b2d432

major reindentation of x11 code try #2 note that this is plain ident output, i didnt tweak it by hand like the last attempt. if anyone is interested in the indent profile i used, just drop me a mail. please contact me on irc on how to send me my share of cola, but be aware that i will only accept swiss or german cola, as the japanese is way to sweet :)
author attila
date Mon, 14 Jun 2004 04:53:03 +0000
parents 860bc06f32ca
children 3cd9add91f97
comparison
equal deleted inserted replaced
12581:602a2796e353 12582:162c80b2d432
23 #include <sys/ipc.h> 23 #include <sys/ipc.h>
24 #include <sys/shm.h> 24 #include <sys/shm.h>
25 #include <X11/extensions/XShm.h> 25 #include <X11/extensions/XShm.h>
26 26
27 static int Shmem_Flag; 27 static int Shmem_Flag;
28
28 //static int Quiet_Flag; Here also what is this for. It's used but isn't inited ? 29 //static int Quiet_Flag; Here also what is this for. It's used but isn't inited ?
29 static XShmSegmentInfo Shminfo[1]; 30 static XShmSegmentInfo Shminfo[1];
30 static int gXErrorFlag; 31 static int gXErrorFlag;
31 static int CompletionType=-1; 32 static int CompletionType = -1;
32 33
33 /* since it doesn't seem to be defined on some platforms */ 34 /* since it doesn't seem to be defined on some platforms */
34 int XShmGetEventBase( Display* ); 35 int XShmGetEventBase(Display *);
35 #endif 36 #endif
36 37
37 #include "fastmemcpy.h" 38 #include "fastmemcpy.h"
38 #include "sub.h" 39 #include "sub.h"
39 40
40 #include "../postproc/swscale.h" 41 #include "../postproc/swscale.h"
41 #include "../postproc/swscale_internal.h" //FIXME 42 #include "../postproc/swscale_internal.h" //FIXME
42 #include "../postproc/rgb2rgb.h" 43 #include "../postproc/rgb2rgb.h"
43 #include "../libmpcodecs/vf_scale.h" 44 #include "../libmpcodecs/vf_scale.h"
44 45
45 #include "../mp_msg.h" 46 #include "../mp_msg.h"
46 47
47 #ifdef HAVE_NEW_GUI 48 #ifdef HAVE_NEW_GUI
48 #include "../Gui/interface.h" 49 #include "../Gui/interface.h"
49 #include "../mplayer.h" 50 #include "../mplayer.h"
50 #endif 51 #endif
51 52
52 static vo_info_t info = 53 static vo_info_t info = {
53 { 54 "X11 ( XImage/Shm )",
54 "X11 ( XImage/Shm )", 55 "x11",
55 "x11", 56 "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>",
56 "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>", 57 ""
57 ""
58 }; 58 };
59 59
60 LIBVO_EXTERN( x11 ) 60 LIBVO_EXTERN(x11)
61
62 /* private prototypes */ 61 /* private prototypes */
63 static void Display_Image ( XImage * myximage,unsigned char *ImageData ); 62 static void Display_Image(XImage * myximage, unsigned char *ImageData);
64 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); 63 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h,
64 unsigned char *src, unsigned char *srca,
65 int stride);
65 66
66 /* local data */ 67 /* local data */
67 static unsigned char *ImageData; 68 static unsigned char *ImageData;
68 69
69 /* X11 related variables */ 70 /* X11 related variables */
70 static XImage *myximage = NULL; 71 static XImage *myximage = NULL;
71 static int depth,bpp,mode; 72 static int depth, bpp, mode;
72 static XWindowAttributes attribs; 73 static XWindowAttributes attribs;
73 74
74 static int int_pause; 75 static int int_pause;
75 76
76 static int Flip_Flag; 77 static int Flip_Flag;
78 79
79 80
80 static uint32_t image_width; 81 static uint32_t image_width;
81 static uint32_t image_height; 82 static uint32_t image_height;
82 static uint32_t in_format; 83 static uint32_t in_format;
83 static uint32_t out_format=0; 84 static uint32_t out_format = 0;
84 static int srcW=-1; 85 static int srcW = -1;
85 static int srcH=-1; 86 static int srcH = -1;
86 static int aspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing 87 static int aspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing
87 88
88 static int old_vo_dwidth=-1; 89 static int old_vo_dwidth = -1;
89 static int old_vo_dheight=-1; 90 static int old_vo_dheight = -1;
90 91
91 static void check_events(){ 92 static void check_events()
92 int ret = vo_x11_check_events(mDisplay); 93 {
93 94 int ret = vo_x11_check_events(mDisplay);
94 /* clear left over borders and redraw frame if we are paused */ 95
95 if ( ret & VO_EVENT_EXPOSE && int_pause) 96 /* clear left over borders and redraw frame if we are paused */
96 { 97 if (ret & VO_EVENT_EXPOSE && int_pause)
97 vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width, myximage->height, 0); 98 {
98 flip_page(); 99 vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width,
99 } else 100 myximage->height, 0);
100 if ( (ret & VO_EVENT_RESIZE)||(ret & VO_EVENT_EXPOSE) ) 101 flip_page();
101 vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width, myximage->height, 0); 102 } else if ((ret & VO_EVENT_RESIZE) || (ret & VO_EVENT_EXPOSE))
102 103 vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width,
103 } 104 myximage->height, 0);
104 105
105 static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 106 }
106 vo_draw_alpha_rgb32(w,h,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width); 107
107 } 108 static void draw_alpha_32(int x0, int y0, int w, int h, unsigned char *src,
108 109 unsigned char *srca, int stride)
109 static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 110 {
110 vo_draw_alpha_rgb24(w,h,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width); 111 vo_draw_alpha_rgb32(w, h, src, srca, stride,
111 } 112 ImageData + 4 * (y0 * image_width + x0),
112 113 4 * image_width);
113 static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 114 }
114 vo_draw_alpha_rgb16(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); 115
115 } 116 static void draw_alpha_24(int x0, int y0, int w, int h, unsigned char *src,
116 117 unsigned char *srca, int stride)
117 static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 118 {
118 vo_draw_alpha_rgb15(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); 119 vo_draw_alpha_rgb24(w, h, src, srca, stride,
119 } 120 ImageData + 3 * (y0 * image_width + x0),
120 121 3 * image_width);
121 static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ 122 }
122 } 123
123 124 static void draw_alpha_16(int x0, int y0, int w, int h, unsigned char *src,
124 static SwsContext *swsContext=NULL; 125 unsigned char *srca, int stride)
126 {
127 vo_draw_alpha_rgb16(w, h, src, srca, stride,
128 ImageData + 2 * (y0 * image_width + x0),
129 2 * image_width);
130 }
131
132 static void draw_alpha_15(int x0, int y0, int w, int h, unsigned char *src,
133 unsigned char *srca, int stride)
134 {
135 vo_draw_alpha_rgb15(w, h, src, srca, stride,
136 ImageData + 2 * (y0 * image_width + x0),
137 2 * image_width);
138 }
139
140 static void draw_alpha_null(int x0, int y0, int w, int h,
141 unsigned char *src, unsigned char *srca,
142 int stride)
143 {
144 }
145
146 static SwsContext *swsContext = NULL;
125 extern int sws_flags; 147 extern int sws_flags;
126 148
127 static XVisualInfo vinfo; 149 static XVisualInfo vinfo;
128 150
129 static void getMyXImage() 151 static void getMyXImage()
130 { 152 {
131 #ifdef HAVE_SHM 153 #ifdef HAVE_SHM
132 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; 154 if (mLocalDisplay && XShmQueryExtension(mDisplay))
133 else 155 Shmem_Flag = 1;
134 { 156 else
135 Shmem_Flag=0; 157 {
136 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory not supported\nReverting to normal Xlib\n" ); 158 Shmem_Flag = 0;
137 } 159 mp_msg(MSGT_VO, MSGL_WARN,
138 if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; 160 "Shared memory not supported\nReverting to normal Xlib\n");
139 161 }
140 if ( Shmem_Flag ) 162 if (Shmem_Flag)
141 { 163 CompletionType = XShmGetEventBase(mDisplay) + ShmCompletion;
142 myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height ); 164
143 if ( myximage == NULL ) 165 if (Shmem_Flag)
144 { 166 {
145 if ( myximage != NULL ) XDestroyImage( myximage ); 167 myximage =
146 mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( Ximage error )\n" ); 168 XShmCreateImage(mDisplay, vinfo.visual, depth, ZPixmap, NULL,
147 goto shmemerror; 169 &Shminfo[0], image_width, image_height);
148 } 170 if (myximage == NULL)
149 Shminfo[0].shmid=shmget( IPC_PRIVATE, 171 {
150 myximage->bytes_per_line * myximage->height , 172 if (myximage != NULL)
151 IPC_CREAT | 0777 ); 173 XDestroyImage(myximage);
152 if ( Shminfo[0].shmid < 0 ) 174 mp_msg(MSGT_VO, MSGL_WARN,
153 { 175 "Shared memory error,disabling ( Ximage error )\n");
154 XDestroyImage( myximage ); 176 goto shmemerror;
155 mp_msg(MSGT_VO,MSGL_V, "%s\n",strerror( errno ) ); 177 }
156 //perror( strerror( errno ) ); 178 Shminfo[0].shmid = shmget(IPC_PRIVATE,
157 mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( seg id error )\n" ); 179 myximage->bytes_per_line *
158 goto shmemerror; 180 myximage->height, IPC_CREAT | 0777);
159 } 181 if (Shminfo[0].shmid < 0)
160 Shminfo[0].shmaddr=( char * ) shmat( Shminfo[0].shmid,0,0 ); 182 {
161 183 XDestroyImage(myximage);
162 if ( Shminfo[0].shmaddr == ( ( char * ) -1 ) ) 184 mp_msg(MSGT_VO, MSGL_V, "%s\n", strerror(errno));
163 { 185 //perror( strerror( errno ) );
164 XDestroyImage( myximage ); 186 mp_msg(MSGT_VO, MSGL_WARN,
165 if ( Shminfo[0].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[0].shmaddr ); 187 "Shared memory error,disabling ( seg id error )\n");
166 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling ( address error )\n" ); 188 goto shmemerror;
167 goto shmemerror; 189 }
168 } 190 Shminfo[0].shmaddr = (char *) shmat(Shminfo[0].shmid, 0, 0);
169 myximage->data=Shminfo[0].shmaddr; 191
170 ImageData=( unsigned char * ) myximage->data; 192 if (Shminfo[0].shmaddr == ((char *) -1))
171 Shminfo[0].readOnly=False; 193 {
172 XShmAttach( mDisplay,&Shminfo[0] ); 194 XDestroyImage(myximage);
173 195 if (Shminfo[0].shmaddr != ((char *) -1))
174 XSync( mDisplay,False ); 196 shmdt(Shminfo[0].shmaddr);
175 197 mp_msg(MSGT_VO, MSGL_WARN,
176 if ( gXErrorFlag ) 198 "Shared memory error,disabling ( address error )\n");
177 { 199 goto shmemerror;
178 XDestroyImage( myximage ); 200 }
179 shmdt( Shminfo[0].shmaddr ); 201 myximage->data = Shminfo[0].shmaddr;
180 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling.\n" ); 202 ImageData = (unsigned char *) myximage->data;
181 gXErrorFlag=0; 203 Shminfo[0].readOnly = False;
182 goto shmemerror; 204 XShmAttach(mDisplay, &Shminfo[0]);
183 } 205
184 else 206 XSync(mDisplay, False);
185 shmctl( Shminfo[0].shmid,IPC_RMID,0 ); 207
186 208 if (gXErrorFlag)
187 { 209 {
188 static int firstTime=1; 210 XDestroyImage(myximage);
189 if ( firstTime){ 211 shmdt(Shminfo[0].shmaddr);
190 mp_msg(MSGT_VO,MSGL_V, "Sharing memory.\n" ); 212 mp_msg(MSGT_VO, MSGL_WARN, "Shared memory error,disabling.\n");
191 firstTime=0; 213 gXErrorFlag = 0;
192 } 214 goto shmemerror;
193 } 215 } else
194 } 216 shmctl(Shminfo[0].shmid, IPC_RMID, 0);
195 else 217
196 { 218 {
197 shmemerror: 219 static int firstTime = 1;
198 Shmem_Flag=0; 220
199 #endif 221 if (firstTime)
200 myximage=XGetImage( mDisplay,vo_window,0,0, 222 {
201 image_width,image_height,AllPlanes,ZPixmap ); 223 mp_msg(MSGT_VO, MSGL_V, "Sharing memory.\n");
202 ImageData=myximage->data; 224 firstTime = 0;
225 }
226 }
227 } else
228 {
229 shmemerror:
230 Shmem_Flag = 0;
231 #endif
232 myximage = XGetImage(mDisplay, vo_window, 0, 0,
233 image_width, image_height, AllPlanes,
234 ZPixmap);
235 ImageData = myximage->data;
203 #ifdef HAVE_SHM 236 #ifdef HAVE_SHM
204 } 237 }
205 #endif 238 #endif
206 } 239 }
207 240
208 static void freeMyXImage() 241 static void freeMyXImage()
209 { 242 {
210 #ifdef HAVE_SHM 243 #ifdef HAVE_SHM
211 if ( Shmem_Flag ) 244 if (Shmem_Flag)
212 { 245 {
213 XShmDetach( mDisplay,&Shminfo[0] ); 246 XShmDetach(mDisplay, &Shminfo[0]);
214 XDestroyImage( myximage ); 247 XDestroyImage(myximage);
215 shmdt( Shminfo[0].shmaddr ); 248 shmdt(Shminfo[0].shmaddr);
216 } 249 } else
217 else 250 #endif
218 #endif 251 {
219 { 252 XDestroyImage(myximage);
220 XDestroyImage( myximage ); 253 }
221 } 254 myximage = NULL;
222 myximage=NULL; 255 }
223 } 256
224 257 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
225 static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t flags,char *title,uint32_t format) 258 uint32_t d_height, uint32_t flags, char *title,
259 uint32_t format)
226 { 260 {
227 // int screen; 261 // int screen;
228 int fullscreen=0; 262 int fullscreen = 0;
229 int vm=0; 263 int vm = 0;
264
230 // int interval, prefer_blank, allow_exp, nothing; 265 // int interval, prefer_blank, allow_exp, nothing;
231 unsigned int fg,bg; 266 unsigned int fg, bg;
232 XEvent xev; 267 XEvent xev;
233 XGCValues xgcv; 268 XGCValues xgcv;
234 Colormap theCmap; 269 Colormap theCmap;
235 XSetWindowAttributes xswa; 270 XSetWindowAttributes xswa;
236 unsigned long xswamask; 271 unsigned long xswamask;
272
237 #ifdef HAVE_XF86VM 273 #ifdef HAVE_XF86VM
238 unsigned int modeline_width, modeline_height; 274 unsigned int modeline_width, modeline_height;
239 static uint32_t vm_width; 275 static uint32_t vm_width;
240 static uint32_t vm_height; 276 static uint32_t vm_height;
241 #endif 277 #endif
242 278
243 vo_mouse_autohide=1; 279 vo_mouse_autohide = 1;
244 old_vo_dwidth=-1; 280 old_vo_dwidth = -1;
245 old_vo_dheight=-1; 281 old_vo_dheight = -1;
246 282
247 if (!title) 283 if (!title)
248 title = strdup("MPlayer X11 (XImage/Shm) render"); 284 title = strdup("MPlayer X11 (XImage/Shm) render");
249 285
250 in_format=format; 286 in_format = format;
251 srcW= width; 287 srcW = width;
252 srcH= height; 288 srcH = height;
253 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; 289 vo_dx = (vo_screenwidth - d_width) / 2;
254 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); 290 vo_dy = (vo_screenheight - d_height) / 2;
255 vo_dwidth=d_width; vo_dheight=d_height; 291 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth,
256 292 vo_screenheight);
257 if( flags&0x03 ) fullscreen = 1; 293 vo_dwidth = d_width;
258 if( flags&0x02 ) vm = 1; 294 vo_dheight = d_height;
259 if( flags&0x08 ) Flip_Flag = 1; 295
260 zoomFlag = flags&0x04; 296 if (flags & 0x03)
261 297 fullscreen = 1;
262 int_pause = 0; 298 if (flags & 0x02)
299 vm = 1;
300 if (flags & 0x08)
301 Flip_Flag = 1;
302 zoomFlag = flags & 0x04;
303
304 int_pause = 0;
263 // if(!fullscreen) zoomFlag=1; //it makes no sense to avoid zooming on windowd mode 305 // if(!fullscreen) zoomFlag=1; //it makes no sense to avoid zooming on windowd mode
264 306
265 //printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight ); 307 //printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight );
266 308
267 XGetWindowAttributes( mDisplay,mRootWin,&attribs ); 309 XGetWindowAttributes(mDisplay, mRootWin, &attribs);
268 depth=attribs.depth; 310 depth = attribs.depth;
269 311
270 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) { 312 if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
271 Visual *visual; 313 {
272 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); 314 Visual *visual;
273 } 315
274 if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ) || 316 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual);
275 (WinID > 0 && vinfo.visualid != XVisualIDFromVisual(attribs.visual))) 317 }
276 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); 318 if (!XMatchVisualInfo(mDisplay, mScreen, depth, DirectColor, &vinfo) ||
277 319 (WinID > 0
278 /* set image size (which is indeed neither the input nor output size), 320 && vinfo.visualid != XVisualIDFromVisual(attribs.visual)))
279 if zoom is on it will be changed during draw_slice anyway so we don't duplicate the aspect code here 321 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
280 */ 322
281 image_width=(width + 7) & (~7); 323 /* set image size (which is indeed neither the input nor output size),
282 image_height=height; 324 if zoom is on it will be changed during draw_slice anyway so we don't duplicate the aspect code here
283 325 */
284 aspect= ((1<<16)*d_width + d_height/2)/d_height; 326 image_width = (width + 7) & (~7);
327 image_height = height;
328
329 aspect = ((1 << 16) * d_width + d_height / 2) / d_height;
285 330
286 #ifdef HAVE_NEW_GUI 331 #ifdef HAVE_NEW_GUI
287 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window 332 if (use_gui)
288 else 333 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
289 #endif 334 else
290 { 335 #endif
336 {
291 #ifdef HAVE_XF86VM 337 #ifdef HAVE_XF86VM
292 if ( vm ) 338 if (vm)
293 { 339 {
294 if ((d_width==0) && (d_height==0)) 340 if ((d_width == 0) && (d_height == 0))
295 { vm_width=image_width; vm_height=image_height; } 341 {
296 else 342 vm_width = image_width;
297 { vm_width=d_width; vm_height=d_height; } 343 vm_height = image_height;
298 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); 344 } else
299 vo_dx=(vo_screenwidth-modeline_width)/2; 345 {
300 vo_dy=(vo_screenheight-modeline_height)/2; 346 vm_width = d_width;
301 vo_dwidth=modeline_width; 347 vm_height = d_height;
302 vo_dheight=modeline_height; 348 }
303 } 349 vo_vm_switch(vm_width, vm_height, &modeline_width,
304 #endif 350 &modeline_height);
305 bg=WhitePixel( mDisplay,mScreen ); 351 vo_dx = (vo_screenwidth - modeline_width) / 2;
306 fg=BlackPixel( mDisplay,mScreen ); 352 vo_dy = (vo_screenheight - modeline_height) / 2;
307 353 vo_dwidth = modeline_width;
308 theCmap=vo_x11_create_colormap(&vinfo); 354 vo_dheight = modeline_height;
309 355 }
310 xswa.background_pixel=0; 356 #endif
311 xswa.border_pixel=0; 357 bg = WhitePixel(mDisplay, mScreen);
312 xswa.colormap=theCmap; 358 fg = BlackPixel(mDisplay, mScreen);
313 xswamask=CWBackPixel | CWBorderPixel | CWColormap; 359
360 theCmap = vo_x11_create_colormap(&vinfo);
361
362 xswa.background_pixel = 0;
363 xswa.border_pixel = 0;
364 xswa.colormap = theCmap;
365 xswamask = CWBackPixel | CWBorderPixel | CWColormap;
314 366
315 #ifdef HAVE_XF86VM 367 #ifdef HAVE_XF86VM
316 if ( vm ) 368 if (vm)
317 { 369 {
318 xswa.override_redirect=True; 370 xswa.override_redirect = True;
319 xswamask|=CWOverrideRedirect; 371 xswamask |= CWOverrideRedirect;
320 } 372 }
321 #endif 373 #endif
322 374
323 if ( WinID>=0 ){ 375 if (WinID >= 0)
324 vo_window = WinID ? ((Window)WinID) : mRootWin; 376 {
325 if ( WinID ) 377 vo_window = WinID ? ((Window) WinID) : mRootWin;
326 { 378 if (WinID)
327 XUnmapWindow( mDisplay,vo_window ); 379 {
328 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); 380 XUnmapWindow(mDisplay, vo_window);
329 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); 381 XChangeWindowAttributes(mDisplay, vo_window, xswamask,
330 XMapWindow( mDisplay,vo_window ); 382 &xswa);
331 } else XSelectInput( mDisplay,vo_window,ExposureMask ); 383 vo_x11_selectinput_witherr(mDisplay, vo_window,
332 } 384 StructureNotifyMask |
333 else 385 KeyPressMask |
334 { 386 PropertyChangeMask |
335 if ( vo_window == None ) 387 PointerMotionMask |
336 { 388 ButtonPressMask |
337 vo_window=vo_x11_create_smooth_window( mDisplay,mRootWin,vinfo.visual, vo_dx, vo_dy, vo_dwidth, vo_dheight, depth, theCmap ); 389 ButtonReleaseMask |
338 390 ExposureMask);
339 vo_x11_classhint( mDisplay,vo_window,"x11" ); 391 XMapWindow(mDisplay, vo_window);
340 vo_hidecursor(mDisplay,vo_window); 392 } else
341 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 ); 393 XSelectInput(mDisplay, vo_window, ExposureMask);
342 XSelectInput( mDisplay,vo_window,StructureNotifyMask ); 394 } else
343 XStoreName( mDisplay,vo_window,title ); 395 {
344 XMapWindow( mDisplay,vo_window ); 396 if (vo_window == None)
397 {
398 vo_window =
399 vo_x11_create_smooth_window(mDisplay, mRootWin,
400 vinfo.visual, vo_dx, vo_dy,
401 vo_dwidth, vo_dheight,
402 depth, theCmap);
403
404 vo_x11_classhint(mDisplay, vo_window, "x11");
405 vo_hidecursor(mDisplay, vo_window);
406 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
407 XSelectInput(mDisplay, vo_window, StructureNotifyMask);
408 XStoreName(mDisplay, vo_window, title);
409 XMapWindow(mDisplay, vo_window);
345 // if(WinID!=0) 410 // if(WinID!=0)
346 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window ); 411 do
347 412 {
348 if ( fullscreen ) vo_x11_fullscreen(); 413 XNextEvent(mDisplay, &xev);
414 }
415 while (xev.type != MapNotify
416 || xev.xmap.event != vo_window);
417
418 if (fullscreen)
419 vo_x11_fullscreen();
349 #ifdef HAVE_XINERAMA 420 #ifdef HAVE_XINERAMA
350 vo_x11_xinerama_move(mDisplay,vo_window); 421 vo_x11_xinerama_move(mDisplay, vo_window);
351 #endif 422 #endif
352 } else if ( !fullscreen ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight ); 423 } else if (!fullscreen)
353 } 424 XMoveResizeWindow(mDisplay, vo_window, vo_dx, vo_dy,
354 425 vo_dwidth, vo_dheight);
355 XFlush( mDisplay ); 426 }
356 XSync( mDisplay,False ); 427
357 428 XFlush(mDisplay);
358 // we cannot grab mouse events on root window :( 429 XSync(mDisplay, False);
359 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask | 430
360 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) ); 431 // we cannot grab mouse events on root window :(
432 vo_x11_selectinput_witherr(mDisplay, vo_window,
433 StructureNotifyMask | KeyPressMask |
434 PropertyChangeMask | ExposureMask |
435 ((WinID ==
436 0) ? 0 : (ButtonPressMask |
437 ButtonReleaseMask |
438 PointerMotionMask)));
361 439
362 #ifdef HAVE_XF86VM 440 #ifdef HAVE_XF86VM
363 if ( vm ) 441 if (vm)
364 { 442 {
365 /* Grab the mouse pointer in our window */ 443 /* Grab the mouse pointer in our window */
366 if(vo_grabpointer) 444 if (vo_grabpointer)
367 XGrabPointer(mDisplay, vo_window, True, 0, 445 XGrabPointer(mDisplay, vo_window, True, 0,
368 GrabModeAsync, GrabModeAsync, 446 GrabModeAsync, GrabModeAsync,
369 vo_window, None, CurrentTime); 447 vo_window, None, CurrentTime);
370 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); 448 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
371 } 449 }
372 #endif 450 #endif
373 } 451 }
374 452
375 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc ); 453 if (vo_gc != None)
376 vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv ); 454 XFreeGC(mDisplay, vo_gc);
377 455 vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
378 if ( myximage ) 456
379 { 457 if (myximage)
380 freeMyXImage(); 458 {
381 sws_freeContext(swsContext); 459 freeMyXImage();
382 } 460 sws_freeContext(swsContext);
383 getMyXImage(); 461 }
384 462 getMyXImage();
385 if ( !WinID ) 463
386 { vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; } 464 if (!WinID)
387 465 {
388 switch ((bpp=myximage->bits_per_pixel)){ 466 vo_dwidth = vo_screenwidth;
389 case 24: draw_alpha_fnc=draw_alpha_24; 467 vo_dheight = vo_screenheight;
390 out_format= IMGFMT_BGR24; break; 468 }
391 case 32: draw_alpha_fnc=draw_alpha_32; 469
392 out_format= IMGFMT_BGR32; break; 470 switch ((bpp = myximage->bits_per_pixel))
393 case 15: 471 {
394 case 16: if (depth==15){ 472 case 24:
395 draw_alpha_fnc=draw_alpha_15; 473 draw_alpha_fnc = draw_alpha_24;
396 out_format= IMGFMT_BGR15; 474 out_format = IMGFMT_BGR24;
397 }else{ 475 break;
398 draw_alpha_fnc=draw_alpha_16; 476 case 32:
399 out_format= IMGFMT_BGR16; 477 draw_alpha_fnc = draw_alpha_32;
400 }break; 478 out_format = IMGFMT_BGR32;
401 case 8: draw_alpha_fnc=draw_alpha_null; 479 break;
402 out_format= IMGFMT_BGR8; break; 480 case 15:
403 default: draw_alpha_fnc=draw_alpha_null; 481 case 16:
404 } 482 if (depth == 15)
405 483 {
406 /* always allocate swsContext as size could change between frames */ 484 draw_alpha_fnc = draw_alpha_15;
407 swsContext= sws_getContextFromCmdLine(width, height, in_format, width, height, out_format ); 485 out_format = IMGFMT_BGR15;
408 if (!swsContext) 486 } else
409 return -1; 487 {
410 488 draw_alpha_fnc = draw_alpha_16;
411 //printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask ); 489 out_format = IMGFMT_BGR16;
412 490 }
413 // If we have blue in the lowest bit then obviously RGB 491 break;
414 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; 492 case 8:
493 draw_alpha_fnc = draw_alpha_null;
494 out_format = IMGFMT_BGR8;
495 break;
496 default:
497 draw_alpha_fnc = draw_alpha_null;
498 }
499
500 /* always allocate swsContext as size could change between frames */
501 swsContext =
502 sws_getContextFromCmdLine(width, height, in_format, width, height,
503 out_format);
504 if (!swsContext)
505 return -1;
506
507 //printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask );
508
509 // If we have blue in the lowest bit then obviously RGB
510 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR;
415 #ifdef WORDS_BIGENDIAN 511 #ifdef WORDS_BIGENDIAN
416 if ( myximage->byte_order != MSBFirst ) 512 if (myximage->byte_order != MSBFirst)
417 #else 513 #else
418 if ( myximage->byte_order != LSBFirst ) 514 if (myximage->byte_order != LSBFirst)
419 #endif 515 #endif
420 { 516 {
421 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; 517 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_BGR : MODE_RGB;
422 // printf( "No support for non-native XImage byte order!\n" ); 518 // printf( "No support for non-native XImage byte order!\n" );
423 // return -1; 519 // return -1;
424 } 520 }
425
426 #ifdef WORDS_BIGENDIAN 521 #ifdef WORDS_BIGENDIAN
427 if(mode==MODE_BGR && bpp!=32){ 522 if (mode == MODE_BGR && bpp != 32)
428 mp_msg(MSGT_VO,MSGL_ERR,"BGR%d not supported, please contact the developers\n", bpp); 523 {
429 return -1; 524 mp_msg(MSGT_VO, MSGL_ERR,
430 } 525 "BGR%d not supported, please contact the developers\n",
526 bpp);
527 return -1;
528 }
431 #else 529 #else
432 if(mode==MODE_BGR){ 530 if (mode == MODE_BGR)
433 mp_msg(MSGT_VO,MSGL_ERR,"BGR not supported, please contact the developers\n"); 531 {
434 return -1; 532 mp_msg(MSGT_VO, MSGL_ERR,
435 } 533 "BGR not supported, please contact the developers\n");
436 #endif 534 return -1;
437 535 }
438 saver_off(mDisplay); 536 #endif
439 537
440 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); 538 saver_off(mDisplay);
441 539
442 return 0; 540 if (vo_ontop)
443 } 541 vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
444 542
445 static void Display_Image( XImage *myximage,uint8_t *ImageData ) 543 return 0;
544 }
545
546 static void Display_Image(XImage * myximage, uint8_t * ImageData)
446 { 547 {
447 #ifdef HAVE_SHM 548 #ifdef HAVE_SHM
448 if ( Shmem_Flag ) 549 if (Shmem_Flag)
449 { 550 {
450 XShmPutImage( mDisplay,vo_window,vo_gc,myximage, 551 XShmPutImage(mDisplay, vo_window, vo_gc, myximage,
451 0,0, 552 0, 0,
452 ( vo_dwidth - swsContext->dstW ) / 2,( vo_dheight - myximage->height ) / 2, 553 (vo_dwidth - swsContext->dstW) / 2,
453 swsContext->dstW,myximage->height,True ); 554 (vo_dheight - myximage->height) / 2, swsContext->dstW,
454 } 555 myximage->height, True);
455 else 556 } else
456 #endif 557 #endif
457 { 558 {
458 XPutImage( mDisplay,vo_window,vo_gc,myximage, 559 XPutImage(mDisplay, vo_window, vo_gc, myximage,
459 0,0, 560 0, 0,
460 ( vo_dwidth - swsContext->dstW ) / 2,( vo_dheight - myximage->height ) / 2, 561 (vo_dwidth - swsContext->dstW) / 2,
461 swsContext->dstW,myximage->height); 562 (vo_dheight - myximage->height) / 2, swsContext->dstW,
462 } 563 myximage->height);
564 }
463 } 565 }
464 566
465 static void draw_osd(void) 567 static void draw_osd(void)
466 { vo_draw_text(image_width,image_height,draw_alpha_fnc); } 568 {
467 569 vo_draw_text(image_width, image_height, draw_alpha_fnc);
468 static void flip_page( void ){ 570 }
469 Display_Image( myximage,ImageData ); 571
572 static void flip_page(void)
573 {
574 Display_Image(myximage, ImageData);
470 XSync(mDisplay, False); 575 XSync(mDisplay, False);
471 } 576 }
472 577
473 static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y ) 578 static uint32_t draw_slice(uint8_t * src[], int stride[], int w, int h,
474 { 579 int x, int y)
475 uint8_t *dst[3]; 580 {
476 int dstStride[3]; 581 uint8_t *dst[3];
477 582 int dstStride[3];
478 if((old_vo_dwidth != vo_dwidth || old_vo_dheight != vo_dheight) /*&& y==0*/ && zoomFlag) 583
479 { 584 if ((old_vo_dwidth != vo_dwidth
480 int newW= vo_dwidth; 585 || old_vo_dheight != vo_dheight) /*&& y==0 */ && zoomFlag)
481 int newH= vo_dheight; 586 {
482 int newAspect= (newW*(1<<16) + (newH>>1))/newH; 587 int newW = vo_dwidth;
483 SwsContext *oldContext= swsContext; 588 int newH = vo_dheight;
484 589 int newAspect = (newW * (1 << 16) + (newH >> 1)) / newH;
485 if(newAspect>aspect) newW= (newH*aspect + (1<<15))>>16; 590 SwsContext *oldContext = swsContext;
486 else newH= ((newW<<16) + (aspect>>1)) /aspect; 591
487 592 if (newAspect > aspect)
488 old_vo_dwidth= vo_dwidth; 593 newW = (newH * aspect + (1 << 15)) >> 16;
489 old_vo_dheight= vo_dheight; 594 else
490 595 newH = ((newW << 16) + (aspect >> 1)) / aspect;
491 if(sws_flags==0) newW&= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed 596
492 597 old_vo_dwidth = vo_dwidth;
493 swsContext= sws_getContextFromCmdLine(srcW, srcH, in_format, 598 old_vo_dheight = vo_dheight;
494 newW, newH, out_format); 599
495 if(swsContext) 600 if (sws_flags == 0)
496 { 601 newW &= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed
497 image_width= (newW+7)&(~7); 602
498 image_height= newH; 603 swsContext = sws_getContextFromCmdLine(srcW, srcH, in_format,
499 604 newW, newH, out_format);
500 freeMyXImage(); 605 if (swsContext)
501 getMyXImage(); 606 {
502 sws_freeContext(oldContext); 607 image_width = (newW + 7) & (~7);
503 } 608 image_height = newH;
504 else 609
505 { 610 freeMyXImage();
506 swsContext= oldContext; 611 getMyXImage();
507 } 612 sws_freeContext(oldContext);
508 } 613 } else
509 dstStride[1]= 614 {
510 dstStride[2]=0; 615 swsContext = oldContext;
511 dst[1]= 616 }
512 dst[2]=NULL; 617 }
513 618 dstStride[1] = dstStride[2] = 0;
514 if(Flip_Flag) 619 dst[1] = dst[2] = NULL;
515 { 620
516 dstStride[0]= -image_width*((bpp+7)/8); 621 if (Flip_Flag)
517 dst[0]=ImageData - dstStride[0]*(image_height-1); 622 {
518 sws_scale_ordered(swsContext,src,stride,y,h,dst, dstStride); 623 dstStride[0] = -image_width * ((bpp + 7) / 8);
519 } 624 dst[0] = ImageData - dstStride[0] * (image_height - 1);
520 else 625 sws_scale_ordered(swsContext, src, stride, y, h, dst, dstStride);
521 { 626 } else
522 dstStride[0]=image_width*((bpp+7)/8); 627 {
523 dst[0]=ImageData; 628 dstStride[0] = image_width * ((bpp + 7) / 8);
524 sws_scale_ordered(swsContext,src,stride,y,h,dst, dstStride); 629 dst[0] = ImageData;
525 } 630 sws_scale_ordered(swsContext, src, stride, y, h, dst, dstStride);
526 return 0; 631 }
527 } 632 return 0;
528 633 }
529 static uint32_t draw_frame( uint8_t *src[] ){ 634
635 static uint32_t draw_frame(uint8_t * src[])
636 {
530 #if 0 637 #if 0
531 int stride[3]= {0,0,0}; 638 int stride[3] = { 0, 0, 0 };
532 639
533 if (in_format==IMGFMT_YUY2) stride[0]=srcW*2; 640 if (in_format == IMGFMT_YUY2)
534 else if(in_format==IMGFMT_BGR8) stride[0]=srcW; 641 stride[0] = srcW * 2;
535 else if(in_format==IMGFMT_BGR15) stride[0]=srcW*2; 642 else if (in_format == IMGFMT_BGR8)
536 else if(in_format==IMGFMT_BGR16) stride[0]=srcW*2; 643 stride[0] = srcW;
537 else if(in_format==IMGFMT_BGR24) stride[0]=srcW*3; 644 else if (in_format == IMGFMT_BGR15)
538 else if(in_format==IMGFMT_BGR32) stride[0]=srcW*4; 645 stride[0] = srcW * 2;
539 646 else if (in_format == IMGFMT_BGR16)
540 return draw_slice(src, stride, srcW, srcH, 0, 0); 647 stride[0] = srcW * 2;
648 else if (in_format == IMGFMT_BGR24)
649 stride[0] = srcW * 3;
650 else if (in_format == IMGFMT_BGR32)
651 stride[0] = srcW * 4;
652
653 return draw_slice(src, stride, srcW, srcH, 0, 0);
541 #else 654 #else
542 printf("draw_frame() called!!!!!!\n"); 655 printf("draw_frame() called!!!!!!\n");
543 return -1; 656 return -1;
544 #endif 657 #endif
545 } 658 }
546 659
547 static uint32_t get_image(mp_image_t *mpi) 660 static uint32_t get_image(mp_image_t * mpi)
548 { 661 {
549 if (zoomFlag || 662 if (zoomFlag ||
550 !IMGFMT_IS_BGR(mpi->imgfmt) || 663 !IMGFMT_IS_BGR(mpi->imgfmt) ||
551 (IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_depthonscreen) || 664 (IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_depthonscreen) ||
552 ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || 665 ((mpi->type != MP_IMGTYPE_STATIC)
553 (mpi->flags & MP_IMGFLAG_PLANAR) || 666 && (mpi->type != MP_IMGTYPE_TEMP))
554 (mpi->flags & MP_IMGFLAG_YUV) || 667 || (mpi->flags & MP_IMGFLAG_PLANAR)
555 (mpi->width != image_width) || 668 || (mpi->flags & MP_IMGFLAG_YUV) || (mpi->width != image_width)
556 (mpi->height != image_height) 669 || (mpi->height != image_height))
557 ) 670 return (VO_FALSE);
558 return(VO_FALSE);
559 671
560 if (Flip_Flag) 672 if (Flip_Flag)
561 { 673 {
562 mpi->stride[0] = -image_width*((bpp+7)/8); 674 mpi->stride[0] = -image_width * ((bpp + 7) / 8);
563 mpi->planes[0] = ImageData - mpi->stride[0]*(image_height-1); 675 mpi->planes[0] = ImageData - mpi->stride[0] * (image_height - 1);
564 } 676 } else
565 else 677 {
566 { 678 mpi->stride[0] = image_width * ((bpp + 7) / 8);
567 mpi->stride[0] = image_width*((bpp+7)/8); 679 mpi->planes[0] = ImageData;
568 mpi->planes[0] = ImageData;
569 } 680 }
570 mpi->flags |= MP_IMGFLAG_DIRECT; 681 mpi->flags |= MP_IMGFLAG_DIRECT;
571 682
572 return(VO_TRUE); 683 return (VO_TRUE);
573 } 684 }
574 685
575 static uint32_t query_format( uint32_t format ) 686 static uint32_t query_format(uint32_t format)
576 { 687 {
577 mp_msg(MSGT_VO,MSGL_DBG2,"vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); 688 mp_msg(MSGT_VO, MSGL_DBG2,
689 "vo_x11: query_format was called: %x (%s)\n", format,
690 vo_format_name(format));
578 if (IMGFMT_IS_BGR(format)) 691 if (IMGFMT_IS_BGR(format))
579 { 692 {
580 if (IMGFMT_BGR_DEPTH(format) <= 8) 693 if (IMGFMT_BGR_DEPTH(format) <= 8)
581 return 0; // TODO 8bpp not yet fully implemented 694 return 0; // TODO 8bpp not yet fully implemented
582 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen) 695 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen)
583 return 3|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP|VFCAP_ACCEPT_STRIDE; 696 return 3 | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_FLIP |
584 else 697 VFCAP_ACCEPT_STRIDE;
585 return 1|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP|VFCAP_ACCEPT_STRIDE; 698 else
586 } 699 return 1 | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_FLIP |
587 700 VFCAP_ACCEPT_STRIDE;
588 switch( format ) 701 }
589 { 702
703 switch (format)
704 {
590 // case IMGFMT_BGR8: 705 // case IMGFMT_BGR8:
591 // case IMGFMT_BGR15: 706 // case IMGFMT_BGR15:
592 // case IMGFMT_BGR16: 707 // case IMGFMT_BGR16:
593 // case IMGFMT_BGR24: 708 // case IMGFMT_BGR24:
594 // case IMGFMT_BGR32: 709 // case IMGFMT_BGR32:
595 // return 0x2; 710 // return 0x2;
596 // case IMGFMT_YUY2: 711 // case IMGFMT_YUY2:
597 case IMGFMT_I420: 712 case IMGFMT_I420:
598 case IMGFMT_IYUV: 713 case IMGFMT_IYUV:
599 case IMGFMT_YV12: 714 case IMGFMT_YV12:
600 return 1|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_ACCEPT_STRIDE; 715 return 1 | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE;
601 } 716 }
602 return 0; 717 return 0;
603 } 718 }
604 719
605 720
606 static void uninit(void) 721 static void uninit(void)
607 { 722 {
608 if(!myximage) return; 723 if (!myximage)
609 724 return;
610 freeMyXImage(); 725
611 saver_on(mDisplay); // screen saver back on 726 freeMyXImage();
727 saver_on(mDisplay); // screen saver back on
612 728
613 #ifdef HAVE_XF86VM 729 #ifdef HAVE_XF86VM
614 vo_vm_close(mDisplay); 730 vo_vm_close(mDisplay);
615 #endif 731 #endif
616 732
617 zoomFlag=0; 733 zoomFlag = 0;
618 vo_x11_uninit(); 734 vo_x11_uninit();
619 735
620 sws_freeContext(swsContext); 736 sws_freeContext(swsContext);
621 } 737 }
622 738
623 static uint32_t preinit(const char *arg) 739 static uint32_t preinit(const char *arg)
624 { 740 {
625 if(arg) 741 if (arg)
626 { 742 {
627 mp_msg(MSGT_VO,MSGL_ERR,"vo_x11: Unknown subdevice: %s\n",arg); 743 mp_msg(MSGT_VO, MSGL_ERR, "vo_x11: Unknown subdevice: %s\n", arg);
628 return ENOSYS; 744 return ENOSYS;
629 } 745 }
630 746
631 if( !vo_init() ) return -1; // Can't open X11 747 if (!vo_init())
748 return -1; // Can't open X11
632 return 0; 749 return 0;
633 } 750 }
634 751
635 static uint32_t control(uint32_t request, void *data, ...) 752 static uint32_t control(uint32_t request, void *data, ...)
636 { 753 {
637 switch (request) { 754 switch (request)
638 case VOCTRL_PAUSE: return (int_pause=1); 755 {
639 case VOCTRL_RESUME: return (int_pause=0); 756 case VOCTRL_PAUSE:
640 case VOCTRL_QUERY_FORMAT: 757 return (int_pause = 1);
641 return query_format(*((uint32_t*)data)); 758 case VOCTRL_RESUME:
642 case VOCTRL_GUISUPPORT: 759 return (int_pause = 0);
643 return VO_TRUE; 760 case VOCTRL_QUERY_FORMAT:
644 case VOCTRL_GET_IMAGE: 761 return query_format(*((uint32_t *) data));
645 return get_image(data); 762 case VOCTRL_GUISUPPORT:
646 case VOCTRL_SET_EQUALIZER: 763 return VO_TRUE;
647 { 764 case VOCTRL_GET_IMAGE:
648 va_list ap; 765 return get_image(data);
649 int value; 766 case VOCTRL_SET_EQUALIZER:
650 va_start(ap, data); 767 {
651 value = va_arg(ap, int); 768 va_list ap;
652 va_end(ap); 769 int value;
653 return vo_x11_set_equalizer(data, value); 770
654 } 771 va_start(ap, data);
655 case VOCTRL_GET_EQUALIZER: 772 value = va_arg(ap, int);
656 { 773
657 va_list ap; 774 va_end(ap);
658 int *value; 775 return vo_x11_set_equalizer(data, value);
659 va_start(ap, data); 776 }
660 value = va_arg(ap, int *); 777 case VOCTRL_GET_EQUALIZER:
661 va_end(ap); 778 {
662 return vo_x11_get_equalizer(data, value); 779 va_list ap;
663 } 780 int *value;
664 case VOCTRL_ONTOP: 781
665 vo_x11_ontop(); 782 va_start(ap, data);
666 return VO_TRUE; 783 value = va_arg(ap, int *);
667 case VOCTRL_FULLSCREEN: 784
668 { 785 va_end(ap);
669 vo_x11_fullscreen(); 786 return vo_x11_get_equalizer(data, value);
670 vo_x11_clearwindow(mDisplay, vo_window); 787 }
671 } 788 case VOCTRL_ONTOP:
672 return VO_TRUE; 789 vo_x11_ontop();
673 } 790 return VO_TRUE;
674 return VO_NOTIMPL; 791 case VOCTRL_FULLSCREEN:
675 } 792 {
793 vo_x11_fullscreen();
794 vo_x11_clearwindow(mDisplay, vo_window);
795 }
796 return VO_TRUE;
797 }
798 return VO_NOTIMPL;
799 }