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