Mercurial > mplayer.hg
annotate libvo/vo_xmga.c @ 18450:75d2f88f17e4
Minor corrections to spanish help messages - Part1
author | reynaldo |
---|---|
date | Fri, 12 May 2006 00:11:52 +0000 |
parents | d75953576ae4 |
children | 94965d83e2b6 |
rev | line source |
---|---|
100 | 1 |
2 //#define SHOW_TIME | |
1 | 3 |
4 /* | |
7680 | 5 * vo_xmga.c |
1 | 6 * |
7 * Copyright (C) Zoltan Ponekker - Jan 2001 | |
8 * | |
9 */ | |
10 | |
11 #include <stdio.h> | |
12 #include <stdlib.h> | |
13 #include <string.h> | |
14 | |
15 #include "config.h" | |
6296 | 16 |
1 | 17 #include "video_out.h" |
18 #include "video_out_internal.h" | |
19 | |
20 | |
21 #include <sys/ioctl.h> | |
22 #include <unistd.h> | |
23 #include <fcntl.h> | |
24 #include <sys/mman.h> | |
25 | |
26 #include "drivers/mga_vid.h" | |
27 | |
28 #include <X11/Xlib.h> | |
29 #include <X11/Xutil.h> | |
30 #include <errno.h> | |
31 | |
4017 | 32 #ifdef HAVE_XINERAMA |
33 #include <X11/extensions/Xinerama.h> | |
34 #endif | |
35 | |
31 | 36 #include "x11_common.h" |
616 | 37 #include "sub.h" |
2057 | 38 #include "aspect.h" |
31 | 39 |
182 | 40 #ifdef SHOW_TIME |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13056
diff
changeset
|
41 #include "osdep/timer.h" |
12582 | 42 static unsigned int timer = 0; |
43 static unsigned int timerd = 0; | |
100 | 44 #endif |
45 | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
46 #ifdef HAVE_NEW_GUI |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13056
diff
changeset
|
47 #include "Gui/interface.h" |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
48 #endif |
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
49 |
12582 | 50 static vo_info_t info = { |
51 "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)", | |
52 "xmga", | |
53 "Zoltan Ponekker <pontscho@makacs.poliod.hu>", | |
54 "" | |
1 | 55 }; |
56 | |
12582 | 57 LIBVO_EXTERN(xmga) |
58 static XGCValues wGCV; | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8017
diff
changeset
|
59 |
12582 | 60 static uint32_t mDepth; |
61 static XWindowAttributes attribs; | |
10988 | 62 static int colorkey; |
1 | 63 |
12582 | 64 static uint32_t mvHeight; |
65 static uint32_t mvWidth; | |
1 | 66 |
12582 | 67 static Window mRoot; |
1 | 68 |
12582 | 69 static XSetWindowAttributes xWAttribs; |
1 | 70 |
12582 | 71 static int inited = 0; |
6311
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
6307
diff
changeset
|
72 |
4981 | 73 #define VO_XMGA |
1 | 74 #include "mga_common.c" |
4981 | 75 #undef VO_XMGA |
1 | 76 |
12582 | 77 static void mDrawColorKey(void) |
1 | 78 { |
12582 | 79 XSetBackground(mDisplay, vo_gc, 0); |
80 XClearWindow(mDisplay, vo_window); | |
81 XSetForeground(mDisplay, vo_gc, colorkey); | |
82 XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth, | |
83 (vo_fs ? drwHeight - 1 : drwHeight)); | |
84 XFlush(mDisplay); | |
1 | 85 } |
86 | |
31 | 87 static void check_events(void) |
1 | 88 { |
12582 | 89 int e = vo_x11_check_events(mDisplay); |
90 | |
91 if (!(e & VO_EVENT_RESIZE) && !(e & VO_EVENT_EXPOSE)) | |
92 return; | |
93 set_window(); | |
94 mDrawColorKey(); | |
95 if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config)) | |
96 mp_msg(MSGT_VO, MSGL_WARN, | |
97 "Error in mga_vid_config ioctl (wrong mga_vid.o version?)"); | |
1 | 98 } |
99 | |
12582 | 100 static void flip_page(void) |
101 { | |
182 | 102 #ifdef SHOW_TIME |
100 | 103 unsigned int t; |
12582 | 104 |
105 t = GetTimer(); | |
106 mp_msg(MSGT_VO, MSGL_STATUS, | |
107 " [timer: %08X diff: %6d dd: %6d ] \n", t, t - timer, | |
108 (t - timer) - timerd); | |
109 timerd = t - timer; | |
110 timer = t; | |
182 | 111 #endif |
100 | 112 |
12582 | 113 vo_mga_flip_page(); |
31 | 114 } |
1 | 115 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15540
diff
changeset
|
116 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
12582 | 117 uint32_t d_height, uint32_t flags, char *title, |
118 uint32_t format) | |
1 | 119 { |
12582 | 120 char *mTitle = (title == NULL) ? "XMGA render" : title; |
121 XVisualInfo vinfo; | |
122 unsigned long xswamask; | |
123 int r, g, b; | |
124 | |
125 if (mga_init(width, height, format)) | |
126 return -1; // ioctl errors? | |
1 | 127 |
12582 | 128 aspect_save_orig(width, height); |
129 aspect_save_prescale(d_width, d_height); | |
18116 | 130 update_xinerama_info(); |
12582 | 131 |
132 mvWidth = width; | |
133 mvHeight = height; | |
1 | 134 |
12582 | 135 vo_panscan_x = vo_panscan_y = vo_panscan_amount = 0; |
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
|
136 |
12582 | 137 vo_dx = (vo_screenwidth - d_width) / 2; |
138 vo_dy = (vo_screenheight - d_height) / 2; | |
139 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, | |
140 vo_screenheight); | |
18116 | 141 vo_dx += xinerama_x; |
142 vo_dy += xinerama_y; | |
12582 | 143 vo_dwidth = d_width; |
144 vo_dheight = d_height; | |
145 vo_mouse_autohide = 1; | |
6307 | 146 |
12582 | 147 r = (vo_colorkey & 0x00ff0000) >> 16; |
148 g = (vo_colorkey & 0x0000ff00) >> 8; | |
149 b = vo_colorkey & 0x000000ff; | |
150 switch (vo_depthonscreen) | |
151 { | |
152 case 32: | |
153 colorkey = vo_colorkey; | |
154 break; | |
155 case 24: | |
156 colorkey = vo_colorkey & 0x00ffffff; | |
157 break; | |
158 case 16: | |
159 colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); | |
160 break; | |
161 case 15: | |
162 colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); | |
163 break; | |
164 default: | |
165 mp_msg(MSGT_VO, MSGL_ERR, | |
166 "Sorry, this (%d) color depth not supported.\n", | |
167 vo_depthonscreen); | |
168 return -1; | |
169 } | |
13946 | 170 mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey); |
1 | 171 |
12582 | 172 inited = 1; |
1 | 173 |
12582 | 174 aspect(&d_width, &d_height, A_NOZOOM); |
5985 | 175 |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1637
diff
changeset
|
176 #ifdef HAVE_NEW_GUI |
12582 | 177 if (use_gui) |
178 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window | |
179 else | |
5985 | 180 #endif |
12582 | 181 { |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
182 if (flags & VOFLAG_FULLSCREEN) |
12582 | 183 aspect(&dwidth, &dheight, A_ZOOM); |
723 | 184 |
12582 | 185 XGetWindowAttributes(mDisplay, mRootWin, &attribs); |
186 mDepth = attribs.depth; | |
187 if (mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32) | |
188 mDepth = 24; | |
189 XMatchVisualInfo(mDisplay, mScreen, mDepth, TrueColor, &vinfo); | |
190 xWAttribs.colormap = | |
191 XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone); | |
192 xWAttribs.background_pixel = 0; | |
193 xWAttribs.border_pixel = 0; | |
194 xWAttribs.event_mask = | |
195 StructureNotifyMask | ExposureMask | KeyPressMask | | |
196 ((WinID == | |
197 0) ? 0 : (ButtonPressMask | ButtonReleaseMask | | |
198 PointerMotionMask | PropertyChangeMask)); | |
199 xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; | |
200 | |
201 if (WinID >= 0) | |
202 { | |
1 | 203 |
12582 | 204 vo_window = WinID ? ((Window) WinID) : mRootWin; |
205 if (WinID) | |
206 { | |
207 XUnmapWindow(mDisplay, vo_window); | |
208 XChangeWindowAttributes(mDisplay, vo_window, xswamask, | |
209 &xWAttribs); | |
210 vo_x11_selectinput_witherr(mDisplay, vo_window, | |
211 StructureNotifyMask | | |
212 KeyPressMask | | |
213 PropertyChangeMask | | |
214 PointerMotionMask | | |
215 ButtonPressMask | | |
216 ButtonReleaseMask | | |
217 ExposureMask); | |
15540 | 218 XMapWindow(mDisplay, vo_window); |
12582 | 219 } else |
220 XSelectInput(mDisplay, vo_window, ExposureMask); | |
221 | |
222 } else | |
223 { | |
7679 | 224 |
12582 | 225 if (vo_window == None) |
226 { | |
227 vo_window = XCreateWindow(mDisplay, mRootWin, | |
228 vo_dx, vo_dy, | |
229 vo_dwidth, vo_dheight, | |
230 xWAttribs.border_pixel, | |
231 mDepth, | |
232 InputOutput, | |
233 vinfo.visual, xswamask, | |
234 &xWAttribs); | |
723 | 235 |
12582 | 236 vo_x11_classhint(mDisplay, vo_window, "xmga"); |
237 vo_hidecursor(mDisplay, vo_window); | |
238 vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0); | |
239 | |
240 XStoreName(mDisplay, vo_window, mTitle); | |
241 XMapWindow(mDisplay, vo_window); | |
242 | |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
243 if (flags & VOFLAG_FULLSCREEN) |
12582 | 244 vo_x11_fullscreen(); |
5999 | 245 |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
246 } else if (!(flags & VOFLAG_FULLSCREEN)) |
12582 | 247 XMoveResizeWindow(mDisplay, vo_window, vo_dx, vo_dy, |
248 vo_dwidth, vo_dheight); | |
249 } | |
7679 | 250 |
12582 | 251 if (vo_gc != None) |
252 XFreeGC(mDisplay, vo_gc); | |
253 vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &wGCV); | |
7679 | 254 |
12582 | 255 } // !GUI |
7679 | 256 |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
257 if ((flags & VOFLAG_FULLSCREEN) && (!WinID)) |
12582 | 258 { |
259 vo_dx = 0; | |
260 vo_dy = 0; | |
261 vo_dwidth = vo_screenwidth; | |
262 vo_dheight = vo_screenheight; | |
263 vo_fs = 1; | |
264 } | |
7679 | 265 |
12582 | 266 panscan_calc(); |
6755 | 267 |
12582 | 268 mga_vid_config.colkey_on = 1; |
269 mga_vid_config.colkey_red = r; | |
270 mga_vid_config.colkey_green = g; | |
271 mga_vid_config.colkey_blue = b; | |
272 | |
273 set_window(); // set up mga_vid_config.dest_width etc | |
274 | |
275 if (vo_ontop) | |
276 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
6755 | 277 |
12582 | 278 XSync(mDisplay, False); |
279 | |
280 ioctl(f, MGA_VID_ON, 0); | |
281 | |
282 return 0; | |
1 | 283 } |
284 | |
12582 | 285 static void uninit(void) |
286 { | |
287 mp_msg(MSGT_VO, MSGL_V, "vo: uninit!\n"); | |
288 mga_uninit(); | |
289 if (!inited) | |
290 return; // no window? | |
291 inited = 0; | |
292 vo_x11_uninit(); // destroy the window | |
1 | 293 } |