Mercurial > mplayer.hg
annotate libvo/vo_gl.c @ 4302:9f12fd5f47d0
Modified the cache option value setting/reading, so we can report
in any case the cache size value used.
author | bertrand |
---|---|
date | Tue, 22 Jan 2002 06:12:18 +0000 |
parents | 21a75ab24703 |
children | ed5b85b713a3 |
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> | |
2732 | 31 #include "../postproc/rgb2rgb.h" |
1 | 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); |
4017 | 184 #ifdef HAVE_XINERAMA |
185 vo_x11_xinerama_move(mDisplay,mywindow); | |
186 #endif | |
1 | 187 |
188 /* Wait for map. */ | |
189 do | |
190 { | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
191 XNextEvent(mDisplay, &xev); |
1 | 192 } |
193 while (xev.type != MapNotify || xev.xmap.event != mywindow); | |
194 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
195 XSelectInput(mDisplay, mywindow, NoEventMask); |
1 | 196 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
197 glXMakeCurrent( mDisplay,mywindow,wsGLXContext ); |
1 | 198 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
199 XFlush(mDisplay); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
200 XSync(mDisplay, False); |
1 | 201 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
202 // mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv); |
1 | 203 |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
204 // myximage = XGetImage(mDisplay, mywindow, 0, 0, |
1 | 205 // width, image_height, AllPlanes, ZPixmap); |
206 // ImageData = myximage->data; | |
207 // bpp = myximage->bits_per_pixel; | |
208 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
209 //XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!! |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
210 XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask ); |
1 | 211 |
212 // printf("Window setup ok\n"); | |
213 | |
214 #if 0 | |
215 // If we have blue in the lowest bit then obviously RGB | |
216 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR; | |
217 #ifdef WORDS_BIGENDIAN | |
218 if (myximage->byte_order != MSBFirst) | |
219 #else | |
220 if (myximage->byte_order != LSBFirst) | |
221 #endif | |
222 { | |
1302 | 223 printf("[gl] no support for non-native XImage byte order!\n"); |
1 | 224 return -1; |
225 } | |
226 | |
227 printf("DEPTH=%d BPP=%d\n",depth,bpp); | |
228 #endif | |
229 | |
230 /* | |
231 * If depth is 24 then it may either be a 3 or 4 byte per pixel | |
232 * format. We can't use bpp because then we would lose the | |
233 * distinction between 15/16bit depth (2 byte formate assumed). | |
234 * | |
235 * FIXME - change yuv2rgb_init to take both depth and bpp | |
236 * parameters | |
237 */ | |
238 | |
239 texture_width=32; | |
240 while(texture_width<image_width) texture_width*=2; | |
241 while(texture_width<image_height) texture_width*=2; | |
242 texture_height=texture_width; | |
243 | |
244 if(format==IMGFMT_YV12){ | |
245 yuv2rgb_init(8*BYTES_PP, MODE_BGR); | |
1290 | 246 printf("[gl] YUV init OK!\n"); |
1 | 247 image_bpp=8*BYTES_PP; |
248 image_bytes=BYTES_PP; | |
249 } else { | |
250 image_bpp=format&0xFF; | |
251 image_bytes=(image_bpp+7)/8; | |
252 } | |
253 | |
254 ImageData=malloc(texture_width*texture_height*image_bytes); | |
255 memset(ImageData,128,texture_width*texture_height*image_bytes); | |
256 | |
257 glDisable(GL_BLEND); | |
258 glDisable(GL_DEPTH_TEST); | |
259 glDepthMask(GL_FALSE); | |
260 glDisable(GL_CULL_FACE); | |
261 | |
262 glEnable(GL_TEXTURE_2D); | |
263 | |
1290 | 264 printf("[gl] Creating %dx%d texture...\n",texture_width,texture_height); |
1 | 265 |
266 #if 1 | |
267 // glBindTexture(GL_TEXTURE_2D, texture_id); | |
268 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
269 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
270 #ifdef TEXTUREFORMAT_32BPP | |
271 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture_width, texture_height, 0, | |
272 #else | |
273 glTexImage2D(GL_TEXTURE_2D, 0, BYTES_PP, texture_width, texture_height, 0, | |
274 #endif | |
275 (image_bytes==4)?GL_RGBA:GL_BGR, GL_UNSIGNED_BYTE, ImageData); | |
276 #endif | |
277 | |
278 resize(d_width,d_height); | |
279 | |
280 glClearColor( 1.0f,0.0f,1.0f,0.0f ); | |
281 glClear( GL_COLOR_BUFFER_BIT ); | |
282 | |
283 // printf("OpenGL setup OK!\n"); | |
284 | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
285 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
|
286 |
1 | 287 return 0; |
288 } | |
289 | |
290 static const vo_info_t* | |
291 get_info(void) | |
292 { | |
293 return &vo_info; | |
294 } | |
295 | |
296 static void | |
297 Terminate_Display_Process(void) | |
298 { | |
299 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
|
300 XDestroyWindow(mDisplay, mywindow); |
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
301 XCloseDisplay(mDisplay); |
1 | 302 X_already_started = 0; |
303 } | |
304 | |
31 | 305 |
306 static void check_events(void) | |
1 | 307 { |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
308 int e=vo_x11_check_events(mDisplay); |
31 | 309 if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); |
310 } | |
1 | 311 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
312 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
313 { |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1302
diff
changeset
|
314 } |
31 | 315 |
316 static void | |
317 flip_page(void) | |
318 { | |
319 | |
1 | 320 // glEnable(GL_TEXTURE_2D); |
321 // glBindTexture(GL_TEXTURE_2D, texture_id); | |
322 | |
323 glColor3f(1,1,1); | |
324 glBegin(GL_QUADS); | |
325 glTexCoord2f(0,0);glVertex2i(0,0); | |
326 glTexCoord2f(0,1);glVertex2i(0,texture_height); | |
327 glTexCoord2f(1,1);glVertex2i(texture_width,texture_height); | |
328 glTexCoord2f(1,0);glVertex2i(texture_width,0); | |
329 glEnd(); | |
330 | |
331 // glFlush(); | |
332 glFinish(); | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
333 glXSwapBuffers( mDisplay,mywindow ); |
1 | 334 |
335 } | |
336 | |
337 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num) | |
338 static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) | |
339 { | |
340 int i; | |
341 int dstride=w*BYTES_PP; | |
342 | |
343 // dstride=(dstride+15)&(~15); | |
344 | |
345 yuv2rgb(ImageData, src[0], src[1], src[2], | |
346 w,h, dstride, stride[0],stride[1]); | |
347 | |
348 // emms (); | |
349 | |
350 for(i=0;i<h;i++){ | |
351 glTexSubImage2D( GL_TEXTURE_2D, // target | |
352 0, // level | |
353 x, // x offset | |
354 y+i, // y offset | |
355 w, // width | |
356 1, // height | |
357 (BYTES_PP==4)?GL_RGBA:GL_RGB, // format | |
358 GL_UNSIGNED_BYTE, // type | |
359 ImageData+i*dstride ); // *pixels | |
360 } | |
361 | |
362 return 0; | |
363 } | |
364 | |
365 static inline uint32_t | |
366 draw_frame_x11_yv12(uint8_t *src[]) | |
367 { | |
368 int i; | |
369 // printf("Converting YUV->RGB...\n"); | |
370 yuv2rgb(ImageData, src[0], src[1], src[2], | |
371 image_width, image_height, | |
372 image_width*BYTES_PP, image_width, image_width/2 ); | |
373 // printf("Ready!\n"); | |
374 | |
375 // emms (); | |
376 | |
377 for(i=0;i<image_height;i++){ | |
378 glTexSubImage2D( GL_TEXTURE_2D, // target | |
379 0, // level | |
380 0, // x offset | |
381 i, // y offset | |
382 image_width, // width | |
383 1, // height | |
384 (BYTES_PP==4)?GL_RGBA:GL_RGB, // format | |
385 GL_UNSIGNED_BYTE, // type | |
386 ImageData+i*BYTES_PP*image_width ); // *pixels | |
387 } | |
388 | |
389 // Display_Image(ImageData); | |
390 return 0; | |
391 } | |
392 | |
393 | |
394 static inline uint32_t | |
395 draw_frame_x11_bgr(uint8_t *src[]) | |
396 { | |
397 int i; | |
398 uint8_t *s=src[0]; | |
399 uint8_t *de=&ImageData[3*image_width]; | |
400 | |
401 for(i=0;i<image_height;i++){ | |
402 uint8_t *d=ImageData; | |
403 while(d<de){ | |
404 d[0]=s[2]; | |
405 d[1]=s[1]; | |
406 d[2]=s[0]; | |
407 s+=3;d+=3; | |
408 } | |
409 glTexSubImage2D( GL_TEXTURE_2D, // target | |
410 0, // level | |
411 0, // x offset | |
412 // image_height-1-i, // y offset | |
413 i, // y offset | |
414 image_width, // width | |
415 1, // height | |
416 (image_bytes==4)?GL_RGBA:GL_RGB, // format | |
417 GL_UNSIGNED_BYTE, // type | |
418 ImageData); // *pixels | |
419 } | |
420 | |
421 // Display_Image(ImageData); | |
422 return 0; | |
423 } | |
424 | |
425 static inline uint32_t | |
426 draw_frame_x11_rgb(uint8_t *src[]) | |
427 { | |
428 int i; | |
429 uint8_t *ImageData=src[0]; | |
430 | |
431 for(i=0;i<image_height;i++){ | |
432 glTexSubImage2D( GL_TEXTURE_2D, // target | |
433 0, // level | |
434 0, // x offset | |
435 // image_height-1-i, // y offset | |
436 i, // y offset | |
437 image_width, // width | |
438 1, // height | |
439 (image_bytes==4)?GL_RGBA:GL_RGB, // format | |
440 GL_UNSIGNED_BYTE, // type | |
441 ImageData+i*image_bytes*image_width ); // *pixels | |
442 } | |
443 | |
444 // Display_Image(ImageData); | |
445 return 0; | |
446 } | |
447 | |
448 | |
449 static uint32_t | |
450 draw_frame(uint8_t *src[]) | |
451 { | |
452 if(image_format==IMGFMT_YV12) | |
453 return draw_frame_x11_yv12(src); | |
454 else | |
455 if((image_format&IMGFMT_RGB_MASK)==IMGFMT_RGB) | |
456 return draw_frame_x11_rgb(src); | |
457 else | |
458 return draw_frame_x11_bgr(src); | |
459 } | |
460 | |
461 static uint32_t | |
462 query_format(uint32_t format) | |
463 { | |
464 switch(format){ | |
465 case IMGFMT_YV12: | |
466 case IMGFMT_RGB|24: | |
467 case IMGFMT_BGR|24: | |
468 return 1; | |
469 } | |
470 return 0; | |
471 } | |
472 | |
473 | |
474 static void | |
475 uninit(void) | |
476 { | |
2041
ba8a225d1a18
now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents:
2040
diff
changeset
|
477 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
|
478 XDestroyWindow( mDisplay,mywindow ); |
1 | 479 } |