Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 13249:a6642a4330fa
ensure that avi files have a valid header as soon as possible.
without this, the header says 0x0 video size, which works with mplayer
when the video size is stored in the codec data, but it does NOT work
with other players or with codecs that don't store size (e.g. snow).
actually i don't like having seeks in the muxer module, but i don't
know any other way to implement this fix without major changes to
mencoder. if you have a better fix, please reverse this and commit
yours.
author | rfelker |
---|---|
date | Sun, 05 Sep 2004 16:51:15 +0000 |
parents | 185d052020e5 |
children | e047e70a9767 |
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 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; | |
764 for (i = 0; i < num_buffers; i++) | |
765 deallocate_xvimage(i); | |
6016 | 766 #ifdef HAVE_XF86VM |
12582 | 767 vo_vm_close(mDisplay); |
6016 | 768 #endif |
12582 | 769 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
770 } |
1 | 771 |
4352 | 772 static uint32_t preinit(const char *arg) |
773 { | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
774 XvPortID xv_p; |
12582 | 775 int busy_ports = 0; |
10855 | 776 unsigned int i; |
12582 | 777 |
10826 | 778 xv_port = 0; |
779 | |
12582 | 780 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
|
781 { |
12582 | 782 if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5)) |
783 { | |
784 xv_port = atoi(arg + 5); | |
785 } else | |
786 { | |
787 mp_msg(MSGT_VO, MSGL_ERR, "vo_xv: Unknown subdevice: %s\n", | |
788 arg); | |
789 return ENOSYS; | |
790 } | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
791 } |
12582 | 792 if (!vo_init()) |
793 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
794 |
12582 | 795 /* check for Xvideo extension */ |
796 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
797 { | |
798 mp_msg(MSGT_VO, MSGL_ERR, | |
799 "Sorry, Xv not supported by this X11 version/driver\n"); | |
800 mp_msg(MSGT_VO, MSGL_ERR, | |
801 "******** Try with -vo x11 or -vo sdl *********\n"); | |
802 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
803 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
804 |
12582 | 805 /* check for Xvideo support */ |
806 if (Success != | |
807 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
808 &ai)) | |
809 { | |
810 mp_msg(MSGT_VO, MSGL_ERR, "Xv: XvQueryAdaptors failed\n"); | |
811 return -1; | |
812 } | |
813 | |
814 /* check adaptors */ | |
815 if (xv_port) | |
816 { | |
10839 | 817 int port_found; |
12582 | 818 |
819 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
820 { | |
821 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
822 { | |
823 for (xv_p = ai[i].base_id; | |
824 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
825 { | |
826 if (xv_p == xv_port) | |
827 { | |
10839 | 828 port_found = 1; |
829 break; | |
830 } | |
831 } | |
832 } | |
833 } | |
12582 | 834 if (port_found) |
835 { | |
10839 | 836 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
837 xv_port = 0; | |
12582 | 838 } else |
839 { | |
840 mp_msg(MSGT_VO, MSGL_WARN, | |
841 "Xv: Invalid port parameter, overriding with port 0\n"); | |
10839 | 842 xv_port = 0; |
843 } | |
10826 | 844 } |
12582 | 845 |
846 for (i = 0; i < adaptors && xv_port == 0; i++) | |
847 { | |
848 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
849 { | |
850 for (xv_p = ai[i].base_id; | |
851 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
852 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
853 { | |
854 xv_port = xv_p; | |
855 break; | |
856 } else | |
857 { | |
858 mp_msg(MSGT_VO, MSGL_WARN, | |
859 "Xv: could not grab port %i\n", (int) xv_p); | |
860 ++busy_ports; | |
861 } | |
862 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
863 } |
12582 | 864 if (!xv_port) |
865 { | |
866 if (busy_ports) | |
867 mp_msg(MSGT_VO, MSGL_ERR, | |
868 "Could not find free Xvideo port - maybe another process is already using it.\n" | |
869 "Close all video applications, and try again. If that does not help,\n" | |
870 "see 'mplayer -vo help' for other (non-xv) video out drivers.\n"); | |
871 else | |
872 mp_msg(MSGT_VO, MSGL_ERR, | |
873 "It seems there is no Xvideo support for your video card available.\n" | |
874 "Run 'xvinfo' to verify its Xv support and read DOCS/HTML/en/devices.html#xv!\n" | |
875 "See 'mplayer -vo help' for other (non-xv) video out drivers. Try -vo x11\n"); | |
876 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
877 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
878 |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
879 { |
12582 | 880 int howmany, i; |
881 const XvAttribute *const attributes = | |
882 XvQueryPortAttributes(mDisplay, xv_port, &howmany); | |
883 | |
884 for (i = 0; i < howmany && attributes; i++) | |
885 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) | |
886 { | |
887 const Atom autopaint = | |
888 XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); | |
889 XvSetPortAttribute(mDisplay, xv_port, autopaint, 1); | |
890 break; | |
891 } | |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
892 } |
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
893 |
12582 | 894 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats); |
5566 | 895 |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
896 return 0; |
4352 | 897 } |
1 | 898 |
4596 | 899 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
|
900 { |
12582 | 901 switch (request) |
902 { | |
903 case VOCTRL_PAUSE: | |
904 return (int_pause = 1); | |
905 case VOCTRL_RESUME: | |
906 return (int_pause = 0); | |
907 case VOCTRL_QUERY_FORMAT: | |
908 return query_format(*((uint32_t *) data)); | |
909 case VOCTRL_GET_IMAGE: | |
910 return get_image(data); | |
911 case VOCTRL_DRAW_IMAGE: | |
912 return draw_image(data); | |
913 case VOCTRL_GUISUPPORT: | |
914 return VO_TRUE; | |
915 case VOCTRL_GET_PANSCAN: | |
916 if (!vo_config_count || !vo_fs) | |
917 return VO_FALSE; | |
918 return VO_TRUE; | |
919 case VOCTRL_FULLSCREEN: | |
920 vo_x11_fullscreen(); | |
921 /* indended, fallthrough to update panscan on fullscreen/windowed switch */ | |
922 case VOCTRL_SET_PANSCAN: | |
923 if ((vo_fs && (vo_panscan != vo_panscan_amount)) | |
924 || (!vo_fs && vo_panscan_amount)) | |
925 { | |
926 int old_y = vo_panscan_y; | |
927 | |
928 panscan_calc(); | |
929 | |
930 if (old_y != vo_panscan_y) | |
931 { | |
932 vo_x11_clearwindow_part(mDisplay, vo_window, | |
933 vo_dwidth + vo_panscan_x - 1, | |
934 vo_dheight + vo_panscan_y - 1, | |
935 1); | |
936 flip_page(); | |
937 } | |
938 } | |
939 return VO_TRUE; | |
940 case VOCTRL_SET_EQUALIZER: | |
941 { | |
942 va_list ap; | |
943 int value; | |
944 | |
945 va_start(ap, data); | |
946 value = va_arg(ap, int); | |
947 | |
948 va_end(ap); | |
949 | |
950 return (vo_xv_set_eq(xv_port, data, value)); | |
951 } | |
952 case VOCTRL_GET_EQUALIZER: | |
953 { | |
954 va_list ap; | |
955 int *value; | |
956 | |
957 va_start(ap, data); | |
958 value = va_arg(ap, int *); | |
959 | |
960 va_end(ap); | |
961 | |
962 return (vo_xv_get_eq(xv_port, data, value)); | |
963 } | |
964 case VOCTRL_ONTOP: | |
965 vo_x11_ontop(); | |
966 return VO_TRUE; | |
967 } | |
968 return VO_NOTIMPL; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
969 } |