Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 12585:8e748658cd71
sync tag bump
author | wight |
---|---|
date | Mon, 14 Jun 2004 10:58:54 +0000 |
parents | 162c80b2d432 |
children | 3cd9add91f97 |
rev | line source |
---|---|
7757 | 1 /* vo_xv.c, X11 Xv interface */ |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
2 |
1265 | 3 // Number of buffers _FOR_DOUBLEBUFFERING_MODE_ |
4 // Use option -double to enable double buffering! (default: single buffer) | |
6758
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
5 #define NUM_BUFFERS 3 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
6 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
7 /* |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
8 Buffer allocation: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
9 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
10 -nodr: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
11 1: TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
12 2: 2*TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
13 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
14 -dr: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
15 1: TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
16 3: 2*STATIC+TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
17 */ |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
18 |
1 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 | |
23 #include "config.h" | |
5935 | 24 #include "mp_msg.h" |
1 | 25 #include "video_out.h" |
26 #include "video_out_internal.h" | |
27 | |
28 | |
29 #include <X11/Xlib.h> | |
30 #include <X11/Xutil.h> | |
31 #include <errno.h> | |
32 | |
31 | 33 #include "x11_common.h" |
34 | |
354 | 35 #include "fastmemcpy.h" |
616 | 36 #include "sub.h" |
2054 | 37 #include "aspect.h" |
350 | 38 |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
39 #ifdef HAVE_NEW_GUI |
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
40 #include "../Gui/interface.h" |
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
41 #endif |
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
42 |
12582 | 43 static vo_info_t info = { |
44 "X11/Xv", | |
45 "xv", | |
46 "Gerd Knorr <kraxel@goldbach.in-berlin.de> and others", | |
47 "" | |
1 | 48 }; |
49 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7857
diff
changeset
|
50 LIBVO_EXTERN(xv) |
6719
5291d74a60c9
xv support under cygwin - patch by Sycotic Smith <sycotic at linuxmail.org>
alex
parents:
6417
diff
changeset
|
51 #ifdef HAVE_SHM |
1 | 52 #include <sys/ipc.h> |
53 #include <sys/shm.h> | |
54 #include <X11/extensions/XShm.h> | |
6416 | 55 /* since it doesn't seem to be defined on some platforms */ |
12582 | 56 int XShmGetEventBase(Display *); |
6416 | 57 |
58 static XShmSegmentInfo Shminfo[NUM_BUFFERS]; | |
6417
44bca09c1edd
100l accidently removed a line too much (Shmem_Flag)
atmos4
parents:
6416
diff
changeset
|
59 static int Shmem_Flag; |
6416 | 60 #endif |
61 | |
10855 | 62 // Note: depends on the inclusion of X11/extensions/XShm.h |
63 #include <X11/extensions/Xv.h> | |
64 #include <X11/extensions/Xvlib.h> | |
65 | |
66 // FIXME: dynamically allocate this stuff | |
67 static void allocate_xvimage(int); | |
12582 | 68 static unsigned int ver, rel, req, ev, err; |
10855 | 69 static unsigned int formats, adaptors, xv_port, xv_format; |
12582 | 70 static XvAdaptorInfo *ai = NULL; |
71 static XvImageFormatValues *fo; | |
10855 | 72 |
12582 | 73 static int current_buf = 0; |
74 static int current_ip_buf = 0; | |
75 static int num_buffers = 1; // default | |
76 static XvImage *xvimage[NUM_BUFFERS]; | |
10855 | 77 |
78 | |
1 | 79 static uint32_t image_width; |
80 static uint32_t image_height; | |
81 static uint32_t image_format; | |
4629 | 82 static int flip_flag; |
1 | 83 |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
84 static int int_pause; |
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
85 |
12582 | 86 static Window mRoot; |
87 static uint32_t drwX, drwY, drwBorderWidth, drwDepth; | |
88 static uint32_t dwidth, dheight; | |
1 | 89 |
12582 | 90 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, |
91 unsigned char *src, unsigned char *srca, | |
92 int stride); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
93 |
12582 | 94 static void draw_alpha_yv12(int x0, int y0, int w, int h, |
95 unsigned char *src, unsigned char *srca, | |
96 int stride) | |
97 { | |
98 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
99 vo_draw_alpha_yv12(w, h, src, srca, stride, | |
100 xvimage[current_buf]->data + | |
101 xvimage[current_buf]->offsets[0] + | |
102 xvimage[current_buf]->pitches[0] * y0 + x0, | |
103 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
104 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
105 |
12582 | 106 static void draw_alpha_yuy2(int x0, int y0, int w, int h, |
107 unsigned char *src, unsigned char *srca, | |
108 int stride) | |
109 { | |
110 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
111 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
112 xvimage[current_buf]->data + | |
113 xvimage[current_buf]->offsets[0] + | |
114 xvimage[current_buf]->pitches[0] * y0 + 2 * x0, | |
115 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
116 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
117 |
12582 | 118 static void draw_alpha_uyvy(int x0, int y0, int w, int h, |
119 unsigned char *src, unsigned char *srca, | |
120 int stride) | |
121 { | |
122 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
123 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
124 xvimage[current_buf]->data + | |
125 xvimage[current_buf]->offsets[0] + | |
126 xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1, | |
127 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
128 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
129 |
12582 | 130 static void draw_alpha_null(int x0, int y0, int w, int h, |
131 unsigned char *src, unsigned char *srca, | |
132 int stride) | |
133 { | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
134 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
135 |
6786 | 136 |
7757 | 137 static void deallocate_xvimage(int foo); |
138 | |
182 | 139 /* |
140 * connect to server, create and map window, | |
1 | 141 * allocate colors and (shared) memory |
142 */ | |
12582 | 143 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
144 uint32_t d_height, uint32_t flags, char *title, | |
145 uint32_t format) | |
1 | 146 { |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
844
diff
changeset
|
147 // int screen; |
12582 | 148 char *hello = (title == NULL) ? "Xv render" : title; |
149 | |
922
db06ae8967eb
Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents:
844
diff
changeset
|
150 // char *name = ":0.0"; |
12582 | 151 XSizeHints hint; |
152 XVisualInfo vinfo; | |
153 XGCValues xgcv; | |
154 XSetWindowAttributes xswa; | |
155 XWindowAttributes attribs; | |
156 unsigned long xswamask; | |
157 int depth; | |
158 | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
159 #ifdef HAVE_XF86VM |
12582 | 160 int vm = 0; |
161 unsigned int modeline_width, modeline_height; | |
162 static uint32_t vm_width; | |
163 static uint32_t vm_height; | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
164 #endif |
1 | 165 |
12582 | 166 panscan_init(); |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
167 |
12582 | 168 aspect_save_orig(width, height); |
169 aspect_save_prescale(d_width, d_height); | |
170 | |
171 image_height = height; | |
172 image_width = width; | |
173 image_format = format; | |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2055
diff
changeset
|
174 |
12582 | 175 vo_mouse_autohide = 1; |
176 | |
177 int_pause = 0; | |
1 | 178 |
12582 | 179 vo_dx = (vo_screenwidth - d_width) / 2; |
180 vo_dy = (vo_screenheight - d_height) / 2; | |
181 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, | |
182 vo_screenheight); | |
183 vo_dwidth = d_width; | |
184 vo_dheight = d_height; | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
185 |
4978 | 186 #ifdef HAVE_XF86VM |
12582 | 187 if (flags & 0x02) |
188 vm = 1; | |
4978 | 189 #endif |
12582 | 190 flip_flag = flags & 8; |
191 num_buffers = | |
192 vo_doublebuffering ? (vo_directrendering ? NUM_BUFFERS : 2) : 1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
193 |
12582 | 194 /* check image formats */ |
195 { | |
196 unsigned int i; | |
10855 | 197 |
12582 | 198 xv_format = 0; |
199 for (i = 0; i < formats; i++) | |
200 { | |
201 mp_msg(MSGT_VO, MSGL_V, | |
202 "Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id, | |
203 (char *) &fo[i].id, | |
204 (fo[i].format == XvPacked) ? "packed" : "planar"); | |
205 if (fo[i].id == format) | |
206 xv_format = fo[i].id; | |
207 } | |
208 if (!xv_format) | |
209 return -1; | |
210 } | |
211 aspect_save_screenres(vo_screenwidth, vo_screenheight); | |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2055
diff
changeset
|
212 |
1775 | 213 #ifdef HAVE_NEW_GUI |
12582 | 214 if (use_gui) |
215 guiGetEvent(guiSetShVideo, 0); // let the GUI to setup/resize our window | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
216 else |
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
217 #endif |
723 | 218 { |
12582 | 219 hint.x = vo_dx; |
220 hint.y = vo_dy; | |
221 aspect(&d_width, &d_height, A_NOZOOM); | |
222 hint.width = d_width; | |
223 hint.height = d_height; | |
224 #ifdef HAVE_XF86VM | |
225 if (vm) | |
226 { | |
227 if ((d_width == 0) && (d_height == 0)) | |
228 { | |
229 vm_width = image_width; | |
230 vm_height = image_height; | |
231 } else | |
232 { | |
233 vm_width = d_width; | |
234 vm_height = d_height; | |
235 } | |
236 vo_vm_switch(vm_width, vm_height, &modeline_width, | |
237 &modeline_height); | |
238 hint.x = (vo_screenwidth - modeline_width) / 2; | |
239 hint.y = (vo_screenheight - modeline_height) / 2; | |
240 hint.width = modeline_width; | |
241 hint.height = modeline_height; | |
242 aspect_save_screenres(modeline_width, modeline_height); | |
243 } else | |
244 #endif | |
245 if (vo_fs) | |
246 { | |
2054 | 247 #ifdef X11_FULLSCREEN |
12582 | 248 /* this code replaces X11_FULLSCREEN hack in mplayer.c |
249 * aspect() is available through aspect.h for all vos. | |
250 * besides zooming should only be done with -zoom, | |
251 * but I leave the old -fs behaviour so users don't get | |
252 * irritated for now (and send lots o' mails ;) ::atmos | |
253 */ | |
2031
624df8ea0e0e
New aspect prescale code, parses aspect value from mpeg sequence header or commandline.
atmos4
parents:
1924
diff
changeset
|
254 |
12582 | 255 aspect(&d_width, &d_height, A_ZOOM); |
2031
624df8ea0e0e
New aspect prescale code, parses aspect value from mpeg sequence header or commandline.
atmos4
parents:
1924
diff
changeset
|
256 #endif |
624df8ea0e0e
New aspect prescale code, parses aspect value from mpeg sequence header or commandline.
atmos4
parents:
1924
diff
changeset
|
257 |
12582 | 258 } |
5945 | 259 // dwidth=d_width; dheight=d_height; //XXX: what are the copy vars used for? |
12582 | 260 vo_dwidth = d_width; |
261 vo_dheight = d_height; | |
262 hint.flags = PPosition | PSize /* | PBaseSize */ ; | |
263 hint.base_width = hint.width; | |
264 hint.base_height = hint.height; | |
265 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), | |
266 &attribs); | |
267 depth = attribs.depth; | |
268 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) | |
269 depth = 24; | |
270 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); | |
723 | 271 |
12582 | 272 xswa.background_pixel = 0; |
273 xswa.border_pixel = 0; | |
274 xswamask = CWBackPixel | CWBorderPixel; | |
1 | 275 |
12582 | 276 if (WinID >= 0) |
277 { | |
278 vo_window = WinID ? ((Window) WinID) : mRootWin; | |
279 if (WinID) | |
280 { | |
281 XUnmapWindow(mDisplay, vo_window); | |
282 XChangeWindowAttributes(mDisplay, vo_window, xswamask, | |
283 &xswa); | |
284 vo_x11_selectinput_witherr(mDisplay, vo_window, | |
285 StructureNotifyMask | | |
286 KeyPressMask | | |
287 PropertyChangeMask | | |
288 PointerMotionMask | | |
289 ButtonPressMask | | |
290 ButtonReleaseMask | | |
291 ExposureMask); | |
292 XMapWindow(mDisplay, vo_window); | |
293 } else | |
294 { | |
295 drwX = vo_dx; | |
296 drwY = vo_dy; | |
297 } | |
298 } else if (vo_window == None) | |
299 { | |
300 vo_window = | |
301 vo_x11_create_smooth_window(mDisplay, mRootWin, | |
302 vinfo.visual, hint.x, hint.y, | |
303 hint.width, hint.height, depth, | |
304 CopyFromParent); | |
3830 | 305 |
12582 | 306 vo_x11_classhint(mDisplay, vo_window, "xv"); |
307 vo_hidecursor(mDisplay, vo_window); | |
3830 | 308 |
12582 | 309 vo_x11_selectinput_witherr(mDisplay, vo_window, |
310 StructureNotifyMask | KeyPressMask | | |
311 PropertyChangeMask | ((WinID == 0) ? | |
312 0 | |
313 : | |
314 (PointerMotionMask | |
315 | | |
316 ButtonPressMask | |
317 | | |
318 ButtonReleaseMask | |
319 | | |
320 ExposureMask))); | |
321 XSetStandardProperties(mDisplay, vo_window, hello, hello, None, | |
322 NULL, 0, &hint); | |
323 XSetWMNormalHints(mDisplay, vo_window, &hint); | |
324 XMapWindow(mDisplay, vo_window); | |
325 if (flags & 1) | |
326 vo_x11_fullscreen(); | |
327 else | |
328 { | |
3990 | 329 #ifdef HAVE_XINERAMA |
12582 | 330 vo_x11_xinerama_move(mDisplay, vo_window); |
3990 | 331 #endif |
12582 | 332 vo_x11_sizehint(hint.x, hint.y, hint.width, hint.height, |
333 0); | |
334 } | |
335 } else | |
336 { | |
337 // vo_fs set means we were already at fullscreen | |
338 vo_x11_sizehint(hint.x, hint.y, hint.width, hint.height, 0); | |
339 if (!vo_fs) | |
340 XMoveResizeWindow(mDisplay, vo_window, hint.x, hint.y, | |
341 hint.width, hint.height); | |
342 if (flags & 1 && !vo_fs) | |
343 vo_x11_fullscreen(); // handle -fs on non-first file | |
344 } | |
345 | |
9161 | 346 // vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
12582 | 347 |
348 if (vo_gc != None) | |
349 XFreeGC(mDisplay, vo_gc); | |
350 vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); | |
351 XFlush(mDisplay); | |
352 XSync(mDisplay, False); | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
353 #ifdef HAVE_XF86VM |
12582 | 354 if (vm) |
355 { | |
356 /* Grab the mouse pointer in our window */ | |
357 if (vo_grabpointer) | |
358 XGrabPointer(mDisplay, vo_window, True, 0, | |
359 GrabModeAsync, GrabModeAsync, | |
360 vo_window, None, CurrentTime); | |
361 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); | |
362 } | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
363 #endif |
12582 | 364 } |
365 | |
366 mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n", | |
367 xv_port); | |
1 | 368 |
12582 | 369 switch (xv_format) |
370 { | |
371 case IMGFMT_YV12: | |
372 case IMGFMT_I420: | |
373 case IMGFMT_IYUV: | |
374 draw_alpha_fnc = draw_alpha_yv12; | |
375 break; | |
376 case IMGFMT_YUY2: | |
377 case IMGFMT_YVYU: | |
378 draw_alpha_fnc = draw_alpha_yuy2; | |
379 break; | |
380 case IMGFMT_UYVY: | |
381 draw_alpha_fnc = draw_alpha_uyvy; | |
382 break; | |
383 default: | |
384 draw_alpha_fnc = draw_alpha_null; | |
385 } | |
182 | 386 |
12582 | 387 if (vo_config_count) |
388 for (current_buf = 0; current_buf < num_buffers; ++current_buf) | |
389 deallocate_xvimage(current_buf); | |
7757 | 390 |
12582 | 391 for (current_buf = 0; current_buf < num_buffers; ++current_buf) |
392 allocate_xvimage(current_buf); | |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
393 |
12582 | 394 current_buf = 0; |
395 current_ip_buf = 0; | |
1 | 396 |
6764
7755d1d59394
fix hue bug with nvidia's shit. i teszted with g400,radeon7500,tnt2ultra,geforce2mx200
pontscho
parents:
6760
diff
changeset
|
397 #if 0 |
12582 | 398 set_gamma_correction(); |
6764
7755d1d59394
fix hue bug with nvidia's shit. i teszted with g400,radeon7500,tnt2ultra,geforce2mx200
pontscho
parents:
6760
diff
changeset
|
399 #endif |
1818 | 400 |
12582 | 401 aspect(&vo_dwidth, &vo_dheight, A_NOZOOM); |
402 if (((flags & 1) && (WinID <= 0)) || vo_fs) | |
403 { | |
404 aspect(&vo_dwidth, &vo_dheight, A_ZOOM); | |
405 drwX = | |
406 (vo_screenwidth - | |
407 (vo_dwidth > | |
408 vo_screenwidth ? vo_screenwidth : vo_dwidth)) / 2; | |
409 drwY = | |
410 (vo_screenheight - | |
411 (vo_dheight > | |
412 vo_screenheight ? vo_screenheight : vo_dheight)) / 2; | |
413 vo_dwidth = | |
414 (vo_dwidth > vo_screenwidth ? vo_screenwidth : vo_dwidth); | |
415 vo_dheight = | |
416 (vo_dheight > vo_screenheight ? vo_screenheight : vo_dheight); | |
417 mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", | |
418 drwX, drwY, vo_dwidth, vo_dheight); | |
419 } | |
6382
86d5fc5b54e2
fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents:
6366
diff
changeset
|
420 |
12582 | 421 panscan_calc(); |
9381
007a1bdce1f4
reversed small part of the r1.135 commit, it broke -fs (random black screen)
arpi
parents:
9326
diff
changeset
|
422 |
12582 | 423 XClearWindow(mDisplay, vo_window); |
9381
007a1bdce1f4
reversed small part of the r1.135 commit, it broke -fs (random black screen)
arpi
parents:
9326
diff
changeset
|
424 #if 0 |
9161 | 425 #ifdef HAVE_SHM |
12582 | 426 if (Shmem_Flag) |
427 { | |
428 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
429 xvimage[current_buf], 0, 0, image_width, | |
430 image_height, drwX, drwY, 1, 1, False); | |
431 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
432 xvimage[current_buf], 0, 0, image_width, | |
433 image_height, drwX, drwY, vo_dwidth, | |
434 (vo_fs ? vo_dheight - 1 : vo_dheight), False); | |
435 } else | |
9161 | 436 #endif |
12582 | 437 { |
438 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
439 xvimage[current_buf], 0, 0, image_width, image_height, | |
440 drwX, drwY, 1, 1); | |
441 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
442 xvimage[current_buf], 0, 0, image_width, image_height, | |
443 drwX, drwY, vo_dwidth, | |
444 (vo_fs ? vo_dheight - 1 : vo_dheight)); | |
445 } | |
9381
007a1bdce1f4
reversed small part of the r1.135 commit, it broke -fs (random black screen)
arpi
parents:
9326
diff
changeset
|
446 #endif |
12582 | 447 |
448 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, | |
449 drwY, vo_dwidth, vo_dheight); | |
5945 | 450 |
12582 | 451 saver_off(mDisplay); // turning off screen saver |
11542 | 452 |
12582 | 453 if (vo_ontop) |
454 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
11542 | 455 |
12582 | 456 return 0; |
1 | 457 } |
458 | |
182 | 459 static void allocate_xvimage(int foo) |
1 | 460 { |
12582 | 461 /* |
462 * allocate XvImages. FIXME: no error checking, without | |
463 * mit-shm this will bomb... trzing to fix ::atmos | |
464 */ | |
6416 | 465 #ifdef HAVE_SHM |
12582 | 466 if (mLocalDisplay && XShmQueryExtension(mDisplay)) |
467 Shmem_Flag = 1; | |
468 else | |
469 { | |
470 Shmem_Flag = 0; | |
471 mp_msg(MSGT_VO, MSGL_INFO, | |
472 "Shared memory not supported\nReverting to normal Xv\n"); | |
473 } | |
474 if (Shmem_Flag) | |
475 { | |
476 xvimage[foo] = | |
477 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, | |
478 NULL, image_width, image_height, | |
479 &Shminfo[foo]); | |
1 | 480 |
12582 | 481 Shminfo[foo].shmid = |
482 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); | |
483 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); | |
484 Shminfo[foo].readOnly = False; | |
1 | 485 |
12582 | 486 xvimage[foo]->data = Shminfo[foo].shmaddr; |
487 XShmAttach(mDisplay, &Shminfo[foo]); | |
488 XSync(mDisplay, False); | |
489 shmctl(Shminfo[foo].shmid, IPC_RMID, 0); | |
490 } else | |
6416 | 491 #endif |
12582 | 492 { |
493 xvimage[foo] = | |
494 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, | |
495 image_width, image_height); | |
496 xvimage[foo]->data = malloc(xvimage[foo]->data_size); | |
497 XSync(mDisplay, False); | |
498 } | |
499 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size); | |
500 return; | |
1 | 501 } |
502 | |
1794 | 503 static void deallocate_xvimage(int foo) |
504 { | |
6416 | 505 #ifdef HAVE_SHM |
12582 | 506 if (Shmem_Flag) |
507 { | |
508 XShmDetach(mDisplay, &Shminfo[foo]); | |
509 shmdt(Shminfo[foo].shmaddr); | |
510 } else | |
6416 | 511 #endif |
12582 | 512 { |
513 free(xvimage[foo]->data); | |
514 } | |
515 XFree(xvimage[foo]); | |
516 | |
517 XFlush(mDisplay); | |
518 XSync(mDisplay, False); | |
519 return; | |
1794 | 520 } |
521 | |
31 | 522 static void check_events(void) |
1 | 523 { |
12582 | 524 int e = vo_x11_check_events(mDisplay); |
525 | |
526 if (e & VO_EVENT_EXPOSE && vo_fs) | |
527 vo_x11_clearwindow(mDisplay, vo_window); | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
528 |
12582 | 529 if (e & VO_EVENT_RESIZE) |
530 { | |
531 if (vo_fs) | |
532 { | |
533 e |= VO_EVENT_EXPOSE; | |
534 XClearWindow(mDisplay, vo_window); | |
535 XFlush(mDisplay); | |
536 } | |
537 | |
538 XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &vo_dwidth, | |
539 &vo_dheight, &drwBorderWidth, &drwDepth); | |
540 drwX = drwY = 0; | |
541 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, | |
542 drwY, vo_dwidth, vo_dheight); | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
543 |
12582 | 544 aspect(&dwidth, &dheight, A_NOZOOM); |
545 if (vo_fs) | |
546 { | |
547 aspect(&dwidth, &dheight, A_ZOOM); | |
548 drwX = | |
549 (vo_screenwidth - | |
550 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2; | |
551 drwY = | |
552 (vo_screenheight - | |
553 (dheight > | |
554 vo_screenheight ? vo_screenheight : dheight)) / 2; | |
555 vo_dwidth = | |
556 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth); | |
557 vo_dheight = | |
558 (dheight > vo_screenheight ? vo_screenheight : dheight); | |
559 mp_msg(MSGT_VO, MSGL_V, | |
560 "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", drwX, drwY, | |
561 vo_dwidth, vo_dheight); | |
562 } | |
563 } | |
1 | 564 |
12582 | 565 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) |
566 flip_page(); | |
1 | 567 } |
568 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
569 static void draw_osd(void) |
12582 | 570 { |
571 vo_draw_text(image_width - | |
572 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x), | |
573 image_height, draw_alpha_fnc); | |
574 } | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
575 |
182 | 576 static void flip_page(void) |
1 | 577 { |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
578 |
6416 | 579 #ifdef HAVE_SHM |
12582 | 580 if (Shmem_Flag) |
581 { | |
582 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
583 xvimage[current_buf], 0, 0, image_width, | |
584 image_height, drwX - (vo_panscan_x >> 1), | |
585 drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x, | |
586 (vo_fs ? vo_dheight - 1 : vo_dheight) + vo_panscan_y, | |
587 False); | |
588 } else | |
6416 | 589 #endif |
12582 | 590 { |
591 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
592 xvimage[current_buf], 0, 0, image_width, image_height, | |
593 drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1), | |
594 vo_dwidth + vo_panscan_x, | |
595 (vo_fs ? vo_dheight - 1 : vo_dheight) + vo_panscan_y); | |
596 } | |
597 if (num_buffers > 1) | |
598 { | |
599 current_buf = | |
600 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers); | |
601 XFlush(mDisplay); | |
602 } else | |
603 XSync(mDisplay, False); | |
604 return; | |
1 | 605 } |
606 | |
12582 | 607 static uint32_t draw_slice(uint8_t * image[], int stride[], int w, int h, |
608 int x, int y) | |
1 | 609 { |
12582 | 610 uint8_t *dst; |
182 | 611 |
12582 | 612 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + |
613 xvimage[current_buf]->pitches[0] * y + x; | |
614 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0], | |
615 stride[0]); | |
182 | 616 |
12582 | 617 x /= 2; |
618 y /= 2; | |
619 w /= 2; | |
620 h /= 2; | |
1 | 621 |
12582 | 622 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + |
623 xvimage[current_buf]->pitches[1] * y + x; | |
624 if (image_format != IMGFMT_YV12) | |
625 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
626 stride[1]); | |
627 else | |
628 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
629 stride[2]); | |
5316 | 630 |
12582 | 631 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + |
632 xvimage[current_buf]->pitches[2] * y + x; | |
633 if (image_format == IMGFMT_YV12) | |
634 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
635 stride[1]); | |
636 else | |
637 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
638 stride[2]); | |
6231 | 639 |
12582 | 640 return 0; |
1 | 641 } |
642 | |
12582 | 643 static uint32_t draw_frame(uint8_t * src[]) |
644 { | |
7684 | 645 printf("draw_frame() called!!!!!!"); |
646 return -1; | |
1 | 647 } |
648 | |
12582 | 649 static uint32_t draw_image(mp_image_t * mpi) |
650 { | |
651 if (mpi->flags & MP_IMGFLAG_DIRECT) | |
652 { | |
653 // direct rendering: | |
654 current_buf = (int) (mpi->priv); // hack! | |
655 return VO_TRUE; | |
6760 | 656 } |
12582 | 657 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
658 return VO_TRUE; // done | |
659 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
660 { | |
661 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); | |
662 return VO_TRUE; | |
7684 | 663 } |
12582 | 664 if (mpi->flags & MP_IMGFLAG_YUV) |
665 { | |
666 // packed YUV: | |
667 memcpy_pic(xvimage[current_buf]->data + | |
668 xvimage[current_buf]->offsets[0], mpi->planes[0], | |
669 mpi->w * (mpi->bpp / 8), mpi->h, | |
670 xvimage[current_buf]->pitches[0], mpi->stride[0]); | |
671 return VO_TRUE; | |
7684 | 672 } |
12582 | 673 return VO_FALSE; // not (yet) supported |
6760 | 674 } |
675 | |
12582 | 676 static uint32_t get_image(mp_image_t * mpi) |
677 { | |
678 int buf = current_buf; // we shouldn't change current_buf unless we do DR! | |
679 | |
680 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1) | |
681 return VO_FALSE; // it is not static | |
682 if (mpi->imgfmt != image_format) | |
683 return VO_FALSE; // needs conversion :( | |
4980 | 684 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
12582 | 685 if (mpi->flags & MP_IMGFLAG_READABLE && |
686 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) | |
687 { | |
688 // reference (I/P) frame of IP or IPB: | |
689 if (num_buffers < 2) | |
690 return VO_FALSE; // not enough | |
691 current_ip_buf ^= 1; | |
692 // for IPB with 2 buffers we can DR only one of the 2 P frames: | |
693 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3 | |
694 && current_ip_buf) | |
695 return VO_FALSE; | |
696 buf = current_ip_buf; | |
697 if (mpi->type == MP_IMGTYPE_IPB) | |
698 ++buf; // preserve space for B | |
6758
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
699 } |
12582 | 700 if (mpi->height > xvimage[buf]->height) |
701 return VO_FALSE; //buffer to small | |
702 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0]) | |
703 return VO_FALSE; //buffer to small | |
704 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) | |
705 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0])) | |
706 { | |
707 current_buf = buf; | |
708 mpi->planes[0] = | |
709 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0]; | |
710 mpi->stride[0] = xvimage[current_buf]->pitches[0]; | |
711 mpi->width = mpi->stride[0] / (mpi->bpp / 8); | |
712 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
713 { | |
714 if (mpi->flags & MP_IMGFLAG_SWAPPED) | |
715 { | |
716 // I420 | |
717 mpi->planes[1] = | |
718 xvimage[current_buf]->data + | |
719 xvimage[current_buf]->offsets[1]; | |
720 mpi->planes[2] = | |
721 xvimage[current_buf]->data + | |
722 xvimage[current_buf]->offsets[2]; | |
723 mpi->stride[1] = xvimage[current_buf]->pitches[1]; | |
724 mpi->stride[2] = xvimage[current_buf]->pitches[2]; | |
725 } else | |
726 { | |
727 // YV12 | |
728 mpi->planes[1] = | |
729 xvimage[current_buf]->data + | |
730 xvimage[current_buf]->offsets[2]; | |
731 mpi->planes[2] = | |
732 xvimage[current_buf]->data + | |
733 xvimage[current_buf]->offsets[1]; | |
734 mpi->stride[1] = xvimage[current_buf]->pitches[2]; | |
735 mpi->stride[2] = xvimage[current_buf]->pitches[1]; | |
736 } | |
737 } | |
738 mpi->flags |= MP_IMGFLAG_DIRECT; | |
739 mpi->priv = (void *) current_buf; | |
740 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
741 return VO_TRUE; | |
4980 | 742 } |
743 return VO_FALSE; | |
744 } | |
745 | |
182 | 746 static uint32_t query_format(uint32_t format) |
1 | 747 { |
10855 | 748 uint32_t i; |
12582 | 749 int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN |
750 | |
751 /* check image formats */ | |
752 for (i = 0; i < formats; i++) | |
753 { | |
754 if (fo[i].id == format) | |
755 return flag; //xv_format = fo[i].id; | |
756 } | |
757 return 0; | |
1 | 758 } |
759 | |
12582 | 760 static void uninit(void) |
1852 | 761 { |
12582 | 762 int i; |
763 | |
764 if (!vo_config_count) | |
765 return; | |
766 XvFreeAdaptorInfo(ai); | |
767 ai = NULL; | |
768 saver_on(mDisplay); // screen saver back on | |
769 for (i = 0; i < num_buffers; i++) | |
770 deallocate_xvimage(i); | |
6016 | 771 #ifdef HAVE_XF86VM |
12582 | 772 vo_vm_close(mDisplay); |
6016 | 773 #endif |
12582 | 774 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
775 } |
1 | 776 |
4352 | 777 static uint32_t preinit(const char *arg) |
778 { | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
779 XvPortID xv_p; |
12582 | 780 int busy_ports = 0; |
10855 | 781 unsigned int i; |
12582 | 782 |
10826 | 783 xv_port = 0; |
784 | |
12582 | 785 if (arg) |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
786 { |
12582 | 787 if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5)) |
788 { | |
789 xv_port = atoi(arg + 5); | |
790 } else | |
791 { | |
792 mp_msg(MSGT_VO, MSGL_ERR, "vo_xv: Unknown subdevice: %s\n", | |
793 arg); | |
794 return ENOSYS; | |
795 } | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
796 } |
12582 | 797 if (!vo_init()) |
798 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
799 |
12582 | 800 /* check for Xvideo extension */ |
801 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
802 { | |
803 mp_msg(MSGT_VO, MSGL_ERR, | |
804 "Sorry, Xv not supported by this X11 version/driver\n"); | |
805 mp_msg(MSGT_VO, MSGL_ERR, | |
806 "******** Try with -vo x11 or -vo sdl *********\n"); | |
807 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
808 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
809 |
12582 | 810 /* check for Xvideo support */ |
811 if (Success != | |
812 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
813 &ai)) | |
814 { | |
815 mp_msg(MSGT_VO, MSGL_ERR, "Xv: XvQueryAdaptors failed\n"); | |
816 return -1; | |
817 } | |
818 | |
819 /* check adaptors */ | |
820 if (xv_port) | |
821 { | |
10839 | 822 int port_found; |
12582 | 823 |
824 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
825 { | |
826 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
827 { | |
828 for (xv_p = ai[i].base_id; | |
829 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
830 { | |
831 if (xv_p == xv_port) | |
832 { | |
10839 | 833 port_found = 1; |
834 break; | |
835 } | |
836 } | |
837 } | |
838 } | |
12582 | 839 if (port_found) |
840 { | |
10839 | 841 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
842 xv_port = 0; | |
12582 | 843 } else |
844 { | |
845 mp_msg(MSGT_VO, MSGL_WARN, | |
846 "Xv: Invalid port parameter, overriding with port 0\n"); | |
10839 | 847 xv_port = 0; |
848 } | |
10826 | 849 } |
12582 | 850 |
851 for (i = 0; i < adaptors && xv_port == 0; i++) | |
852 { | |
853 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
854 { | |
855 for (xv_p = ai[i].base_id; | |
856 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
857 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
858 { | |
859 xv_port = xv_p; | |
860 break; | |
861 } else | |
862 { | |
863 mp_msg(MSGT_VO, MSGL_WARN, | |
864 "Xv: could not grab port %i\n", (int) xv_p); | |
865 ++busy_ports; | |
866 } | |
867 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
868 } |
12582 | 869 if (!xv_port) |
870 { | |
871 if (busy_ports) | |
872 mp_msg(MSGT_VO, MSGL_ERR, | |
873 "Could not find free Xvideo port - maybe another process is already using it.\n" | |
874 "Close all video applications, and try again. If that does not help,\n" | |
875 "see 'mplayer -vo help' for other (non-xv) video out drivers.\n"); | |
876 else | |
877 mp_msg(MSGT_VO, MSGL_ERR, | |
878 "It seems there is no Xvideo support for your video card available.\n" | |
879 "Run 'xvinfo' to verify its Xv support and read DOCS/HTML/en/devices.html#xv!\n" | |
880 "See 'mplayer -vo help' for other (non-xv) video out drivers. Try -vo x11\n"); | |
881 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
882 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
883 |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
884 { |
12582 | 885 int howmany, i; |
886 const XvAttribute *const attributes = | |
887 XvQueryPortAttributes(mDisplay, xv_port, &howmany); | |
888 | |
889 for (i = 0; i < howmany && attributes; i++) | |
890 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) | |
891 { | |
892 const Atom autopaint = | |
893 XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); | |
894 XvSetPortAttribute(mDisplay, xv_port, autopaint, 1); | |
895 break; | |
896 } | |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
897 } |
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
898 |
12582 | 899 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats); |
5566 | 900 |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
901 return 0; |
4352 | 902 } |
1 | 903 |
4596 | 904 static uint32_t control(uint32_t request, void *data, ...) |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
905 { |
12582 | 906 switch (request) |
907 { | |
908 case VOCTRL_PAUSE: | |
909 return (int_pause = 1); | |
910 case VOCTRL_RESUME: | |
911 return (int_pause = 0); | |
912 case VOCTRL_QUERY_FORMAT: | |
913 return query_format(*((uint32_t *) data)); | |
914 case VOCTRL_GET_IMAGE: | |
915 return get_image(data); | |
916 case VOCTRL_DRAW_IMAGE: | |
917 return draw_image(data); | |
918 case VOCTRL_GUISUPPORT: | |
919 return VO_TRUE; | |
920 case VOCTRL_GET_PANSCAN: | |
921 if (!vo_config_count || !vo_fs) | |
922 return VO_FALSE; | |
923 return VO_TRUE; | |
924 case VOCTRL_FULLSCREEN: | |
925 vo_x11_fullscreen(); | |
926 /* indended, fallthrough to update panscan on fullscreen/windowed switch */ | |
927 case VOCTRL_SET_PANSCAN: | |
928 if ((vo_fs && (vo_panscan != vo_panscan_amount)) | |
929 || (!vo_fs && vo_panscan_amount)) | |
930 { | |
931 int old_y = vo_panscan_y; | |
932 | |
933 panscan_calc(); | |
934 | |
935 if (old_y != vo_panscan_y) | |
936 { | |
937 vo_x11_clearwindow_part(mDisplay, vo_window, | |
938 vo_dwidth + vo_panscan_x - 1, | |
939 vo_dheight + vo_panscan_y - 1, | |
940 1); | |
941 flip_page(); | |
942 } | |
943 } | |
944 return VO_TRUE; | |
945 case VOCTRL_SET_EQUALIZER: | |
946 { | |
947 va_list ap; | |
948 int value; | |
949 | |
950 va_start(ap, data); | |
951 value = va_arg(ap, int); | |
952 | |
953 va_end(ap); | |
954 | |
955 return (vo_xv_set_eq(xv_port, data, value)); | |
956 } | |
957 case VOCTRL_GET_EQUALIZER: | |
958 { | |
959 va_list ap; | |
960 int *value; | |
961 | |
962 va_start(ap, data); | |
963 value = va_arg(ap, int *); | |
964 | |
965 va_end(ap); | |
966 | |
967 return (vo_xv_get_eq(xv_port, data, value)); | |
968 } | |
969 case VOCTRL_ONTOP: | |
970 vo_x11_ontop(); | |
971 return VO_TRUE; | |
972 } | |
973 return VO_NOTIMPL; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
974 } |