Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 13026:ac2713aff2a7
Reorganized init/unint so that fixed-vo works.
author | syrjala |
---|---|
date | Sun, 15 Aug 2004 00:12:34 +0000 |
parents | 3cd9add91f97 |
children | 1c2f6de431bf |
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 if (vo_ontop) |
452 vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
11542 | 453 |
12582 | 454 return 0; |
1 | 455 } |
456 | |
182 | 457 static void allocate_xvimage(int foo) |
1 | 458 { |
12582 | 459 /* |
460 * allocate XvImages. FIXME: no error checking, without | |
461 * mit-shm this will bomb... trzing to fix ::atmos | |
462 */ | |
6416 | 463 #ifdef HAVE_SHM |
12582 | 464 if (mLocalDisplay && XShmQueryExtension(mDisplay)) |
465 Shmem_Flag = 1; | |
466 else | |
467 { | |
468 Shmem_Flag = 0; | |
469 mp_msg(MSGT_VO, MSGL_INFO, | |
470 "Shared memory not supported\nReverting to normal Xv\n"); | |
471 } | |
472 if (Shmem_Flag) | |
473 { | |
474 xvimage[foo] = | |
475 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, | |
476 NULL, image_width, image_height, | |
477 &Shminfo[foo]); | |
1 | 478 |
12582 | 479 Shminfo[foo].shmid = |
480 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); | |
481 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); | |
482 Shminfo[foo].readOnly = False; | |
1 | 483 |
12582 | 484 xvimage[foo]->data = Shminfo[foo].shmaddr; |
485 XShmAttach(mDisplay, &Shminfo[foo]); | |
486 XSync(mDisplay, False); | |
487 shmctl(Shminfo[foo].shmid, IPC_RMID, 0); | |
488 } else | |
6416 | 489 #endif |
12582 | 490 { |
491 xvimage[foo] = | |
492 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, | |
493 image_width, image_height); | |
494 xvimage[foo]->data = malloc(xvimage[foo]->data_size); | |
495 XSync(mDisplay, False); | |
496 } | |
497 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size); | |
498 return; | |
1 | 499 } |
500 | |
1794 | 501 static void deallocate_xvimage(int foo) |
502 { | |
6416 | 503 #ifdef HAVE_SHM |
12582 | 504 if (Shmem_Flag) |
505 { | |
506 XShmDetach(mDisplay, &Shminfo[foo]); | |
507 shmdt(Shminfo[foo].shmaddr); | |
508 } else | |
6416 | 509 #endif |
12582 | 510 { |
511 free(xvimage[foo]->data); | |
512 } | |
513 XFree(xvimage[foo]); | |
514 | |
515 XFlush(mDisplay); | |
516 XSync(mDisplay, False); | |
517 return; | |
1794 | 518 } |
519 | |
31 | 520 static void check_events(void) |
1 | 521 { |
12582 | 522 int e = vo_x11_check_events(mDisplay); |
523 | |
524 if (e & VO_EVENT_EXPOSE && vo_fs) | |
525 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
|
526 |
12582 | 527 if (e & VO_EVENT_RESIZE) |
528 { | |
529 if (vo_fs) | |
530 { | |
531 e |= VO_EVENT_EXPOSE; | |
532 XClearWindow(mDisplay, vo_window); | |
533 XFlush(mDisplay); | |
534 } | |
535 | |
536 XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &vo_dwidth, | |
537 &vo_dheight, &drwBorderWidth, &drwDepth); | |
538 drwX = drwY = 0; | |
539 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, | |
540 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
|
541 |
12582 | 542 aspect(&dwidth, &dheight, A_NOZOOM); |
543 if (vo_fs) | |
544 { | |
545 aspect(&dwidth, &dheight, A_ZOOM); | |
546 drwX = | |
547 (vo_screenwidth - | |
548 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2; | |
549 drwY = | |
550 (vo_screenheight - | |
551 (dheight > | |
552 vo_screenheight ? vo_screenheight : dheight)) / 2; | |
553 vo_dwidth = | |
554 (dwidth > vo_screenwidth ? vo_screenwidth : dwidth); | |
555 vo_dheight = | |
556 (dheight > vo_screenheight ? vo_screenheight : dheight); | |
557 mp_msg(MSGT_VO, MSGL_V, | |
558 "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", drwX, drwY, | |
559 vo_dwidth, vo_dheight); | |
560 } | |
561 } | |
1 | 562 |
12582 | 563 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) |
564 flip_page(); | |
1 | 565 } |
566 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
567 static void draw_osd(void) |
12582 | 568 { |
569 vo_draw_text(image_width - | |
570 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x), | |
571 image_height, draw_alpha_fnc); | |
572 } | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
573 |
182 | 574 static void flip_page(void) |
1 | 575 { |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
576 |
6416 | 577 #ifdef HAVE_SHM |
12582 | 578 if (Shmem_Flag) |
579 { | |
580 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
581 xvimage[current_buf], 0, 0, image_width, | |
582 image_height, drwX - (vo_panscan_x >> 1), | |
583 drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x, | |
584 (vo_fs ? vo_dheight - 1 : vo_dheight) + vo_panscan_y, | |
585 False); | |
586 } else | |
6416 | 587 #endif |
12582 | 588 { |
589 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
590 xvimage[current_buf], 0, 0, image_width, image_height, | |
591 drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1), | |
592 vo_dwidth + vo_panscan_x, | |
593 (vo_fs ? vo_dheight - 1 : vo_dheight) + vo_panscan_y); | |
594 } | |
595 if (num_buffers > 1) | |
596 { | |
597 current_buf = | |
598 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers); | |
599 XFlush(mDisplay); | |
600 } else | |
601 XSync(mDisplay, False); | |
602 return; | |
1 | 603 } |
604 | |
12582 | 605 static uint32_t draw_slice(uint8_t * image[], int stride[], int w, int h, |
606 int x, int y) | |
1 | 607 { |
12582 | 608 uint8_t *dst; |
182 | 609 |
12582 | 610 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + |
611 xvimage[current_buf]->pitches[0] * y + x; | |
612 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0], | |
613 stride[0]); | |
182 | 614 |
12582 | 615 x /= 2; |
616 y /= 2; | |
617 w /= 2; | |
618 h /= 2; | |
1 | 619 |
12582 | 620 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + |
621 xvimage[current_buf]->pitches[1] * y + x; | |
622 if (image_format != IMGFMT_YV12) | |
623 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
624 stride[1]); | |
625 else | |
626 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
627 stride[2]); | |
5316 | 628 |
12582 | 629 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + |
630 xvimage[current_buf]->pitches[2] * y + x; | |
631 if (image_format == IMGFMT_YV12) | |
632 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
633 stride[1]); | |
634 else | |
635 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
636 stride[2]); | |
6231 | 637 |
12582 | 638 return 0; |
1 | 639 } |
640 | |
12582 | 641 static uint32_t draw_frame(uint8_t * src[]) |
642 { | |
7684 | 643 printf("draw_frame() called!!!!!!"); |
644 return -1; | |
1 | 645 } |
646 | |
12582 | 647 static uint32_t draw_image(mp_image_t * mpi) |
648 { | |
649 if (mpi->flags & MP_IMGFLAG_DIRECT) | |
650 { | |
651 // direct rendering: | |
652 current_buf = (int) (mpi->priv); // hack! | |
653 return VO_TRUE; | |
6760 | 654 } |
12582 | 655 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
656 return VO_TRUE; // done | |
657 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
658 { | |
659 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); | |
660 return VO_TRUE; | |
7684 | 661 } |
12582 | 662 if (mpi->flags & MP_IMGFLAG_YUV) |
663 { | |
664 // packed YUV: | |
665 memcpy_pic(xvimage[current_buf]->data + | |
666 xvimage[current_buf]->offsets[0], mpi->planes[0], | |
667 mpi->w * (mpi->bpp / 8), mpi->h, | |
668 xvimage[current_buf]->pitches[0], mpi->stride[0]); | |
669 return VO_TRUE; | |
7684 | 670 } |
12582 | 671 return VO_FALSE; // not (yet) supported |
6760 | 672 } |
673 | |
12582 | 674 static uint32_t get_image(mp_image_t * mpi) |
675 { | |
676 int buf = current_buf; // we shouldn't change current_buf unless we do DR! | |
677 | |
678 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1) | |
679 return VO_FALSE; // it is not static | |
680 if (mpi->imgfmt != image_format) | |
681 return VO_FALSE; // needs conversion :( | |
4980 | 682 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
12582 | 683 if (mpi->flags & MP_IMGFLAG_READABLE && |
684 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) | |
685 { | |
686 // reference (I/P) frame of IP or IPB: | |
687 if (num_buffers < 2) | |
688 return VO_FALSE; // not enough | |
689 current_ip_buf ^= 1; | |
690 // for IPB with 2 buffers we can DR only one of the 2 P frames: | |
691 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3 | |
692 && current_ip_buf) | |
693 return VO_FALSE; | |
694 buf = current_ip_buf; | |
695 if (mpi->type == MP_IMGTYPE_IPB) | |
696 ++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
|
697 } |
12582 | 698 if (mpi->height > xvimage[buf]->height) |
699 return VO_FALSE; //buffer to small | |
700 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0]) | |
701 return VO_FALSE; //buffer to small | |
702 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) | |
703 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0])) | |
704 { | |
705 current_buf = buf; | |
706 mpi->planes[0] = | |
707 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0]; | |
708 mpi->stride[0] = xvimage[current_buf]->pitches[0]; | |
709 mpi->width = mpi->stride[0] / (mpi->bpp / 8); | |
710 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
711 { | |
712 if (mpi->flags & MP_IMGFLAG_SWAPPED) | |
713 { | |
714 // I420 | |
715 mpi->planes[1] = | |
716 xvimage[current_buf]->data + | |
717 xvimage[current_buf]->offsets[1]; | |
718 mpi->planes[2] = | |
719 xvimage[current_buf]->data + | |
720 xvimage[current_buf]->offsets[2]; | |
721 mpi->stride[1] = xvimage[current_buf]->pitches[1]; | |
722 mpi->stride[2] = xvimage[current_buf]->pitches[2]; | |
723 } else | |
724 { | |
725 // YV12 | |
726 mpi->planes[1] = | |
727 xvimage[current_buf]->data + | |
728 xvimage[current_buf]->offsets[2]; | |
729 mpi->planes[2] = | |
730 xvimage[current_buf]->data + | |
731 xvimage[current_buf]->offsets[1]; | |
732 mpi->stride[1] = xvimage[current_buf]->pitches[2]; | |
733 mpi->stride[2] = xvimage[current_buf]->pitches[1]; | |
734 } | |
735 } | |
736 mpi->flags |= MP_IMGFLAG_DIRECT; | |
737 mpi->priv = (void *) current_buf; | |
738 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
739 return VO_TRUE; | |
4980 | 740 } |
741 return VO_FALSE; | |
742 } | |
743 | |
182 | 744 static uint32_t query_format(uint32_t format) |
1 | 745 { |
10855 | 746 uint32_t i; |
12582 | 747 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 |
748 | |
749 /* check image formats */ | |
750 for (i = 0; i < formats; i++) | |
751 { | |
752 if (fo[i].id == format) | |
753 return flag; //xv_format = fo[i].id; | |
754 } | |
755 return 0; | |
1 | 756 } |
757 | |
12582 | 758 static void uninit(void) |
1852 | 759 { |
12582 | 760 int i; |
761 | |
762 if (!vo_config_count) | |
763 return; | |
764 XvFreeAdaptorInfo(ai); | |
765 ai = NULL; | |
766 for (i = 0; i < num_buffers; i++) | |
767 deallocate_xvimage(i); | |
6016 | 768 #ifdef HAVE_XF86VM |
12582 | 769 vo_vm_close(mDisplay); |
6016 | 770 #endif |
12582 | 771 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
772 } |
1 | 773 |
4352 | 774 static uint32_t preinit(const char *arg) |
775 { | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
776 XvPortID xv_p; |
12582 | 777 int busy_ports = 0; |
10855 | 778 unsigned int i; |
12582 | 779 |
10826 | 780 xv_port = 0; |
781 | |
12582 | 782 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
|
783 { |
12582 | 784 if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5)) |
785 { | |
786 xv_port = atoi(arg + 5); | |
787 } else | |
788 { | |
789 mp_msg(MSGT_VO, MSGL_ERR, "vo_xv: Unknown subdevice: %s\n", | |
790 arg); | |
791 return ENOSYS; | |
792 } | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
793 } |
12582 | 794 if (!vo_init()) |
795 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
796 |
12582 | 797 /* check for Xvideo extension */ |
798 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
799 { | |
800 mp_msg(MSGT_VO, MSGL_ERR, | |
801 "Sorry, Xv not supported by this X11 version/driver\n"); | |
802 mp_msg(MSGT_VO, MSGL_ERR, | |
803 "******** Try with -vo x11 or -vo sdl *********\n"); | |
804 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
805 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
806 |
12582 | 807 /* check for Xvideo support */ |
808 if (Success != | |
809 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
810 &ai)) | |
811 { | |
812 mp_msg(MSGT_VO, MSGL_ERR, "Xv: XvQueryAdaptors failed\n"); | |
813 return -1; | |
814 } | |
815 | |
816 /* check adaptors */ | |
817 if (xv_port) | |
818 { | |
10839 | 819 int port_found; |
12582 | 820 |
821 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
822 { | |
823 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
824 { | |
825 for (xv_p = ai[i].base_id; | |
826 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
827 { | |
828 if (xv_p == xv_port) | |
829 { | |
10839 | 830 port_found = 1; |
831 break; | |
832 } | |
833 } | |
834 } | |
835 } | |
12582 | 836 if (port_found) |
837 { | |
10839 | 838 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
839 xv_port = 0; | |
12582 | 840 } else |
841 { | |
842 mp_msg(MSGT_VO, MSGL_WARN, | |
843 "Xv: Invalid port parameter, overriding with port 0\n"); | |
10839 | 844 xv_port = 0; |
845 } | |
10826 | 846 } |
12582 | 847 |
848 for (i = 0; i < adaptors && xv_port == 0; i++) | |
849 { | |
850 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
851 { | |
852 for (xv_p = ai[i].base_id; | |
853 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
854 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
855 { | |
856 xv_port = xv_p; | |
857 break; | |
858 } else | |
859 { | |
860 mp_msg(MSGT_VO, MSGL_WARN, | |
861 "Xv: could not grab port %i\n", (int) xv_p); | |
862 ++busy_ports; | |
863 } | |
864 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
865 } |
12582 | 866 if (!xv_port) |
867 { | |
868 if (busy_ports) | |
869 mp_msg(MSGT_VO, MSGL_ERR, | |
870 "Could not find free Xvideo port - maybe another process is already using it.\n" | |
871 "Close all video applications, and try again. If that does not help,\n" | |
872 "see 'mplayer -vo help' for other (non-xv) video out drivers.\n"); | |
873 else | |
874 mp_msg(MSGT_VO, MSGL_ERR, | |
875 "It seems there is no Xvideo support for your video card available.\n" | |
876 "Run 'xvinfo' to verify its Xv support and read DOCS/HTML/en/devices.html#xv!\n" | |
877 "See 'mplayer -vo help' for other (non-xv) video out drivers. Try -vo x11\n"); | |
878 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
879 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
880 |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
881 { |
12582 | 882 int howmany, i; |
883 const XvAttribute *const attributes = | |
884 XvQueryPortAttributes(mDisplay, xv_port, &howmany); | |
885 | |
886 for (i = 0; i < howmany && attributes; i++) | |
887 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) | |
888 { | |
889 const Atom autopaint = | |
890 XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); | |
891 XvSetPortAttribute(mDisplay, xv_port, autopaint, 1); | |
892 break; | |
893 } | |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
894 } |
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
895 |
12582 | 896 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats); |
5566 | 897 |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
898 return 0; |
4352 | 899 } |
1 | 900 |
4596 | 901 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
|
902 { |
12582 | 903 switch (request) |
904 { | |
905 case VOCTRL_PAUSE: | |
906 return (int_pause = 1); | |
907 case VOCTRL_RESUME: | |
908 return (int_pause = 0); | |
909 case VOCTRL_QUERY_FORMAT: | |
910 return query_format(*((uint32_t *) data)); | |
911 case VOCTRL_GET_IMAGE: | |
912 return get_image(data); | |
913 case VOCTRL_DRAW_IMAGE: | |
914 return draw_image(data); | |
915 case VOCTRL_GUISUPPORT: | |
916 return VO_TRUE; | |
917 case VOCTRL_GET_PANSCAN: | |
918 if (!vo_config_count || !vo_fs) | |
919 return VO_FALSE; | |
920 return VO_TRUE; | |
921 case VOCTRL_FULLSCREEN: | |
922 vo_x11_fullscreen(); | |
923 /* indended, fallthrough to update panscan on fullscreen/windowed switch */ | |
924 case VOCTRL_SET_PANSCAN: | |
925 if ((vo_fs && (vo_panscan != vo_panscan_amount)) | |
926 || (!vo_fs && vo_panscan_amount)) | |
927 { | |
928 int old_y = vo_panscan_y; | |
929 | |
930 panscan_calc(); | |
931 | |
932 if (old_y != vo_panscan_y) | |
933 { | |
934 vo_x11_clearwindow_part(mDisplay, vo_window, | |
935 vo_dwidth + vo_panscan_x - 1, | |
936 vo_dheight + vo_panscan_y - 1, | |
937 1); | |
938 flip_page(); | |
939 } | |
940 } | |
941 return VO_TRUE; | |
942 case VOCTRL_SET_EQUALIZER: | |
943 { | |
944 va_list ap; | |
945 int value; | |
946 | |
947 va_start(ap, data); | |
948 value = va_arg(ap, int); | |
949 | |
950 va_end(ap); | |
951 | |
952 return (vo_xv_set_eq(xv_port, data, value)); | |
953 } | |
954 case VOCTRL_GET_EQUALIZER: | |
955 { | |
956 va_list ap; | |
957 int *value; | |
958 | |
959 va_start(ap, data); | |
960 value = va_arg(ap, int *); | |
961 | |
962 va_end(ap); | |
963 | |
964 return (vo_xv_get_eq(xv_port, data, value)); | |
965 } | |
966 case VOCTRL_ONTOP: | |
967 vo_x11_ontop(); | |
968 return VO_TRUE; | |
969 } | |
970 return VO_NOTIMPL; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
971 } |