Mercurial > mplayer.hg
annotate libvo/vo_gl.c @ 2653:a863a97f3a1c
WMP compatibility fixed
author | arpi |
---|---|
date | Sat, 03 Nov 2001 21:00:04 +0000 |
parents | 48f0ac1e9d13 |
children | ae79207a3055 |
rev | line source |
---|---|
1 | 1 #define DISP |
2 | |
3 // this can be 3 or 4 (regarding 24bpp and 32bpp) | |
4 #define BYTES_PP 3 | |
5 | |
6 #define TEXTUREFORMAT_32BPP | |
7 | |
8 /* | |
9 * video_out_gl.c, X11/OpenGL interface | |
10 * based on video_out_x11 by Aaron Holtzman, | |
11 * and WS opengl window manager by Pontscho/Fresh! | |
12 */ | |
13 | |
14 #include <stdio.h> | |
15 #include <stdlib.h> | |
16 #include <string.h> | |
17 #include <math.h> | |
18 | |
19 #include "config.h" | |
20 #include "video_out.h" | |
21 #include "video_out_internal.h" | |
22 | |
23 | |
24 LIBVO_EXTERN(gl) | |
25 | |
26 #include <X11/Xlib.h> | |
27 #include <X11/Xutil.h> | |
28 //#include <X11/keysym.h> | |
29 #include <GL/glx.h> | |
30 #include <errno.h> | |
31 #include "yuv2rgb.h" | |
32 | |
33 #include <GL/gl.h> | |
34 | |
31 | 35 #include "x11_common.h" |
2057 | 36 #include "aspect.h" |
31 | 37 |
1 | 38 static vo_info_t vo_info = |
39 { | |
40 "X11 (OpenGL)", | |
41 "gl", | |
42 "Arpad Gereoffy <arpi@esp-team.scene.hu>", | |
43 "" | |
44 }; | |
45 | |
46 /* private prototypes */ | |
1109 | 47 // static void Display_Image (unsigned char *ImageData); |
1 | 48 |
49 /* local data */ | |
50 static unsigned char *ImageData=NULL; | |
51 | |
52 /* X11 related variables */ | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
53 //static Display *mydisplay; |
1 | 54 static Window mywindow; |
55 //static GC mygc; | |
56 //static XImage *myximage; | |
57 //static int depth,mode; | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
58 //static XWindowAttributes attribs; |
1 | 59 static int X_already_started = 0; |
60 | |
1109 | 61 //static int texture_id=1; |
1 | 62 |
63 static GLXContext wsGLXContext; | |
64 //XVisualInfo * wsVisualInfo; | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
65 static int wsGLXAttrib[] = { GLX_RGBA, |
1 | 66 GLX_RED_SIZE,1, |
67 GLX_GREEN_SIZE,1, | |
68 GLX_BLUE_SIZE,1, | |
69 // GLX_DEPTH_SIZE,16, | |
70 GLX_DOUBLEBUFFER, | |
71 None }; | |
72 | |
73 | |
74 static uint32_t image_width; | |
75 static uint32_t image_height; | |
76 static uint32_t image_format; | |
77 static uint32_t image_bpp; | |
78 static uint32_t image_bytes; | |
79 | |
80 static uint32_t texture_width; | |
81 static uint32_t texture_height; | |
82 | |
612 | 83 static void resize(int x,int y){ |
1290 | 84 printf("[gl] Resize: %dx%d\n",x,y); |
1 | 85 glViewport( 0, 0, x, y ); |
86 | |
87 glMatrixMode(GL_PROJECTION); | |
88 glLoadIdentity(); | |
89 glOrtho(0, image_width, image_height, 0, -1,1); | |
90 | |
91 glMatrixMode(GL_MODELVIEW); | |
92 glLoadIdentity(); | |
93 } | |
94 | |
95 /* connect to server, create and map window, | |
96 * allocate colors and (shared) memory | |
97 */ | |
98 static uint32_t | |
2057 | 99 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
1 | 100 { |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
101 // int screen; |
1 | 102 unsigned int fg, bg; |
103 char *hello = (title == NULL) ? "OpenGL rulez" : title; | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
104 // char *name = ":0.0"; |
1 | 105 XSizeHints hint; |
106 XVisualInfo *vinfo; | |
107 XEvent xev; | |
108 | |
1109 | 109 // XGCValues xgcv; |
1 | 110 XSetWindowAttributes xswa; |
111 unsigned long xswamask; | |
112 | |
113 image_height = height; | |
114 image_width = width; | |
115 image_format = format; | |
116 | |
117 if (X_already_started) return -1; | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
118 if(!vo_init()) return -1; |
1 | 119 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
120 aspect_save_orig(width,height); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
121 aspect_save_prescale(d_width,d_height); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
122 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
123 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
124 X_already_started++; |
1 | 125 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
126 aspect(&d_width,&d_height,A_NOZOOM); |
2040 | 127 #ifdef X11_FULLSCREEN |
2057 | 128 if( flags&0x01 ){ // (-fs) |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2057
diff
changeset
|
129 aspect(&d_width,&d_height,A_ZOOM); |
2040 | 130 } |
131 #endif | |
1 | 132 hint.x = 0; |
133 hint.y = 0; | |
134 hint.width = d_width; | |
135 hint.height = d_height; | |
136 hint.flags = PPosition | PSize; | |
137 | |
138 /* Get some colors */ | |
139 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
140 bg = WhitePixel(mDisplay, mScreen); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
141 fg = BlackPixel(mDisplay, mScreen); |
1 | 142 |
143 /* Make the window */ | |
144 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
145 // XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
1 | 146 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
147 // XMatchVisualInfo(mDisplay, screen, depth, TrueColor, &vinfo); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
148 vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); |
1290 | 149 if (vinfo == NULL) |
150 { | |
151 printf("[gl] no GLX support present\n"); | |
152 return -1; | |
153 } | |
1 | 154 |
155 xswa.background_pixel = 0; | |
156 xswa.border_pixel = 1; | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
157 // xswa.colormap = XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
158 xswa.colormap = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone); |
1 | 159 xswamask = CWBackPixel | CWBorderPixel | CWColormap; |
160 // xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWCursor | CWOverrideRedirect | CWSaveUnder | CWX | CWY | CWWidth | CWHeight; | |
161 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
162 mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen), |
1 | 163 hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa); |
1137
4c7b219e126c
patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents:
1109
diff
changeset
|
164 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
165 vo_x11_classhint( mDisplay,mywindow,"gl" ); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
166 vo_hidecursor(mDisplay,mywindow); |
1 | 167 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
168 wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True ); |
1 | 169 // XStoreName( wsDisplay,wsMyWin,wsSysName ); |
170 | |
171 // printf("GLXcontext ok\n"); | |
172 | |
2057 | 173 if ( flags&0x01 ) vo_x11_decoration( mDisplay,mywindow,0 ); |
1 | 174 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
175 XSelectInput(mDisplay, mywindow, StructureNotifyMask); |
1 | 176 |
177 /* Tell other applications about this window */ | |
178 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
179 XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint); |
1 | 180 |
181 /* Map window. */ | |
182 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
183 XMapWindow(mDisplay, mywindow); |
1 | 184 |
185 /* Wait for map. */ | |
186 do | |
187 { | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
188 XNextEvent(mDisplay, &xev); |
1 | 189 } |
190 while (xev.type != MapNotify || xev.xmap.event != mywindow); | |
191 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
192 XSelectInput(mDisplay, mywindow, NoEventMask); |
1 | 193 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
194 glXMakeCurrent( mDisplay,mywindow,wsGLXContext ); |
1 | 195 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
196 XFlush(mDisplay); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
197 XSync(mDisplay, False); |
1 | 198 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
199 // mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv); |
1 | 200 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
201 // myximage = XGetImage(mDisplay, mywindow, 0, 0, |
1 | 202 // width, image_height, AllPlanes, ZPixmap); |
203 // ImageData = myximage->data; | |
204 // bpp = myximage->bits_per_pixel; | |
205 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
206 //XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!! |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
207 XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask ); |
1 | 208 |
209 // printf("Window setup ok\n"); | |
210 | |
211 #if 0 | |
212 // If we have blue in the lowest bit then obviously RGB | |
213 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR; | |
214 #ifdef WORDS_BIGENDIAN | |
215 if (myximage->byte_order != MSBFirst) | |
216 #else | |
217 if (myximage->byte_order != LSBFirst) | |
218 #endif | |
219 { | |
1302 | 220 printf("[gl] no support for non-native XImage byte order!\n"); |
1 | 221 return -1; |
222 } | |
223 | |
224 printf("DEPTH=%d BPP=%d\n",depth,bpp); | |
225 #endif | |
226 | |
227 /* | |
228 * If depth is 24 then it may either be a 3 or 4 byte per pixel | |
229 * format. We can't use bpp because then we would lose the | |
230 * distinction between 15/16bit depth (2 byte formate assumed). | |
231 * | |
232 * FIXME - change yuv2rgb_init to take both depth and bpp | |
233 * parameters | |
234 */ | |
235 | |
236 texture_width=32; | |
237 while(texture_width<image_width) texture_width*=2; | |
238 while(texture_width<image_height) texture_width*=2; | |
239 texture_height=texture_width; | |
240 | |
241 if(format==IMGFMT_YV12){ | |
242 yuv2rgb_init(8*BYTES_PP, MODE_BGR); | |
1290 | 243 printf("[gl] YUV init OK!\n"); |
1 | 244 image_bpp=8*BYTES_PP; |
245 image_bytes=BYTES_PP; | |
246 } else { | |
247 image_bpp=format&0xFF; | |
248 image_bytes=(image_bpp+7)/8; | |
249 } | |
250 | |
251 ImageData=malloc(texture_width*texture_height*image_bytes); | |
252 memset(ImageData,128,texture_width*texture_height*image_bytes); | |
253 | |
254 glDisable(GL_BLEND); | |
255 glDisable(GL_DEPTH_TEST); | |
256 glDepthMask(GL_FALSE); | |
257 glDisable(GL_CULL_FACE); | |
258 | |
259 glEnable(GL_TEXTURE_2D); | |
260 | |
1290 | 261 printf("[gl] Creating %dx%d texture...\n",texture_width,texture_height); |
1 | 262 |
263 #if 1 | |
264 // glBindTexture(GL_TEXTURE_2D, texture_id); | |
265 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
266 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
267 #ifdef TEXTUREFORMAT_32BPP | |
268 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture_width, texture_height, 0, | |
269 #else | |
270 glTexImage2D(GL_TEXTURE_2D, 0, BYTES_PP, texture_width, texture_height, 0, | |
271 #endif | |
272 (image_bytes==4)?GL_RGBA:GL_BGR, GL_UNSIGNED_BYTE, ImageData); | |
273 #endif | |
274 | |
275 resize(d_width,d_height); | |
276 | |
277 glClearColor( 1.0f,0.0f,1.0f,0.0f ); | |
278 glClear( GL_COLOR_BUFFER_BIT ); | |
279 | |
280 // printf("OpenGL setup OK!\n"); | |
281 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
282 saver_off(mDisplay); // turning off screen saver |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
283 |
1 | 284 return 0; |
285 } | |
286 | |
287 static const vo_info_t* | |
288 get_info(void) | |
289 { | |
290 return &vo_info; | |
291 } | |
292 | |
293 static void | |
294 Terminate_Display_Process(void) | |
295 { | |
296 getchar(); /* wait for enter to remove window */ | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
297 XDestroyWindow(mDisplay, mywindow); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
298 XCloseDisplay(mDisplay); |
1 | 299 X_already_started = 0; |
300 } | |
301 | |
31 | 302 |
303 static void check_events(void) | |
1 | 304 { |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
305 int e=vo_x11_check_events(mDisplay); |
31 | 306 if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); |
307 } | |
1 | 308 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
309 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
310 { |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
311 } |
31 | 312 |
313 static void | |
314 flip_page(void) | |
315 { | |
316 | |
1 | 317 // glEnable(GL_TEXTURE_2D); |
318 // glBindTexture(GL_TEXTURE_2D, texture_id); | |
319 | |
320 glColor3f(1,1,1); | |
321 glBegin(GL_QUADS); | |
322 glTexCoord2f(0,0);glVertex2i(0,0); | |
323 glTexCoord2f(0,1);glVertex2i(0,texture_height); | |
324 glTexCoord2f(1,1);glVertex2i(texture_width,texture_height); | |
325 glTexCoord2f(1,0);glVertex2i(texture_width,0); | |
326 glEnd(); | |
327 | |
328 // glFlush(); | |
329 glFinish(); | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
330 glXSwapBuffers( mDisplay,mywindow ); |
1 | 331 |
332 } | |
333 | |
334 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num) | |
335 static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) | |
336 { | |
337 int i; | |
338 int dstride=w*BYTES_PP; | |
339 | |
340 // dstride=(dstride+15)&(~15); | |
341 | |
342 yuv2rgb(ImageData, src[0], src[1], src[2], | |
343 w,h, dstride, stride[0],stride[1]); | |
344 | |
345 // emms (); | |
346 | |
347 for(i=0;i<h;i++){ | |
348 glTexSubImage2D( GL_TEXTURE_2D, // target | |
349 0, // level | |
350 x, // x offset | |
351 y+i, // y offset | |
352 w, // width | |
353 1, // height | |
354 (BYTES_PP==4)?GL_RGBA:GL_RGB, // format | |
355 GL_UNSIGNED_BYTE, // type | |
356 ImageData+i*dstride ); // *pixels | |
357 } | |
358 | |
359 return 0; | |
360 } | |
361 | |
362 static inline uint32_t | |
363 draw_frame_x11_yv12(uint8_t *src[]) | |
364 { | |
365 int i; | |
366 // printf("Converting YUV->RGB...\n"); | |
367 yuv2rgb(ImageData, src[0], src[1], src[2], | |
368 image_width, image_height, | |
369 image_width*BYTES_PP, image_width, image_width/2 ); | |
370 // printf("Ready!\n"); | |
371 | |
372 // emms (); | |
373 | |
374 for(i=0;i<image_height;i++){ | |
375 glTexSubImage2D( GL_TEXTURE_2D, // target | |
376 0, // level | |
377 0, // x offset | |
378 i, // y offset | |
379 image_width, // width | |
380 1, // height | |
381 (BYTES_PP==4)?GL_RGBA:GL_RGB, // format | |
382 GL_UNSIGNED_BYTE, // type | |
383 ImageData+i*BYTES_PP*image_width ); // *pixels | |
384 } | |
385 | |
386 // Display_Image(ImageData); | |
387 return 0; | |
388 } | |
389 | |
390 | |
391 static inline uint32_t | |
392 draw_frame_x11_bgr(uint8_t *src[]) | |
393 { | |
394 int i; | |
395 uint8_t *s=src[0]; | |
396 uint8_t *de=&ImageData[3*image_width]; | |
397 | |
398 for(i=0;i<image_height;i++){ | |
399 uint8_t *d=ImageData; | |
400 while(d<de){ | |
401 d[0]=s[2]; | |
402 d[1]=s[1]; | |
403 d[2]=s[0]; | |
404 s+=3;d+=3; | |
405 } | |
406 glTexSubImage2D( GL_TEXTURE_2D, // target | |
407 0, // level | |
408 0, // x offset | |
409 // image_height-1-i, // y offset | |
410 i, // y offset | |
411 image_width, // width | |
412 1, // height | |
413 (image_bytes==4)?GL_RGBA:GL_RGB, // format | |
414 GL_UNSIGNED_BYTE, // type | |
415 ImageData); // *pixels | |
416 } | |
417 | |
418 // Display_Image(ImageData); | |
419 return 0; | |
420 } | |
421 | |
422 static inline uint32_t | |
423 draw_frame_x11_rgb(uint8_t *src[]) | |
424 { | |
425 int i; | |
426 uint8_t *ImageData=src[0]; | |
427 | |
428 for(i=0;i<image_height;i++){ | |
429 glTexSubImage2D( GL_TEXTURE_2D, // target | |
430 0, // level | |
431 0, // x offset | |
432 // image_height-1-i, // y offset | |
433 i, // y offset | |
434 image_width, // width | |
435 1, // height | |
436 (image_bytes==4)?GL_RGBA:GL_RGB, // format | |
437 GL_UNSIGNED_BYTE, // type | |
438 ImageData+i*image_bytes*image_width ); // *pixels | |
439 } | |
440 | |
441 // Display_Image(ImageData); | |
442 return 0; | |
443 } | |
444 | |
445 | |
446 static uint32_t | |
447 draw_frame(uint8_t *src[]) | |
448 { | |
449 if(image_format==IMGFMT_YV12) | |
450 return draw_frame_x11_yv12(src); | |
451 else | |
452 if((image_format&IMGFMT_RGB_MASK)==IMGFMT_RGB) | |
453 return draw_frame_x11_rgb(src); | |
454 else | |
455 return draw_frame_x11_bgr(src); | |
456 } | |
457 | |
458 static uint32_t | |
459 query_format(uint32_t format) | |
460 { | |
461 switch(format){ | |
462 case IMGFMT_YV12: | |
463 case IMGFMT_RGB|24: | |
464 case IMGFMT_BGR|24: | |
465 return 1; | |
466 } | |
467 return 0; | |
468 } | |
469 | |
470 | |
471 static void | |
472 uninit(void) | |
473 { | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
474 saver_on(mDisplay); // screen saver back on |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
475 XDestroyWindow( mDisplay,mywindow ); |
1 | 476 } |