annotate libvo/vo_ggi.c @ 27380:843db879a6b2

Fixes unsafe 'angle' command with get_property() call. Without it, MPlayer segv trying to dereference NULL demuxer. Patch by Mathieu Schroeter (mathieu dot schroeter at gamesover dot ch)
author ben
date Mon, 04 Aug 2008 13:33:22 +0000
parents 13c920fdf7f5
children 7681eab10aea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
1 /*
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
2 vo_ggi.c - General Graphics Interface (GGI) Renderer for MPlayer
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
3
10368
6fb8a6a4a071 removing my (nonworking) email address
alex
parents: 9380
diff changeset
4 (C) Alex Beregszaszi
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
5
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
6 Uses libGGI - http://www.ggi-project.org/
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
7
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
8 TODO:
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
9 * implement gamma handling (VAA isn't obsoleted?)
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
10
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
11 Thanks to Andreas Beck for his patches.
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
12
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
13 Many thanks to Atmosfear, he hacked this driver to work with Planar
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
14 formats, and he fixed the RGB handling.
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
15 */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
16
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
17 #include <stdio.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
18 #include <stdlib.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
19 #include <string.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
20 #include <errno.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
21
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
22 #include "mp_msg.h"
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
23
12650
ac3fd2ff2561 Unify the config.h #include, use "config.h" instead of "../config.h"
diego
parents: 11110
diff changeset
24 #include "config.h"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
25 #include "video_out.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
26 #include "video_out_internal.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
27
22823
98eaf29b5dee Code cleanup: don't include a .c file in mplayer.c and fix a few
rathann
parents: 16470
diff changeset
28 #include "mp_fifo.h"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
29
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
30 #include <ggi/ggi.h>
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
31
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
32 #ifdef CONFIG_GGIWMH
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
33 #include <ggi/wmh.h>
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
34 #endif
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
35
4831
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
36 /* maximum buffers */
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
37 #undef GGI_FLIP
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
38
25216
3aee342be929 Make vo info structs const
reimar
parents: 23376
diff changeset
39 static const vo_info_t info =
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
40 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
41 "General Graphics Interface (GGI) output",
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
42 "ggi",
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
43 "Alex Beregszaszi",
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
44 "major"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
45 };
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
46
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
47 const LIBVO_EXTERN(ggi)
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
48
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
49
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
50 static struct ggi_conf_s {
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
51 char *driver;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
52
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
53 ggi_visual_t vis;
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
54 ggi_visual_t drawvis;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
55
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
56 /* source image format */
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
57 int srcwidth;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
58 int srcheight;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
59 int srcformat;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
60 int srcdepth;
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
61 int srcbpp;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
62
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
63 /* dirty region */
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
64 struct {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
65 int x1, y1;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
66 int x2, y2;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
67 } flushregion;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
68
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
69 int voflags;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
70 } ggi_conf;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
71
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
72
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
73 #ifdef CONFIG_GGIWMH
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
74 static void window_ontop(void)
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
75 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
76 mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n");
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
77 ggiWmhZOrder(ggi_conf.vis, ZO_TOP);
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
78 return;
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
79 }
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
80 #endif
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
81
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
82
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
83 static void set_graphtype(uint32_t format, ggi_mode *mode)
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
84 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
85 switch (format) {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
86 case IMGFMT_RGB4:
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
87 mode->graphtype = GT_4BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
88 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
89 case IMGFMT_BGR4:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
90 mode->graphtype = GT_4BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
91 GT_SETSUBSCHEME(mode->graphtype, GT_SUB_HIGHBIT_RIGHT);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
92 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
93 case IMGFMT_RGB8:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
94 case IMGFMT_BGR8:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
95 mode->graphtype = GT_8BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
96 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
97 case IMGFMT_RGB15:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
98 case IMGFMT_BGR15:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
99 mode->graphtype = GT_15BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
100 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
101 case IMGFMT_RGB16:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
102 case IMGFMT_BGR16:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
103 mode->graphtype = GT_16BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
104 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
105 case IMGFMT_RGB24:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
106 case IMGFMT_BGR24:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
107 mode->graphtype = GT_24BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
108 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
109 case IMGFMT_RGB32:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
110 case IMGFMT_BGR32:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
111 mode->graphtype = GT_32BIT;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
112 break;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
113 }
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
114
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
115 return;
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
116 }
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
117
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15406
diff changeset
118 static int config(uint32_t width, uint32_t height, uint32_t d_width,
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
119 uint32_t d_height, uint32_t flags, char *title,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
120 uint32_t format)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
121 {
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
122 ggi_mode mode = {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
123 1, /* frames */
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
124 {width, height}, /* visible */
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
125 {GGI_AUTO, GGI_AUTO}, /* virt */
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
126 {GGI_AUTO, GGI_AUTO}, /* size */
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
127 GT_AUTO, /* graphtype */
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
128 {GGI_AUTO, GGI_AUTO} /* dots per pixel */
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
129 };
14021
f0236d5ba7a7 Remove broken support for directbuffer and including frame-handling use.
iive
parents: 13787
diff changeset
130
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
131
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
132 set_graphtype(format, &mode);
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
133
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
134 #if 0
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
135 printf("[ggi] mode: ");
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
136 ggiPrintMode(&mode);
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
137 printf("\n");
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
138 #endif
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
139
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
140 ggiCheckMode(ggi_conf.vis, &mode);
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
141
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
142 if (ggiSetMode(ggi_conf.vis, &mode) < 0) {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
143 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set display mode\n");
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
144 return -1;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
145 }
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
146 if (ggiGetMode(ggi_conf.vis, &mode) < 0) {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
147 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get display mode\n");
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
148 return -1;
1147
82bbd3ee8ce7 hacked osd working on yv12
al3x
parents: 1145
diff changeset
149 }
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
150 if ((mode.graphtype == GT_INVALID)
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
151 || (mode.graphtype == GT_AUTO))
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
152 {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
153 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n");
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
154 return -1;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
155 }
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
156
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
157 #if 0
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
158 printf("[ggi] mode: ");
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
159 ggiPrintMode(&mode);
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
160 printf("\n");
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
161 #endif
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
162
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
163
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
164 #ifdef CONFIG_GGIWMH
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
165 ggiWmhSetTitle(ggi_conf.vis, title);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
166 if (vo_ontop) window_ontop();
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
167 #endif
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
168
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
169 ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
170
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
171 if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
172 ggiSetColorfulPalette(ggi_conf.vis);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
173
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
174 if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
175 ggi_mode drawmode;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
176
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
177 ggi_conf.drawvis = ggiOpen("display-memory", NULL);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
178 if (ggi_conf.drawvis == NULL) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
179 mp_msg(MSGT_VO, MSGL_ERR,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
180 "[ggi] unable to get backbuffer for conversion\n");
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
181 return -1;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
182 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
183 memcpy(&drawmode, &mode, sizeof(ggi_mode));
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
184 drawmode.graphtype = GT_32BIT;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
185 drawmode.size.x = GGI_AUTO;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
186 drawmode.size.y = GGI_AUTO;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
187 ggiCheckMode(ggi_conf.drawvis, &drawmode);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
188 if (ggiSetMode(ggi_conf.drawvis, &drawmode) < 0) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
189 mp_msg(MSGT_VO, MSGL_ERR,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
190 "[ggi] unable to set backbuffer mode\n");
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
191 return -1;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
192 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
193 mode.graphtype = drawmode.graphtype;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
194
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
195 ggiSetFlags(ggi_conf.drawvis, GGIFLAG_ASYNC);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
196 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
197 vo_depthonscreen = GT_DEPTH(mode.graphtype);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
198 vo_screenwidth = mode.virt.x;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
199 vo_screenheight = mode.virt.y;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
200
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
201 vo_dwidth = width;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
202 vo_dheight = height;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
203 vo_dbpp = GT_SIZE(mode.graphtype);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
204
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
205
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
206 /* calculate top, left corner */
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
207 vo_dx = (vo_screenwidth - vo_dwidth) / 2;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
208 vo_dy = (vo_screenheight - vo_dheight) / 2;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
209
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
210
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
211 ggi_conf.srcwidth = width;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
212 ggi_conf.srcheight = height;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
213 ggi_conf.srcformat = format;
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
214
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
215 ggi_conf.voflags = flags;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
216
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
217 if (IMGFMT_IS_RGB(ggi_conf.srcformat)) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
218 ggi_conf.srcdepth = IMGFMT_RGB_DEPTH(ggi_conf.srcformat);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
219 } else if (IMGFMT_IS_BGR(ggi_conf.srcformat)) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
220 ggi_conf.srcdepth = IMGFMT_BGR_DEPTH(ggi_conf.srcformat);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
221 } else {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
222 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n",
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
223 vo_format_name(ggi_conf.srcformat));
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
224 return -1;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
225 }
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
226
14021
f0236d5ba7a7 Remove broken support for directbuffer and including frame-handling use.
iive
parents: 13787
diff changeset
227 mp_msg(MSGT_VO, MSGL_INFO, "[ggi] input: %dx%dx%d, output: %dx%dx%d\n",
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
228 ggi_conf.srcwidth, ggi_conf.srcheight, ggi_conf.srcdepth,
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
229 mode.virt.x, mode.virt.y, vo_dbpp);
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
230
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
231 ggi_conf.srcbpp = (ggi_conf.srcdepth + 7) / 8;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
232
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
233 ggi_conf.flushregion.x1 = vo_dx;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
234 ggi_conf.flushregion.y1 = vo_dy;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
235 ggi_conf.flushregion.x2 = vo_dwidth;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
236 ggi_conf.flushregion.y2 = vo_dheight;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
237
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
238 return 0;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
239 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
240
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
241 static uint32_t get_image(mp_image_t *mpi)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
242 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
243 /* GGI DirectRendering supports (yet) only BGR/RGB modes */
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
244 if (!((IMGFMT_IS_BGR(mpi->imgfmt)) &&
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
245 (IMGFMT_BGR_DEPTH(mpi->imgfmt) == vo_dbpp)))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
246 {
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
247 return VO_FALSE;
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
248 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
249
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
250 if (!((IMGFMT_IS_RGB(mpi->imgfmt)) &&
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
251 (IMGFMT_RGB_DEPTH(mpi->imgfmt) == vo_dbpp)))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
252 {
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
253 return VO_FALSE;
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
254 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
255
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
256 if (!((mpi->width == ggi_conf.srcwidth) &&
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
257 (mpi->height == ggi_conf.srcheight)))
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
258 {
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
259 return VO_FALSE;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
260 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
261
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
262 mpi->planes[1] = mpi->planes[2] = NULL;
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
263 mpi->stride[1] = mpi->stride[2] = 0;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
264
14021
f0236d5ba7a7 Remove broken support for directbuffer and including frame-handling use.
iive
parents: 13787
diff changeset
265 mpi->planes[0] = NULL;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
266 mpi->stride[0] = ggi_conf.srcwidth * ggi_conf.srcbpp;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
267 mpi->flags |= MP_IMGFLAG_DIRECT;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
268
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
269 #ifdef GGI_FLIP
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
270 if (ggi_conf.voflags & VOFLAG_FLIPPING) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
271 mpi->stride[0] = -mpi->stride[0];
5703
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
272 }
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
273 #endif
efd2518b174e minor fixes and flipping support
alex
parents: 5637
diff changeset
274
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
275 return VO_TRUE;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
276 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
277
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
278
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15406
diff changeset
279 static int draw_frame(uint8_t *src[])
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
280 {
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
281 ggiPutBox(ggi_conf.drawvis, vo_dx, vo_dy,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
282 vo_dwidth, vo_dheight, src[0]);
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
283
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
284 ggi_conf.flushregion.x1 = vo_dx;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
285 ggi_conf.flushregion.y1 = vo_dy;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
286 ggi_conf.flushregion.x2 = vo_dwidth;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
287 ggi_conf.flushregion.y2 = vo_dheight;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
288
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
289 return 0;
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
290 }
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
291
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
292 static void draw_osd(void)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
293 {
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
294 return;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
295 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
296
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
297 static void flip_page(void)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
298 {
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
299 if (ggi_conf.drawvis != ggi_conf.vis) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
300 #if 0
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
301 ggiFlushRegion(ggi_conf.drawvis,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
302 ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
303 ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
304 ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
305 #endif
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
306 ggiCrossBlit(ggi_conf.drawvis,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
307 ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
308 ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
309 ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
310 ggi_conf.vis,
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
311 ggi_conf.flushregion.x1, ggi_conf.flushregion.y1);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
312
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
313 }
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
314 ggiFlushRegion(ggi_conf.vis,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
315 ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
316 ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
317 ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
318
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
319 ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1;
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
320 ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
321 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
322
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
323 static int draw_slice(uint8_t *src[], int stride[],
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
324 int w, int h, int x, int y)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
325 {
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
326 ggiPutBox(ggi_conf.drawvis, vo_dx + x, vo_dy + y, w, h, src[0]);
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
327
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
328 if ((ggi_conf.flushregion.x1 == -1) ||
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
329 ((vo_dx + x) < ggi_conf.flushregion.x1))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
330 {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
331 ggi_conf.flushregion.x1 = vo_dx + x;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
332 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
333 if ((ggi_conf.flushregion.y1 == -1) ||
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
334 ((vo_dy + y) < ggi_conf.flushregion.y1))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
335 {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
336 ggi_conf.flushregion.y1 = vo_dy + y;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
337 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
338 if ((ggi_conf.flushregion.x2 == -1) ||
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
339 ((vo_dx + x + w) > ggi_conf.flushregion.x2))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
340 {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
341 ggi_conf.flushregion.x2 = vo_dx + x + w;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
342 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
343 if ((ggi_conf.flushregion.y2 == -1) ||
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
344 ((vo_dy + y + h) > ggi_conf.flushregion.y2))
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
345 {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
346 ggi_conf.flushregion.y2 = vo_dy + y + h;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
347 }
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
348
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
349 return 1;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
350 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
351
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15406
diff changeset
352 static int query_format(uint32_t format)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
353 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
354 ggi_mode mode;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
355 uint32_t vfcap;
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
356
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
357 vfcap = VFCAP_CSP_SUPPORTED
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
358 | VFCAP_CSP_SUPPORTED_BY_HW
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
359 | VFCAP_ACCEPT_STRIDE;
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
360
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
361 if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.vis) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
362 if (ggiGetMode(ggi_conf.vis, &mode) == 0) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
363 vo_depthonscreen = GT_DEPTH(mode.graphtype);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
364 vo_dbpp = GT_SIZE(mode.graphtype);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
365 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
366 if (GT_SCHEME(mode.graphtype) == GT_AUTO) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
367 ggiCheckMode(ggi_conf.vis, &mode);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
368 }
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
369 if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
370 mode.graphtype = GT_32BIT;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
371 vo_depthonscreen = GT_DEPTH(mode.graphtype);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
372 vo_dbpp = GT_SIZE(mode.graphtype);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
373 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
374 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
375 if ((IMGFMT_IS_BGR(format) && (IMGFMT_BGR_DEPTH(format) == vo_dbpp)) ||
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
376 (IMGFMT_IS_RGB(format) && (IMGFMT_RGB_DEPTH(format) == vo_dbpp)))
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
377 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
378 return vfcap;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
379 }
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
380 if (IMGFMT_IS_BGR(format) || IMGFMT_IS_RGB(format)) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
381 set_graphtype(format, &mode);
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
382
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
383 if (ggiCheckMode(ggi_conf.drawvis, &mode) < 0) {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
384 return 0;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
385 } else {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
386 return vfcap;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
387 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
388 }
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
389 return 0;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
390 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
391
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15406
diff changeset
392 static int preinit(const char *arg)
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
393 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
394 if (ggiInit() != 0) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
395 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n");
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
396 return -1;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
397 }
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
398 #ifdef CONFIG_GGIWMH
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
399 if (ggiWmhInit() < 0) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
400 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n");
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
401 return -1;
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
402 }
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
403 #endif
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
404
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
405 if (arg) {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
406 int i = 0;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
407 ggi_conf.driver = strdup(arg);
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
408 while (ggi_conf.driver[i] != '\0') {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
409 if (ggi_conf.driver[i] == '.')
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
410 ggi_conf.driver[i] = ',';
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
411 i++;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
412 }
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
413 } else {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
414 ggi_conf.driver = NULL;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
415 }
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
416
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
417 ggi_conf.vis = ggiOpen(ggi_conf.driver);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
418 if (ggi_conf.vis == NULL) {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
419 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open '%s' output\n",
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
420 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
421 ggiExit();
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
422 return -1;
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
423 }
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
424 ggi_conf.drawvis = ggi_conf.vis;
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
425
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
426
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
427 #ifdef CONFIG_GGIWMH
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
428 ggiWmhAttach(ggi_conf.vis);
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
429 #endif
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
430
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
431
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
432 mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
433 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
434
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
435 return 0;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
436 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
437
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
438 static void uninit(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
439 {
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
440 if (ggi_conf.driver)
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
441 free(ggi_conf.driver);
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
442
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
443 #ifdef CONFIG_GGIWMH
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
444 ggiWmhDetach(ggi_conf.vis);
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
445 ggiWmhExit();
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
446 #endif
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
447
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
448 if (ggi_conf.drawvis != NULL && ggi_conf.drawvis != ggi_conf.vis)
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
449 ggiClose(ggi_conf.drawvis);
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
450
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
451 ggiClose(ggi_conf.vis);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
452 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
453 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
454
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15406
diff changeset
455 static int control(uint32_t request, void *data, ...)
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
456 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
457 switch (request) {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
458 case VOCTRL_QUERY_FORMAT:
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
459 return query_format(*((uint32_t *) data));
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
460 case VOCTRL_GET_IMAGE:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
461 return get_image(data);
27365
13c920fdf7f5 Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents: 26755
diff changeset
462 #ifdef CONFIG_GGIWMH
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
463 case VOCTRL_ONTOP:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
464 vo_ontop = (!(vo_ontop));
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
465 window_ontop();
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
466 return VO_TRUE;
15406
04c47e9acab3 - make use of libggiwmh if found by configure
diego
parents: 15272
diff changeset
467 #endif
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
468 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
469 return VO_NOTIMPL;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
470 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
471
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
472 /* EVENT handling */
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12650
diff changeset
473 #include "osdep/keycodes.h"
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
474
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
475 static void check_events(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
476 {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
477 struct timeval tv = {0, 0};
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
478 ggi_event event;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
479 ggi_event_mask mask;
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
480
16470
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
481 if ((mask = ggiEventPoll(ggi_conf.vis, emAll, &tv))) {
fbaf51e1c3b2 - improved performance on truecolor modes
diego
parents: 16426
diff changeset
482 if (ggiEventRead(ggi_conf.vis, &event, emAll) != 0) {
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
483 mp_dbg(MSGT_VO, MSGL_DBG3,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
484 "type: %4x, origin: %4x, "
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
485 "sym: %4x, label: %4x, button=%4x\n",
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
486 event.any.origin, event.any.type, event.key.sym,
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
487 event.key.label, event.key.button);
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
488
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
489 switch (event.any.type) {
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
490 case evKeyPress:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
491 switch (event.key.sym) {
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
492 case GIIK_PAsterisk: /* PStar */
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
493 case GIIUC_Asterisk:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
494 mplayer_put_key('*');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
495 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
496 case GIIK_PSlash:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
497 case GIIUC_Slash:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
498 mplayer_put_key('/');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
499 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
500 case GIIK_PPlus:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
501 case GIIUC_Plus:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
502 mplayer_put_key('+');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
503 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
504 case GIIK_PMinus:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
505 case GIIUC_Minus:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
506 mplayer_put_key('-');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
507 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
508 case GIIUC_o:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
509 case GIIUC_O:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
510 mplayer_put_key('o');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
511 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
512 case GIIUC_g:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
513 case GIIUC_G:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
514 mplayer_put_key('g');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
515 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
516 case GIIUC_z:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
517 case GIIUC_Z:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
518 mplayer_put_key('z');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
519 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
520 case GIIUC_x:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
521 case GIIUC_X:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
522 mplayer_put_key('x');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
523 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
524 case GIIUC_m:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
525 case GIIUC_M:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
526 mplayer_put_key('m');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
527 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
528 case GIIUC_d:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
529 case GIIUC_D:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
530 mplayer_put_key('d');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
531 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
532 case GIIUC_q:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
533 case GIIUC_Q:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
534 mplayer_put_key('q');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
535 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
536 case GIIUC_h:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
537 case GIIUC_H:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
538 mplayer_put_key('h');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
539 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
540 case GIIUC_l:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
541 case GIIUC_L:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
542 mplayer_put_key('l');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
543 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
544 case GIIUC_Space:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
545 case GIIUC_p:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
546 case GIIUC_P:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
547 mplayer_put_key('p');
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
548 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
549 case GIIK_Up:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
550 mplayer_put_key(KEY_UP);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
551 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
552 case GIIK_Down:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
553 mplayer_put_key(KEY_DOWN);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
554 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
555 case GIIK_Left:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
556 mplayer_put_key(KEY_LEFT);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
557 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
558 case GIIK_Right:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
559 mplayer_put_key(KEY_RIGHT);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
560 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
561 case GIIK_PageUp:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
562 mplayer_put_key(KEY_PAGE_UP);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
563 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
564 case GIIK_PageDown:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
565 mplayer_put_key(KEY_PAGE_DOWN);
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
566 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
567 default:
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
568 break;
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
569 } /* switch */
14175
c4fe6bb22e2e - Fixed mode setting, so any video can be played on all supported ggi targets.
diego
parents: 14021
diff changeset
570
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
571 break;
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
572 } /* switch */
16409
ff4af59f64b2 Switch indentation over to K&R style, replace all tabs by spaces.
diego
parents: 16280
diff changeset
573 } /* if */
16426
3523630c28cf Replace remaining tabs by spaces.
diego
parents: 16409
diff changeset
574 } /* if */
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
575 return;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
576 }