Mercurial > mplayer.hg
comparison libvo/vo_ggi.c @ 15406:04c47e9acab3
- make use of libggiwmh if found by configure
* For now use it to set the window title
* Implement "Window-On-Top" (experimental)
- Improved dirty region handling introduced in rev 1.33.
- other minor fixes
patch by Christoph Egger <Christoph_Egger at gmx dot de>
author | diego |
---|---|
date | Wed, 11 May 2005 08:04:13 +0000 |
parents | db06e2acdf3d |
children | fd51fd1ff231 |
comparison
equal
deleted
inserted
replaced
15405:93ae97c2de4c | 15406:04c47e9acab3 |
---|---|
33 | 33 |
34 #include "fastmemcpy.h" | 34 #include "fastmemcpy.h" |
35 | 35 |
36 #include <ggi/ggi.h> | 36 #include <ggi/ggi.h> |
37 | 37 |
38 #ifdef HAVE_GGIWMH | |
39 #include <ggi/wmh.h> | |
40 #endif | |
41 | |
42 #ifdef HAVE_GGIWMH | |
43 extern int vo_ontop; /* Window on top */ | |
44 #endif | |
45 | |
38 /* maximum buffers */ | 46 /* maximum buffers */ |
39 #undef GGI_FLIP | 47 #undef GGI_FLIP |
40 | 48 |
41 static vo_info_t info = | 49 static vo_info_t info = |
42 { | 50 { |
51 static struct ggi_conf_s { | 59 static struct ggi_conf_s { |
52 char *driver; | 60 char *driver; |
53 | 61 |
54 ggi_visual_t parentvis; | 62 ggi_visual_t parentvis; |
55 ggi_visual_t vis; | 63 ggi_visual_t vis; |
56 ggi_mode gmode; | |
57 | 64 |
58 /* source image format */ | 65 /* source image format */ |
59 int srcwidth; | 66 int srcwidth; |
60 int srcheight; | 67 int srcheight; |
61 int srcformat; | 68 int srcformat; |
74 | 81 |
75 int async; | 82 int async; |
76 | 83 |
77 int voflags; | 84 int voflags; |
78 } ggi_conf; | 85 } ggi_conf; |
86 | |
87 | |
88 #ifdef HAVE_GGIWMH | |
89 static void window_ontop(void) | |
90 { | |
91 mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n"); | |
92 ggiWmhZOrder(ggi_conf.parentvis, ZO_TOP); | |
93 return; | |
94 } | |
95 #endif | |
79 | 96 |
80 | 97 |
81 static void set_graphtype(uint32_t format, ggi_mode *mode) | 98 static void set_graphtype(uint32_t format, ggi_mode *mode) |
82 { | 99 { |
83 switch(format) | 100 switch(format) |
115 } | 132 } |
116 | 133 |
117 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, | 134 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
118 uint32_t d_height, uint32_t flags, char *title, uint32_t format) | 135 uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
119 { | 136 { |
120 int i; | |
121 int rc; | |
122 | |
123 ggi_mode mode = { | 137 ggi_mode mode = { |
124 1, /* frames */ | 138 1, /* frames */ |
125 { 0, 0 }, /* top, left corner */ | 139 { 0, 0 }, /* top, left corner */ |
126 { width, height }, /* bottem, right corner */ | 140 { width, height }, /* bottem, right corner */ |
127 { GGI_AUTO, GGI_AUTO }, /* size */ | 141 { GGI_AUTO, GGI_AUTO }, /* size */ |
142 | 156 |
143 #if 0 | 157 #if 0 |
144 printf("[ggi] mode: "); | 158 printf("[ggi] mode: "); |
145 ggiPrintMode(&parentmode); | 159 ggiPrintMode(&parentmode); |
146 printf("\n"); | 160 printf("\n"); |
161 | |
162 printf("[ggi] submode: "); | |
163 ggiPrintMode(&mode); | |
164 printf("\n"); | |
147 #endif | 165 #endif |
148 | 166 |
149 ggiCheckMode(ggi_conf.parentvis, &parentmode); | 167 ggiCheckMode(ggi_conf.parentvis, &parentmode); |
150 | 168 |
151 if (ggiSetMode(ggi_conf.parentvis, &parentmode) < 0) | 169 if (ggiSetMode(ggi_conf.parentvis, &parentmode) < 0) |
163 if ((parentmode.graphtype == GT_INVALID) || (parentmode.graphtype == GT_AUTO)) | 181 if ((parentmode.graphtype == GT_INVALID) || (parentmode.graphtype == GT_AUTO)) |
164 { | 182 { |
165 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n"); | 183 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n"); |
166 return(-1); | 184 return(-1); |
167 } | 185 } |
186 | |
187 #if 0 | |
188 printf("[ggi] mode: "); | |
189 ggiPrintMode(&parentmode); | |
190 printf("\n"); | |
191 #endif | |
168 | 192 |
169 /* calculate top, left corner */ | 193 /* calculate top, left corner */ |
170 mode.visible.x = (parentmode.virt.x - width) / 2; | 194 mode.visible.x = (parentmode.virt.x - width) / 2; |
171 mode.visible.y = (parentmode.virt.y - height) / 2; | 195 mode.visible.y = (parentmode.virt.y - height) / 2; |
172 | 196 |
173 /* calculate bottom, right corner */ | 197 /* calculate bottom, right corner */ |
174 mode.virt.x = mode.visible.x + width; | 198 mode.virt.x = width; |
175 mode.virt.y = mode.visible.y + height; | 199 mode.virt.y = height; |
176 | 200 |
177 ggiCheckMode(ggi_conf.vis, &mode); | 201 ggiCheckMode(ggi_conf.vis, &mode); |
178 | 202 |
179 if (ggiSetMode(ggi_conf.vis, &mode) < 0) | 203 if (ggiSetMode(ggi_conf.vis, &mode) < 0) |
180 { | 204 { |
186 { | 210 { |
187 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get video mode\n"); | 211 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get video mode\n"); |
188 return(-1); | 212 return(-1); |
189 } | 213 } |
190 | 214 |
191 | 215 #ifdef HAVE_GGIWMH |
192 ggi_conf.gmode = mode; | 216 ggiWmhSetTitle(ggi_conf.parentvis, title); |
217 if (vo_ontop) window_ontop(); | |
218 #endif | |
193 | 219 |
194 #if 0 | 220 #if 0 |
195 printf("[ggi] mode: "); | 221 printf("[ggi] submode: "); |
196 ggiPrintMode(&mode); | 222 ggiPrintMode(&mode); |
197 printf("\n"); | 223 printf("\n"); |
198 #endif | 224 #endif |
199 | 225 |
200 vo_depthonscreen = GT_DEPTH(parentmode.graphtype); | 226 vo_depthonscreen = GT_DEPTH(parentmode.graphtype); |
207 vo_dbpp = GT_SIZE(parentmode.graphtype); | 233 vo_dbpp = GT_SIZE(parentmode.graphtype); |
208 | 234 |
209 ggi_conf.srcwidth = width; | 235 ggi_conf.srcwidth = width; |
210 ggi_conf.srcheight = height; | 236 ggi_conf.srcheight = height; |
211 ggi_conf.srcformat = format; | 237 ggi_conf.srcformat = format; |
238 | |
239 ggi_conf.dstwidth = mode.virt.x; | |
240 ggi_conf.dstheight = mode.virt.y; | |
212 | 241 |
213 ggi_conf.voflags = flags; | 242 ggi_conf.voflags = flags; |
214 | 243 |
215 if (IMGFMT_IS_RGB(ggi_conf.srcformat)) | 244 if (IMGFMT_IS_RGB(ggi_conf.srcformat)) |
216 { | 245 { |
225 { | 254 { |
226 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n", | 255 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n", |
227 vo_format_name(ggi_conf.srcformat)); | 256 vo_format_name(ggi_conf.srcformat)); |
228 return(-1); | 257 return(-1); |
229 } | 258 } |
230 | |
231 vo_dwidth = ggi_conf.dstwidth = ggi_conf.gmode.virt.x; | |
232 vo_dheight = ggi_conf.dstheight = ggi_conf.gmode.virt.y; | |
233 | 259 |
234 ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC); | 260 ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC); |
235 | 261 |
236 if (GT_SCHEME(mode.graphtype) == GT_PALETTE) | 262 if (GT_SCHEME(mode.graphtype) == GT_PALETTE) |
237 ggiSetColorfulPalette(ggi_conf.vis); | 263 ggiSetColorfulPalette(ggi_conf.vis); |
313 static void flip_page(void) | 339 static void flip_page(void) |
314 { | 340 { |
315 ggiFlushRegion(ggi_conf.vis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1, | 341 ggiFlushRegion(ggi_conf.vis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1, |
316 ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1, | 342 ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1, |
317 ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1); | 343 ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1); |
318 ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = ggi_conf.dstwidth / 2; | 344 |
319 ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = ggi_conf.dstheight / 2; | 345 ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1; |
346 ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1; | |
320 } | 347 } |
321 | 348 |
322 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, | 349 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, |
323 int x, int y) | 350 int x, int y) |
324 { | 351 { |
325 ggiPutBox(ggi_conf.vis, x, y, w, h, src[0]); | 352 ggiPutBox(ggi_conf.vis, x, y, w, h, src[0]); |
326 | 353 |
327 if (x < ggi_conf.flushregion.x1) | 354 if ((ggi_conf.flushregion.x1 == -1) || (x < ggi_conf.flushregion.x1)) |
328 ggi_conf.flushregion.x1 = x; | 355 ggi_conf.flushregion.x1 = x; |
329 if (y < ggi_conf.flushregion.y1) | 356 if ((ggi_conf.flushregion.y1 == -1) || (y < ggi_conf.flushregion.y1)) |
330 ggi_conf.flushregion.y1 = y; | 357 ggi_conf.flushregion.y1 = y; |
331 if ((x + w) > ggi_conf.flushregion.x2) | 358 if ((ggi_conf.flushregion.x2 == -1) || ((x + w) > ggi_conf.flushregion.x2)) |
332 ggi_conf.flushregion.x2 = x + w; | 359 ggi_conf.flushregion.x2 = x + w; |
333 if ((y + h) > ggi_conf.flushregion.y2) | 360 if ((ggi_conf.flushregion.y2 == -1) || ((y + h) > ggi_conf.flushregion.y2)) |
334 ggi_conf.flushregion.y2 = y + h; | 361 ggi_conf.flushregion.y2 = y + h; |
335 | 362 |
336 return(1); | 363 return(1); |
337 } | 364 } |
338 | 365 |
377 if (ggiInit() != 0) | 404 if (ggiInit() != 0) |
378 { | 405 { |
379 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n"); | 406 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n"); |
380 return(-1); | 407 return(-1); |
381 } | 408 } |
409 | |
410 #ifdef HAVE_GGIWMH | |
411 if (ggiWmhInit() < 0) | |
412 { | |
413 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n"); | |
414 return(-1); | |
415 } | |
416 #endif | |
382 | 417 |
383 if ((char *)arg) | 418 if ((char *)arg) |
384 { | 419 { |
385 int i = 0; | 420 int i = 0; |
386 ggi_conf.driver = strdup(arg); | 421 ggi_conf.driver = strdup(arg); |
408 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open the video output\n"); | 443 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open the video output\n"); |
409 ggiExit(); | 444 ggiExit(); |
410 return(-1); | 445 return(-1); |
411 } | 446 } |
412 | 447 |
448 #ifdef HAVE_GGIWMH | |
449 ggiWmhAttach(ggi_conf.parentvis); | |
450 #endif | |
451 | |
413 | 452 |
414 mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n", | 453 mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n", |
415 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver); | 454 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver); |
416 | 455 |
417 return 0; | 456 return 0; |
419 | 458 |
420 static void uninit(void) | 459 static void uninit(void) |
421 { | 460 { |
422 if (ggi_conf.driver) | 461 if (ggi_conf.driver) |
423 free(ggi_conf.driver); | 462 free(ggi_conf.driver); |
463 | |
464 #ifdef HAVE_GGIWMH | |
465 ggiWmhDetach(ggi_conf.parentvis); | |
466 ggiWmhExit(); | |
467 #endif | |
468 | |
424 ggiClose(ggi_conf.vis); | 469 ggiClose(ggi_conf.vis); |
425 ggiClose(ggi_conf.parentvis); | 470 ggiClose(ggi_conf.parentvis); |
426 ggiExit(); | 471 ggiExit(); |
427 } | 472 } |
428 | 473 |
432 { | 477 { |
433 case VOCTRL_QUERY_FORMAT: | 478 case VOCTRL_QUERY_FORMAT: |
434 return query_format(*((uint32_t*)data)); | 479 return query_format(*((uint32_t*)data)); |
435 case VOCTRL_GET_IMAGE: | 480 case VOCTRL_GET_IMAGE: |
436 return get_image(data); | 481 return get_image(data); |
482 #ifdef HAVE_GGIWMH | |
483 case VOCTRL_ONTOP: | |
484 vo_ontop = (!(vo_ontop)); | |
485 window_ontop(); | |
486 return VO_TRUE; | |
487 #endif | |
437 } | 488 } |
438 return VO_NOTIMPL; | 489 return VO_NOTIMPL; |
439 } | 490 } |
440 | 491 |
441 /* EVENT handling */ | 492 /* EVENT handling */ |