Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 14483:c9b33c50a095
synced to 1.54
author | gabrov |
---|---|
date | Thu, 13 Jan 2005 08:33:40 +0000 |
parents | 3dbebe82fc37 |
children | 76d461a061df |
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 |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13242
diff
changeset
|
40 #include "Gui/interface.h" |
5955
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; |
13953 | 71 static XvImageFormatValues *fo=NULL; |
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 XSync(mDisplay, False); | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
352 #ifdef HAVE_XF86VM |
12582 | 353 if (vm) |
354 { | |
355 /* Grab the mouse pointer in our window */ | |
356 if (vo_grabpointer) | |
357 XGrabPointer(mDisplay, vo_window, True, 0, | |
358 GrabModeAsync, GrabModeAsync, | |
359 vo_window, None, CurrentTime); | |
360 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); | |
361 } | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
362 #endif |
12582 | 363 } |
364 | |
365 mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n", | |
366 xv_port); | |
1 | 367 |
12582 | 368 switch (xv_format) |
369 { | |
370 case IMGFMT_YV12: | |
371 case IMGFMT_I420: | |
372 case IMGFMT_IYUV: | |
373 draw_alpha_fnc = draw_alpha_yv12; | |
374 break; | |
375 case IMGFMT_YUY2: | |
376 case IMGFMT_YVYU: | |
377 draw_alpha_fnc = draw_alpha_yuy2; | |
378 break; | |
379 case IMGFMT_UYVY: | |
380 draw_alpha_fnc = draw_alpha_uyvy; | |
381 break; | |
382 default: | |
383 draw_alpha_fnc = draw_alpha_null; | |
384 } | |
182 | 385 |
12582 | 386 if (vo_config_count) |
387 for (current_buf = 0; current_buf < num_buffers; ++current_buf) | |
388 deallocate_xvimage(current_buf); | |
7757 | 389 |
12582 | 390 for (current_buf = 0; current_buf < num_buffers; ++current_buf) |
391 allocate_xvimage(current_buf); | |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
392 |
12582 | 393 current_buf = 0; |
394 current_ip_buf = 0; | |
1 | 395 |
6764
7755d1d59394
fix hue bug with nvidia's shit. i teszted with g400,radeon7500,tnt2ultra,geforce2mx200
pontscho
parents:
6760
diff
changeset
|
396 #if 0 |
12582 | 397 set_gamma_correction(); |
6764
7755d1d59394
fix hue bug with nvidia's shit. i teszted with g400,radeon7500,tnt2ultra,geforce2mx200
pontscho
parents:
6760
diff
changeset
|
398 #endif |
1818 | 399 |
12582 | 400 aspect(&vo_dwidth, &vo_dheight, A_NOZOOM); |
401 if (((flags & 1) && (WinID <= 0)) || vo_fs) | |
402 { | |
403 aspect(&vo_dwidth, &vo_dheight, A_ZOOM); | |
404 drwX = | |
405 (vo_screenwidth - | |
406 (vo_dwidth > | |
407 vo_screenwidth ? vo_screenwidth : vo_dwidth)) / 2; | |
408 drwY = | |
409 (vo_screenheight - | |
410 (vo_dheight > | |
411 vo_screenheight ? vo_screenheight : vo_dheight)) / 2; | |
412 vo_dwidth = | |
413 (vo_dwidth > vo_screenwidth ? vo_screenwidth : vo_dwidth); | |
414 vo_dheight = | |
415 (vo_dheight > vo_screenheight ? vo_screenheight : vo_dheight); | |
416 mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", | |
417 drwX, drwY, vo_dwidth, vo_dheight); | |
418 } | |
6382
86d5fc5b54e2
fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents:
6366
diff
changeset
|
419 |
12582 | 420 panscan_calc(); |
9381
007a1bdce1f4
reversed small part of the r1.135 commit, it broke -fs (random black screen)
arpi
parents:
9326
diff
changeset
|
421 |
12582 | 422 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
|
423 #if 0 |
9161 | 424 #ifdef HAVE_SHM |
12582 | 425 if (Shmem_Flag) |
426 { | |
427 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
428 xvimage[current_buf], 0, 0, image_width, | |
429 image_height, drwX, drwY, 1, 1, False); | |
430 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
431 xvimage[current_buf], 0, 0, image_width, | |
432 image_height, drwX, drwY, vo_dwidth, | |
433 (vo_fs ? vo_dheight - 1 : vo_dheight), False); | |
434 } else | |
9161 | 435 #endif |
12582 | 436 { |
437 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
438 xvimage[current_buf], 0, 0, image_width, image_height, | |
439 drwX, drwY, 1, 1); | |
440 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
441 xvimage[current_buf], 0, 0, image_width, image_height, | |
442 drwX, drwY, vo_dwidth, | |
443 (vo_fs ? vo_dheight - 1 : vo_dheight)); | |
444 } | |
9381
007a1bdce1f4
reversed small part of the r1.135 commit, it broke -fs (random black screen)
arpi
parents:
9326
diff
changeset
|
445 #endif |
12582 | 446 |
447 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, | |
448 drwY, vo_dwidth, vo_dheight); | |
5945 | 449 |
12582 | 450 if (vo_ontop) |
451 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
11542 | 452 |
12582 | 453 return 0; |
1 | 454 } |
455 | |
182 | 456 static void allocate_xvimage(int foo) |
1 | 457 { |
12582 | 458 /* |
459 * allocate XvImages. FIXME: no error checking, without | |
460 * mit-shm this will bomb... trzing to fix ::atmos | |
461 */ | |
6416 | 462 #ifdef HAVE_SHM |
12582 | 463 if (mLocalDisplay && XShmQueryExtension(mDisplay)) |
464 Shmem_Flag = 1; | |
465 else | |
466 { | |
467 Shmem_Flag = 0; | |
468 mp_msg(MSGT_VO, MSGL_INFO, | |
469 "Shared memory not supported\nReverting to normal Xv\n"); | |
470 } | |
471 if (Shmem_Flag) | |
472 { | |
473 xvimage[foo] = | |
474 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, | |
475 NULL, image_width, image_height, | |
476 &Shminfo[foo]); | |
1 | 477 |
12582 | 478 Shminfo[foo].shmid = |
479 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); | |
480 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); | |
481 Shminfo[foo].readOnly = False; | |
1 | 482 |
12582 | 483 xvimage[foo]->data = Shminfo[foo].shmaddr; |
484 XShmAttach(mDisplay, &Shminfo[foo]); | |
485 XSync(mDisplay, False); | |
486 shmctl(Shminfo[foo].shmid, IPC_RMID, 0); | |
487 } else | |
6416 | 488 #endif |
12582 | 489 { |
490 xvimage[foo] = | |
491 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, | |
492 image_width, image_height); | |
493 xvimage[foo]->data = malloc(xvimage[foo]->data_size); | |
494 XSync(mDisplay, False); | |
495 } | |
496 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size); | |
497 return; | |
1 | 498 } |
499 | |
1794 | 500 static void deallocate_xvimage(int foo) |
501 { | |
6416 | 502 #ifdef HAVE_SHM |
12582 | 503 if (Shmem_Flag) |
504 { | |
505 XShmDetach(mDisplay, &Shminfo[foo]); | |
506 shmdt(Shminfo[foo].shmaddr); | |
507 } else | |
6416 | 508 #endif |
12582 | 509 { |
510 free(xvimage[foo]->data); | |
511 } | |
512 XFree(xvimage[foo]); | |
513 | |
514 XSync(mDisplay, False); | |
515 return; | |
1794 | 516 } |
517 | |
31 | 518 static void check_events(void) |
1 | 519 { |
12582 | 520 int e = vo_x11_check_events(mDisplay); |
521 | |
522 if (e & VO_EVENT_EXPOSE && vo_fs) | |
523 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
|
524 |
12582 | 525 if (e & VO_EVENT_RESIZE) |
526 { | |
527 if (vo_fs) | |
528 { | |
529 e |= VO_EVENT_EXPOSE; | |
530 XClearWindow(mDisplay, vo_window); | |
531 XFlush(mDisplay); | |
532 } | |
533 | |
534 XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &vo_dwidth, | |
535 &vo_dheight, &drwBorderWidth, &drwDepth); | |
536 drwX = drwY = 0; | |
537 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, | |
538 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
|
539 |
12582 | 540 aspect(&dwidth, &dheight, A_NOZOOM); |
541 if (vo_fs) | |
542 { | |
543 aspect(&dwidth, &dheight, A_ZOOM); | |
544 drwX = | |
545 (vo_screenwidth - | |
546 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2; | |
547 drwY = | |
548 (vo_screenheight - | |
549 (dheight > | |
550 vo_screenheight ? vo_screenheight : dheight)) / 2; | |
551 vo_dwidth = | |
552 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth); | |
553 vo_dheight = | |
554 (dheight > vo_screenheight ? vo_screenheight : dheight); | |
555 mp_msg(MSGT_VO, MSGL_V, | |
556 "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", drwX, drwY, | |
557 vo_dwidth, vo_dheight); | |
558 } | |
559 } | |
1 | 560 |
12582 | 561 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) |
562 flip_page(); | |
1 | 563 } |
564 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
565 static void draw_osd(void) |
12582 | 566 { |
567 vo_draw_text(image_width - | |
568 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x), | |
569 image_height, draw_alpha_fnc); | |
570 } | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
571 |
182 | 572 static void flip_page(void) |
1 | 573 { |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
574 |
6416 | 575 #ifdef HAVE_SHM |
12582 | 576 if (Shmem_Flag) |
577 { | |
578 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
579 xvimage[current_buf], 0, 0, image_width, | |
580 image_height, drwX - (vo_panscan_x >> 1), | |
581 drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x, | |
13242
185d052020e5
We don't need to support the old nvidia binary driver bug any longer.
al
parents:
13056
diff
changeset
|
582 vo_dheight + vo_panscan_y, |
12582 | 583 False); |
584 } else | |
6416 | 585 #endif |
12582 | 586 { |
587 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
588 xvimage[current_buf], 0, 0, image_width, image_height, | |
589 drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1), | |
590 vo_dwidth + vo_panscan_x, | |
13242
185d052020e5
We don't need to support the old nvidia binary driver bug any longer.
al
parents:
13056
diff
changeset
|
591 vo_dheight + vo_panscan_y); |
12582 | 592 } |
593 if (num_buffers > 1) | |
594 { | |
595 current_buf = | |
596 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers); | |
597 XFlush(mDisplay); | |
598 } else | |
599 XSync(mDisplay, False); | |
600 return; | |
1 | 601 } |
602 | |
12582 | 603 static uint32_t draw_slice(uint8_t * image[], int stride[], int w, int h, |
604 int x, int y) | |
1 | 605 { |
12582 | 606 uint8_t *dst; |
182 | 607 |
12582 | 608 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + |
609 xvimage[current_buf]->pitches[0] * y + x; | |
610 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0], | |
611 stride[0]); | |
182 | 612 |
12582 | 613 x /= 2; |
614 y /= 2; | |
615 w /= 2; | |
616 h /= 2; | |
1 | 617 |
12582 | 618 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + |
619 xvimage[current_buf]->pitches[1] * y + x; | |
620 if (image_format != IMGFMT_YV12) | |
621 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
622 stride[1]); | |
623 else | |
624 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
625 stride[2]); | |
5316 | 626 |
12582 | 627 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + |
628 xvimage[current_buf]->pitches[2] * y + x; | |
629 if (image_format == IMGFMT_YV12) | |
630 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
631 stride[1]); | |
632 else | |
633 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
634 stride[2]); | |
6231 | 635 |
12582 | 636 return 0; |
1 | 637 } |
638 | |
12582 | 639 static uint32_t draw_frame(uint8_t * src[]) |
640 { | |
7684 | 641 printf("draw_frame() called!!!!!!"); |
642 return -1; | |
1 | 643 } |
644 | |
12582 | 645 static uint32_t draw_image(mp_image_t * mpi) |
646 { | |
647 if (mpi->flags & MP_IMGFLAG_DIRECT) | |
648 { | |
649 // direct rendering: | |
650 current_buf = (int) (mpi->priv); // hack! | |
651 return VO_TRUE; | |
6760 | 652 } |
12582 | 653 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
654 return VO_TRUE; // done | |
655 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
656 { | |
657 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); | |
658 return VO_TRUE; | |
7684 | 659 } |
12582 | 660 if (mpi->flags & MP_IMGFLAG_YUV) |
661 { | |
662 // packed YUV: | |
663 memcpy_pic(xvimage[current_buf]->data + | |
664 xvimage[current_buf]->offsets[0], mpi->planes[0], | |
665 mpi->w * (mpi->bpp / 8), mpi->h, | |
666 xvimage[current_buf]->pitches[0], mpi->stride[0]); | |
667 return VO_TRUE; | |
7684 | 668 } |
12582 | 669 return VO_FALSE; // not (yet) supported |
6760 | 670 } |
671 | |
12582 | 672 static uint32_t get_image(mp_image_t * mpi) |
673 { | |
674 int buf = current_buf; // we shouldn't change current_buf unless we do DR! | |
675 | |
676 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1) | |
677 return VO_FALSE; // it is not static | |
678 if (mpi->imgfmt != image_format) | |
679 return VO_FALSE; // needs conversion :( | |
4980 | 680 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
12582 | 681 if (mpi->flags & MP_IMGFLAG_READABLE && |
682 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) | |
683 { | |
684 // reference (I/P) frame of IP or IPB: | |
685 if (num_buffers < 2) | |
686 return VO_FALSE; // not enough | |
687 current_ip_buf ^= 1; | |
688 // for IPB with 2 buffers we can DR only one of the 2 P frames: | |
689 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3 | |
690 && current_ip_buf) | |
691 return VO_FALSE; | |
692 buf = current_ip_buf; | |
693 if (mpi->type == MP_IMGTYPE_IPB) | |
694 ++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
|
695 } |
12582 | 696 if (mpi->height > xvimage[buf]->height) |
697 return VO_FALSE; //buffer to small | |
698 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0]) | |
699 return VO_FALSE; //buffer to small | |
700 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) | |
701 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0])) | |
702 { | |
703 current_buf = buf; | |
704 mpi->planes[0] = | |
705 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0]; | |
706 mpi->stride[0] = xvimage[current_buf]->pitches[0]; | |
707 mpi->width = mpi->stride[0] / (mpi->bpp / 8); | |
708 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
709 { | |
710 if (mpi->flags & MP_IMGFLAG_SWAPPED) | |
711 { | |
712 // I420 | |
713 mpi->planes[1] = | |
714 xvimage[current_buf]->data + | |
715 xvimage[current_buf]->offsets[1]; | |
716 mpi->planes[2] = | |
717 xvimage[current_buf]->data + | |
718 xvimage[current_buf]->offsets[2]; | |
719 mpi->stride[1] = xvimage[current_buf]->pitches[1]; | |
720 mpi->stride[2] = xvimage[current_buf]->pitches[2]; | |
721 } else | |
722 { | |
723 // YV12 | |
724 mpi->planes[1] = | |
725 xvimage[current_buf]->data + | |
726 xvimage[current_buf]->offsets[2]; | |
727 mpi->planes[2] = | |
728 xvimage[current_buf]->data + | |
729 xvimage[current_buf]->offsets[1]; | |
730 mpi->stride[1] = xvimage[current_buf]->pitches[2]; | |
731 mpi->stride[2] = xvimage[current_buf]->pitches[1]; | |
732 } | |
733 } | |
734 mpi->flags |= MP_IMGFLAG_DIRECT; | |
735 mpi->priv = (void *) current_buf; | |
736 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
737 return VO_TRUE; | |
4980 | 738 } |
739 return VO_FALSE; | |
740 } | |
741 | |
182 | 742 static uint32_t query_format(uint32_t format) |
1 | 743 { |
10855 | 744 uint32_t i; |
12582 | 745 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 |
746 | |
747 /* check image formats */ | |
748 for (i = 0; i < formats; i++) | |
749 { | |
750 if (fo[i].id == format) | |
751 return flag; //xv_format = fo[i].id; | |
752 } | |
753 return 0; | |
1 | 754 } |
755 | |
12582 | 756 static void uninit(void) |
1852 | 757 { |
12582 | 758 int i; |
759 | |
760 if (!vo_config_count) | |
761 return; | |
762 XvFreeAdaptorInfo(ai); | |
763 ai = NULL; | |
13953 | 764 if(fo){ |
765 XFree(fo); | |
766 fo=NULL; | |
767 } | |
12582 | 768 for (i = 0; i < num_buffers; i++) |
769 deallocate_xvimage(i); | |
6016 | 770 #ifdef HAVE_XF86VM |
12582 | 771 vo_vm_close(mDisplay); |
6016 | 772 #endif |
12582 | 773 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
774 } |
1 | 775 |
4352 | 776 static uint32_t preinit(const char *arg) |
777 { | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
778 XvPortID xv_p; |
12582 | 779 int busy_ports = 0; |
10855 | 780 unsigned int i; |
12582 | 781 |
10826 | 782 xv_port = 0; |
783 | |
12582 | 784 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
|
785 { |
12582 | 786 if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5)) |
787 { | |
788 xv_port = atoi(arg + 5); | |
789 } else | |
790 { | |
791 mp_msg(MSGT_VO, MSGL_ERR, "vo_xv: Unknown subdevice: %s\n", | |
792 arg); | |
793 return ENOSYS; | |
794 } | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
795 } |
12582 | 796 if (!vo_init()) |
797 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
798 |
12582 | 799 /* check for Xvideo extension */ |
800 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
801 { | |
802 mp_msg(MSGT_VO, MSGL_ERR, | |
803 "Sorry, Xv not supported by this X11 version/driver\n"); | |
804 mp_msg(MSGT_VO, MSGL_ERR, | |
805 "******** Try with -vo x11 or -vo sdl *********\n"); | |
806 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
807 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
808 |
12582 | 809 /* check for Xvideo support */ |
810 if (Success != | |
811 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
812 &ai)) | |
813 { | |
814 mp_msg(MSGT_VO, MSGL_ERR, "Xv: XvQueryAdaptors failed\n"); | |
815 return -1; | |
816 } | |
817 | |
818 /* check adaptors */ | |
819 if (xv_port) | |
820 { | |
10839 | 821 int port_found; |
12582 | 822 |
823 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
824 { | |
825 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
826 { | |
827 for (xv_p = ai[i].base_id; | |
828 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
829 { | |
830 if (xv_p == xv_port) | |
831 { | |
10839 | 832 port_found = 1; |
833 break; | |
834 } | |
835 } | |
836 } | |
837 } | |
12582 | 838 if (port_found) |
839 { | |
10839 | 840 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
841 xv_port = 0; | |
12582 | 842 } else |
843 { | |
844 mp_msg(MSGT_VO, MSGL_WARN, | |
845 "Xv: Invalid port parameter, overriding with port 0\n"); | |
10839 | 846 xv_port = 0; |
847 } | |
10826 | 848 } |
12582 | 849 |
850 for (i = 0; i < adaptors && xv_port == 0; i++) | |
851 { | |
852 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
853 { | |
854 for (xv_p = ai[i].base_id; | |
855 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
856 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
857 { | |
858 xv_port = xv_p; | |
859 break; | |
860 } else | |
861 { | |
862 mp_msg(MSGT_VO, MSGL_WARN, | |
863 "Xv: could not grab port %i\n", (int) xv_p); | |
864 ++busy_ports; | |
865 } | |
866 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
867 } |
12582 | 868 if (!xv_port) |
869 { | |
870 if (busy_ports) | |
871 mp_msg(MSGT_VO, MSGL_ERR, | |
872 "Could not find free Xvideo port - maybe another process is already using it.\n" | |
873 "Close all video applications, and try again. If that does not help,\n" | |
874 "see 'mplayer -vo help' for other (non-xv) video out drivers.\n"); | |
875 else | |
876 mp_msg(MSGT_VO, MSGL_ERR, | |
877 "It seems there is no Xvideo support for your video card available.\n" | |
13914 | 878 "Run 'xvinfo' to verify its Xv support and read DOCS/HTML/en/video.html#xv!\n" |
12582 | 879 "See 'mplayer -vo help' for other (non-xv) video out drivers. Try -vo x11\n"); |
880 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
881 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
882 |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
883 { |
12582 | 884 int howmany, i; |
13953 | 885 XvAttribute * const attributes = |
12582 | 886 XvQueryPortAttributes(mDisplay, xv_port, &howmany); |
887 | |
888 for (i = 0; i < howmany && attributes; i++) | |
889 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) | |
890 { | |
891 const Atom autopaint = | |
892 XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); | |
893 XvSetPortAttribute(mDisplay, xv_port, autopaint, 1); | |
894 break; | |
895 } | |
13953 | 896 XFree(attributes); |
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 } |