Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 28481:b78c8cb3959b
partial sync with obsolete section removal
author | diego |
---|---|
date | Tue, 10 Feb 2009 00:23:50 +0000 |
parents | 7681eab10aea |
children | db19e31a2c7c |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
2 * X11 Xv interface |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
4 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
5 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
9 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
10 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
14 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
15 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28250
diff
changeset
|
19 */ |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
20 |
1265 | 21 // Number of buffers _FOR_DOUBLEBUFFERING_MODE_ |
22 // 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
|
23 #define NUM_BUFFERS 3 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
24 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
25 /* |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
26 Buffer allocation: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
27 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
28 -nodr: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
29 1: TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
30 2: 2*TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
31 |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
32 -dr: |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
33 1: TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
34 3: 2*STATIC+TEMP |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
35 */ |
ecc71f27bfd7
DR1 IP/IPB supoprt (I/P only with -double) -- OSD *must be* disabled! :)
arpi
parents:
6755
diff
changeset
|
36 |
1 | 37 #include <stdio.h> |
38 #include <stdlib.h> | |
39 #include <string.h> | |
40 | |
41 #include "config.h" | |
5935 | 42 #include "mp_msg.h" |
16958 | 43 #include "help_mp.h" |
1 | 44 #include "video_out.h" |
45 #include "video_out_internal.h" | |
46 | |
47 | |
48 #include <X11/Xlib.h> | |
49 #include <X11/Xutil.h> | |
50 #include <errno.h> | |
51 | |
31 | 52 #include "x11_common.h" |
53 | |
354 | 54 #include "fastmemcpy.h" |
616 | 55 #include "sub.h" |
2054 | 56 #include "aspect.h" |
350 | 57 |
14742 | 58 #include "subopt-helper.h" |
59 | |
24133 | 60 #include "input/input.h" |
61 | |
27343 | 62 #ifdef CONFIG_GUI |
23077 | 63 #include "gui/interface.h" |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
64 #endif |
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
65 |
25963 | 66 #include "libavutil/common.h" |
22461
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22232
diff
changeset
|
67 |
25216 | 68 static const vo_info_t info = { |
12582 | 69 "X11/Xv", |
70 "xv", | |
71 "Gerd Knorr <kraxel@goldbach.in-berlin.de> and others", | |
72 "" | |
1 | 73 }; |
74 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
75 const LIBVO_EXTERN(xv) |
6719
5291d74a60c9
xv support under cygwin - patch by Sycotic Smith <sycotic at linuxmail.org>
alex
parents:
6417
diff
changeset
|
76 #ifdef HAVE_SHM |
1 | 77 #include <sys/ipc.h> |
78 #include <sys/shm.h> | |
79 #include <X11/extensions/XShm.h> | |
6416 | 80 |
81 static XShmSegmentInfo Shminfo[NUM_BUFFERS]; | |
6417
44bca09c1edd
100l accidently removed a line too much (Shmem_Flag)
atmos4
parents:
6416
diff
changeset
|
82 static int Shmem_Flag; |
6416 | 83 #endif |
84 | |
10855 | 85 // Note: depends on the inclusion of X11/extensions/XShm.h |
86 #include <X11/extensions/Xv.h> | |
87 #include <X11/extensions/Xvlib.h> | |
88 | |
89 // FIXME: dynamically allocate this stuff | |
90 static void allocate_xvimage(int); | |
12582 | 91 static unsigned int ver, rel, req, ev, err; |
14742 | 92 static unsigned int formats, adaptors, xv_format; |
12582 | 93 static XvAdaptorInfo *ai = NULL; |
13953 | 94 static XvImageFormatValues *fo=NULL; |
10855 | 95 |
12582 | 96 static int current_buf = 0; |
97 static int current_ip_buf = 0; | |
98 static int num_buffers = 1; // default | |
14782 | 99 static int visible_buf = -1; // -1 means: no buffer was drawn yet |
12582 | 100 static XvImage *xvimage[NUM_BUFFERS]; |
10855 | 101 |
102 | |
1 | 103 static uint32_t image_width; |
104 static uint32_t image_height; | |
105 static uint32_t image_format; | |
106 | |
10757
3aea64e0d6d9
Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents:
10359
diff
changeset
|
107 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
|
108 |
27892 | 109 static uint32_t drwX, drwY; |
16958 | 110 static uint32_t max_width = 0, max_height = 0; // zero means: not set |
1 | 111 |
12582 | 112 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, |
113 unsigned char *src, unsigned char *srca, | |
114 int stride); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
115 |
12582 | 116 static void draw_alpha_yv12(int x0, int y0, int w, int h, |
117 unsigned char *src, unsigned char *srca, | |
118 int stride) | |
119 { | |
120 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
121 vo_draw_alpha_yv12(w, h, src, srca, stride, | |
122 xvimage[current_buf]->data + | |
123 xvimage[current_buf]->offsets[0] + | |
124 xvimage[current_buf]->pitches[0] * y0 + x0, | |
125 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
126 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
127 |
12582 | 128 static void draw_alpha_yuy2(int x0, int y0, int w, int h, |
129 unsigned char *src, unsigned char *srca, | |
130 int stride) | |
131 { | |
132 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
133 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
134 xvimage[current_buf]->data + | |
135 xvimage[current_buf]->offsets[0] + | |
136 xvimage[current_buf]->pitches[0] * y0 + 2 * x0, | |
137 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
138 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
139 |
12582 | 140 static void draw_alpha_uyvy(int x0, int y0, int w, int h, |
141 unsigned char *src, unsigned char *srca, | |
142 int stride) | |
143 { | |
144 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
145 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
146 xvimage[current_buf]->data + | |
147 xvimage[current_buf]->offsets[0] + | |
148 xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1, | |
149 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
150 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
151 |
12582 | 152 static void draw_alpha_null(int x0, int y0, int w, int h, |
153 unsigned char *src, unsigned char *srca, | |
154 int stride) | |
155 { | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
156 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
157 |
6786 | 158 |
7757 | 159 static void deallocate_xvimage(int foo); |
160 | |
182 | 161 /* |
162 * connect to server, create and map window, | |
1 | 163 * allocate colors and (shared) memory |
164 */ | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
165 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
12582 | 166 uint32_t d_height, uint32_t flags, char *title, |
167 uint32_t format) | |
1 | 168 { |
12582 | 169 XVisualInfo vinfo; |
170 XSetWindowAttributes xswa; | |
171 XWindowAttributes attribs; | |
172 unsigned long xswamask; | |
173 int depth; | |
174 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
175 #ifdef CONFIG_XF86VM |
27952
94bab93a8d17
Simplify handling of VOFLAG_MODESWITCHNG, merge assignment and declaration
reimar
parents:
27951
diff
changeset
|
176 int vm = flags & VOFLAG_MODESWITCHING; |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
177 #endif |
1 | 178 |
12582 | 179 image_height = height; |
180 image_width = width; | |
181 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
|
182 |
16958 | 183 if ((max_width != 0 && max_height != 0) && |
184 (image_width > max_width || image_height > max_height)) | |
185 { | |
20765 | 186 mp_msg( MSGT_VO, MSGL_ERR, MSGTR_VO_XV_ImagedimTooHigh, |
16958 | 187 image_width, image_height, max_width, max_height); |
188 return -1; | |
189 } | |
190 | |
12582 | 191 int_pause = 0; |
14782 | 192 visible_buf = -1; |
1 | 193 |
12582 | 194 num_buffers = |
195 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
|
196 |
12582 | 197 /* check image formats */ |
198 { | |
199 unsigned int i; | |
10855 | 200 |
12582 | 201 xv_format = 0; |
202 for (i = 0; i < formats; i++) | |
203 { | |
204 mp_msg(MSGT_VO, MSGL_V, | |
205 "Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id, | |
206 (char *) &fo[i].id, | |
207 (fo[i].format == XvPacked) ? "packed" : "planar"); | |
208 if (fo[i].id == format) | |
209 xv_format = fo[i].id; | |
210 } | |
211 if (!xv_format) | |
212 return -1; | |
213 } | |
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
|
214 |
27343 | 215 #ifdef CONFIG_GUI |
12582 | 216 if (use_gui) |
27878 | 217 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
218 else |
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
219 #endif |
723 | 220 { |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
221 #ifdef CONFIG_XF86VM |
12582 | 222 if (vm) |
223 { | |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27889
diff
changeset
|
224 vo_vm_switch(); |
27895
69b4b8d73b5e
Remove a nonsensical "else" for the video mode switching case.
reimar
parents:
27892
diff
changeset
|
225 } |
12582 | 226 #endif |
227 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), | |
228 &attribs); | |
229 depth = attribs.depth; | |
230 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) | |
231 depth = 24; | |
232 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); | |
723 | 233 |
12582 | 234 xswa.background_pixel = 0; |
14742 | 235 if (xv_ck_info.method == CK_METHOD_BACKGROUND) |
236 { | |
237 xswa.background_pixel = xv_colorkey; | |
238 } | |
12582 | 239 xswa.border_pixel = 0; |
240 xswamask = CWBackPixel | CWBorderPixel; | |
1 | 241 |
27891
8742bcad99b5
Use vo_dwidth/vo_dheight for creating the windows instead of d_width/d_height.
reimar
parents:
27890
diff
changeset
|
242 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23077
diff
changeset
|
243 flags, CopyFromParent, "xv", title); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23077
diff
changeset
|
244 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
12582 | 245 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
246 #ifdef CONFIG_XF86VM |
12582 | 247 if (vm) |
248 { | |
249 /* Grab the mouse pointer in our window */ | |
250 if (vo_grabpointer) | |
251 XGrabPointer(mDisplay, vo_window, True, 0, | |
252 GrabModeAsync, GrabModeAsync, | |
253 vo_window, None, CurrentTime); | |
254 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); | |
255 } | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
256 #endif |
12582 | 257 } |
258 | |
259 mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n", | |
260 xv_port); | |
1 | 261 |
12582 | 262 switch (xv_format) |
263 { | |
264 case IMGFMT_YV12: | |
265 case IMGFMT_I420: | |
266 case IMGFMT_IYUV: | |
267 draw_alpha_fnc = draw_alpha_yv12; | |
268 break; | |
269 case IMGFMT_YUY2: | |
270 case IMGFMT_YVYU: | |
271 draw_alpha_fnc = draw_alpha_yuy2; | |
272 break; | |
273 case IMGFMT_UYVY: | |
274 draw_alpha_fnc = draw_alpha_uyvy; | |
275 break; | |
276 default: | |
277 draw_alpha_fnc = draw_alpha_null; | |
278 } | |
182 | 279 |
12582 | 280 if (vo_config_count) |
281 for (current_buf = 0; current_buf < num_buffers; ++current_buf) | |
282 deallocate_xvimage(current_buf); | |
7757 | 283 |
12582 | 284 for (current_buf = 0; current_buf < num_buffers; ++current_buf) |
285 allocate_xvimage(current_buf); | |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
286 |
12582 | 287 current_buf = 0; |
288 current_ip_buf = 0; | |
1 | 289 |
22461
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22232
diff
changeset
|
290 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; |
28250 | 291 vo_calc_drwXY(&drwX, &drwY); |
6382
86d5fc5b54e2
fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents:
6366
diff
changeset
|
292 |
12582 | 293 panscan_calc(); |
18384
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
294 |
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
295 vo_xv_draw_colorkey(drwX - (vo_panscan_x >> 1), |
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
296 drwY - (vo_panscan_y >> 1), |
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
297 vo_dwidth + vo_panscan_x - 1, |
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
298 vo_dheight + vo_panscan_y - 1); |
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
299 |
12582 | 300 mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", drwX, |
301 drwY, vo_dwidth, vo_dheight); | |
5945 | 302 |
12582 | 303 return 0; |
1 | 304 } |
305 | |
182 | 306 static void allocate_xvimage(int foo) |
1 | 307 { |
12582 | 308 /* |
309 * allocate XvImages. FIXME: no error checking, without | |
310 * mit-shm this will bomb... trzing to fix ::atmos | |
311 */ | |
6416 | 312 #ifdef HAVE_SHM |
12582 | 313 if (mLocalDisplay && XShmQueryExtension(mDisplay)) |
314 Shmem_Flag = 1; | |
315 else | |
316 { | |
317 Shmem_Flag = 0; | |
318 mp_msg(MSGT_VO, MSGL_INFO, | |
20765 | 319 MSGTR_LIBVO_XV_SharedMemoryNotSupported); |
12582 | 320 } |
321 if (Shmem_Flag) | |
322 { | |
323 xvimage[foo] = | |
324 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, | |
325 NULL, image_width, image_height, | |
326 &Shminfo[foo]); | |
1 | 327 |
12582 | 328 Shminfo[foo].shmid = |
329 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); | |
330 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); | |
331 Shminfo[foo].readOnly = False; | |
1 | 332 |
12582 | 333 xvimage[foo]->data = Shminfo[foo].shmaddr; |
334 XShmAttach(mDisplay, &Shminfo[foo]); | |
335 XSync(mDisplay, False); | |
336 shmctl(Shminfo[foo].shmid, IPC_RMID, 0); | |
337 } else | |
6416 | 338 #endif |
12582 | 339 { |
340 xvimage[foo] = | |
341 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, | |
342 image_width, image_height); | |
343 xvimage[foo]->data = malloc(xvimage[foo]->data_size); | |
344 XSync(mDisplay, False); | |
345 } | |
346 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size); | |
347 return; | |
1 | 348 } |
349 | |
1794 | 350 static void deallocate_xvimage(int foo) |
351 { | |
6416 | 352 #ifdef HAVE_SHM |
12582 | 353 if (Shmem_Flag) |
354 { | |
355 XShmDetach(mDisplay, &Shminfo[foo]); | |
356 shmdt(Shminfo[foo].shmaddr); | |
357 } else | |
6416 | 358 #endif |
12582 | 359 { |
360 free(xvimage[foo]->data); | |
361 } | |
362 XFree(xvimage[foo]); | |
363 | |
364 XSync(mDisplay, False); | |
365 return; | |
1794 | 366 } |
367 | |
14782 | 368 static inline void put_xvimage( XvImage * xvi ) |
369 { | |
370 #ifdef HAVE_SHM | |
371 if (Shmem_Flag) | |
372 { | |
373 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
374 xvi, 0, 0, image_width, | |
375 image_height, drwX - (vo_panscan_x >> 1), | |
376 drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x, | |
377 vo_dheight + vo_panscan_y, | |
378 False); | |
379 } else | |
380 #endif | |
381 { | |
382 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
383 xvi, 0, 0, image_width, image_height, | |
384 drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1), | |
385 vo_dwidth + vo_panscan_x, | |
386 vo_dheight + vo_panscan_y); | |
387 } | |
388 } | |
389 | |
31 | 390 static void check_events(void) |
1 | 391 { |
12582 | 392 int e = vo_x11_check_events(mDisplay); |
393 | |
394 if (e & VO_EVENT_RESIZE) | |
395 { | |
28250 | 396 vo_calc_drwXY(&drwX, &drwY); |
12582 | 397 } |
1 | 398 |
14742 | 399 if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) |
400 { | |
15192 | 401 vo_xv_draw_colorkey(drwX - (vo_panscan_x >> 1), |
402 drwY - (vo_panscan_y >> 1), | |
403 vo_dwidth + vo_panscan_x - 1, | |
404 vo_dheight + vo_panscan_y - 1); | |
14742 | 405 } |
406 | |
12582 | 407 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) |
14782 | 408 { |
409 /* did we already draw a buffer */ | |
410 if ( visible_buf != -1 ) | |
411 { | |
412 /* redraw the last visible buffer */ | |
413 put_xvimage( xvimage[visible_buf] ); | |
414 } | |
415 } | |
1 | 416 } |
417 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
418 static void draw_osd(void) |
12582 | 419 { |
420 vo_draw_text(image_width - | |
421 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x), | |
422 image_height, draw_alpha_fnc); | |
423 } | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
424 |
182 | 425 static void flip_page(void) |
1 | 426 { |
14782 | 427 put_xvimage( xvimage[current_buf] ); |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
428 |
14782 | 429 /* remember the currently visible buffer */ |
430 visible_buf = current_buf; | |
431 | |
12582 | 432 if (num_buffers > 1) |
433 { | |
434 current_buf = | |
435 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers); | |
436 XFlush(mDisplay); | |
437 } else | |
438 XSync(mDisplay, False); | |
439 return; | |
1 | 440 } |
441 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
442 static int draw_slice(uint8_t * image[], int stride[], int w, int h, |
12582 | 443 int x, int y) |
1 | 444 { |
12582 | 445 uint8_t *dst; |
182 | 446 |
12582 | 447 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + |
448 xvimage[current_buf]->pitches[0] * y + x; | |
449 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0], | |
450 stride[0]); | |
182 | 451 |
12582 | 452 x /= 2; |
453 y /= 2; | |
454 w /= 2; | |
455 h /= 2; | |
1 | 456 |
12582 | 457 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + |
458 xvimage[current_buf]->pitches[1] * y + x; | |
459 if (image_format != IMGFMT_YV12) | |
460 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
461 stride[1]); | |
462 else | |
463 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
464 stride[2]); | |
5316 | 465 |
12582 | 466 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + |
467 xvimage[current_buf]->pitches[2] * y + x; | |
468 if (image_format == IMGFMT_YV12) | |
469 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
470 stride[1]); | |
471 else | |
472 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
473 stride[2]); | |
6231 | 474 |
12582 | 475 return 0; |
1 | 476 } |
477 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
478 static int draw_frame(uint8_t * src[]) |
12582 | 479 { |
27883
96831cf06109
Remove code from unused and since ages deprecated draw_frame function.
reimar
parents:
27882
diff
changeset
|
480 return VO_ERROR; |
1 | 481 } |
482 | |
12582 | 483 static uint32_t draw_image(mp_image_t * mpi) |
484 { | |
485 if (mpi->flags & MP_IMGFLAG_DIRECT) | |
486 { | |
487 // direct rendering: | |
488 current_buf = (int) (mpi->priv); // hack! | |
489 return VO_TRUE; | |
6760 | 490 } |
12582 | 491 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
492 return VO_TRUE; // done | |
493 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
494 { | |
495 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); | |
496 return VO_TRUE; | |
7684 | 497 } |
12582 | 498 if (mpi->flags & MP_IMGFLAG_YUV) |
499 { | |
500 // packed YUV: | |
501 memcpy_pic(xvimage[current_buf]->data + | |
502 xvimage[current_buf]->offsets[0], mpi->planes[0], | |
503 mpi->w * (mpi->bpp / 8), mpi->h, | |
504 xvimage[current_buf]->pitches[0], mpi->stride[0]); | |
505 return VO_TRUE; | |
7684 | 506 } |
12582 | 507 return VO_FALSE; // not (yet) supported |
6760 | 508 } |
509 | |
12582 | 510 static uint32_t get_image(mp_image_t * mpi) |
511 { | |
512 int buf = current_buf; // we shouldn't change current_buf unless we do DR! | |
513 | |
514 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1) | |
515 return VO_FALSE; // it is not static | |
516 if (mpi->imgfmt != image_format) | |
517 return VO_FALSE; // needs conversion :( | |
4980 | 518 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
12582 | 519 if (mpi->flags & MP_IMGFLAG_READABLE && |
520 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) | |
521 { | |
522 // reference (I/P) frame of IP or IPB: | |
523 if (num_buffers < 2) | |
524 return VO_FALSE; // not enough | |
525 current_ip_buf ^= 1; | |
526 // for IPB with 2 buffers we can DR only one of the 2 P frames: | |
527 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3 | |
528 && current_ip_buf) | |
529 return VO_FALSE; | |
530 buf = current_ip_buf; | |
531 if (mpi->type == MP_IMGTYPE_IPB) | |
532 ++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
|
533 } |
12582 | 534 if (mpi->height > xvimage[buf]->height) |
535 return VO_FALSE; //buffer to small | |
536 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0]) | |
537 return VO_FALSE; //buffer to small | |
538 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) | |
539 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0])) | |
540 { | |
541 current_buf = buf; | |
542 mpi->planes[0] = | |
543 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0]; | |
544 mpi->stride[0] = xvimage[current_buf]->pitches[0]; | |
545 mpi->width = mpi->stride[0] / (mpi->bpp / 8); | |
546 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
547 { | |
548 if (mpi->flags & MP_IMGFLAG_SWAPPED) | |
549 { | |
550 // I420 | |
551 mpi->planes[1] = | |
552 xvimage[current_buf]->data + | |
553 xvimage[current_buf]->offsets[1]; | |
554 mpi->planes[2] = | |
555 xvimage[current_buf]->data + | |
556 xvimage[current_buf]->offsets[2]; | |
557 mpi->stride[1] = xvimage[current_buf]->pitches[1]; | |
558 mpi->stride[2] = xvimage[current_buf]->pitches[2]; | |
559 } else | |
560 { | |
561 // YV12 | |
562 mpi->planes[1] = | |
563 xvimage[current_buf]->data + | |
564 xvimage[current_buf]->offsets[2]; | |
565 mpi->planes[2] = | |
566 xvimage[current_buf]->data + | |
567 xvimage[current_buf]->offsets[1]; | |
568 mpi->stride[1] = xvimage[current_buf]->pitches[2]; | |
569 mpi->stride[2] = xvimage[current_buf]->pitches[1]; | |
570 } | |
571 } | |
572 mpi->flags |= MP_IMGFLAG_DIRECT; | |
573 mpi->priv = (void *) current_buf; | |
574 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
575 return VO_TRUE; | |
4980 | 576 } |
577 return VO_FALSE; | |
578 } | |
579 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
580 static int query_format(uint32_t format) |
1 | 581 { |
10855 | 582 uint32_t i; |
12582 | 583 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 |
584 | |
585 /* check image formats */ | |
586 for (i = 0; i < formats; i++) | |
587 { | |
588 if (fo[i].id == format) | |
589 return flag; //xv_format = fo[i].id; | |
590 } | |
591 return 0; | |
1 | 592 } |
593 | |
12582 | 594 static void uninit(void) |
1852 | 595 { |
12582 | 596 int i; |
597 | |
598 if (!vo_config_count) | |
599 return; | |
14782 | 600 visible_buf = -1; |
12582 | 601 XvFreeAdaptorInfo(ai); |
602 ai = NULL; | |
13953 | 603 if(fo){ |
604 XFree(fo); | |
605 fo=NULL; | |
606 } | |
12582 | 607 for (i = 0; i < num_buffers; i++) |
608 deallocate_xvimage(i); | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
609 #ifdef CONFIG_XF86VM |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27889
diff
changeset
|
610 vo_vm_close(); |
6016 | 611 #endif |
24133 | 612 mp_input_rm_event_fd(ConnectionNumber(mDisplay)); |
12582 | 613 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
614 } |
1 | 615 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
616 static int preinit(const char *arg) |
4352 | 617 { |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
618 XvPortID xv_p; |
12582 | 619 int busy_ports = 0; |
10855 | 620 unsigned int i; |
14742 | 621 strarg_t ck_src_arg = { 0, NULL }; |
622 strarg_t ck_method_arg = { 0, NULL }; | |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
623 int xv_adaptor = -1; |
14742 | 624 |
625 opt_t subopts[] = | |
626 { | |
627 /* name arg type arg var test */ | |
628 { "port", OPT_ARG_INT, &xv_port, (opt_test_f)int_pos }, | |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
629 { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg }, |
14742 | 630 { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, |
631 { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, | |
632 { NULL } | |
633 }; | |
12582 | 634 |
10826 | 635 xv_port = 0; |
636 | |
14742 | 637 /* parse suboptions */ |
638 if ( subopt_parse( arg, subopts ) != 0 ) | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
639 { |
14742 | 640 return -1; |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
641 } |
14742 | 642 |
643 /* modify colorkey settings according to the given options */ | |
644 xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str ); | |
645 | |
12582 | 646 if (!vo_init()) |
647 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
648 |
12582 | 649 /* check for Xvideo extension */ |
650 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
651 { | |
652 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 653 MSGTR_LIBVO_XV_XvNotSupportedByX11); |
12582 | 654 return -1; |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
655 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
656 |
12582 | 657 /* check for Xvideo support */ |
658 if (Success != | |
659 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
660 &ai)) | |
661 { | |
20765 | 662 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_XV_XvQueryAdaptorsFailed); |
12582 | 663 return -1; |
664 } | |
665 | |
666 /* check adaptors */ | |
667 if (xv_port) | |
668 { | |
10839 | 669 int port_found; |
12582 | 670 |
671 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
672 { | |
673 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
674 { | |
675 for (xv_p = ai[i].base_id; | |
676 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
677 { | |
678 if (xv_p == xv_port) | |
679 { | |
10839 | 680 port_found = 1; |
681 break; | |
682 } | |
683 } | |
684 } | |
685 } | |
12582 | 686 if (port_found) |
687 { | |
10839 | 688 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
689 xv_port = 0; | |
12582 | 690 } else |
691 { | |
692 mp_msg(MSGT_VO, MSGL_WARN, | |
20765 | 693 MSGTR_LIBVO_XV_InvalidPortParameter); |
10839 | 694 xv_port = 0; |
695 } | |
10826 | 696 } |
12582 | 697 |
698 for (i = 0; i < adaptors && xv_port == 0; i++) | |
699 { | |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
700 /* check if adaptor number has been specified */ |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
701 if (xv_adaptor != -1 && xv_adaptor != i) |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
702 continue; |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
703 |
12582 | 704 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) |
705 { | |
706 for (xv_p = ai[i].base_id; | |
707 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
708 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
709 { | |
710 xv_port = xv_p; | |
27031
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
711 mp_msg(MSGT_VO, MSGL_V, |
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
712 "[VO_XV] Using Xv Adapter #%d (%s)\n", |
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
713 i, ai[i].name); |
12582 | 714 break; |
715 } else | |
716 { | |
717 mp_msg(MSGT_VO, MSGL_WARN, | |
20765 | 718 MSGTR_LIBVO_XV_CouldNotGrabPort, (int) xv_p); |
12582 | 719 ++busy_ports; |
720 } | |
721 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
722 } |
12582 | 723 if (!xv_port) |
724 { | |
725 if (busy_ports) | |
726 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 727 MSGTR_LIBVO_XV_CouldNotFindFreePort); |
12582 | 728 else |
729 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 730 MSGTR_LIBVO_XV_NoXvideoSupport); |
12582 | 731 return -1; |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
732 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
733 |
14742 | 734 if ( !vo_xv_init_colorkey() ) |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
735 { |
14742 | 736 return -1; // bail out, colorkey setup failed |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
737 } |
15826
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15540
diff
changeset
|
738 vo_xv_enable_vsync(); |
16958 | 739 vo_xv_get_max_img_dim( &max_width, &max_height ); |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
740 |
12582 | 741 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats); |
5566 | 742 |
24133 | 743 mp_input_add_event_fd(ConnectionNumber(mDisplay), check_events); |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4658
diff
changeset
|
744 return 0; |
4352 | 745 } |
1 | 746 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
747 static int control(uint32_t request, void *data, ...) |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
748 { |
12582 | 749 switch (request) |
750 { | |
751 case VOCTRL_PAUSE: | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
752 return int_pause = 1; |
12582 | 753 case VOCTRL_RESUME: |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
754 return int_pause = 0; |
12582 | 755 case VOCTRL_QUERY_FORMAT: |
756 return query_format(*((uint32_t *) data)); | |
757 case VOCTRL_GET_IMAGE: | |
758 return get_image(data); | |
759 case VOCTRL_DRAW_IMAGE: | |
760 return draw_image(data); | |
761 case VOCTRL_GUISUPPORT: | |
762 return VO_TRUE; | |
763 case VOCTRL_GET_PANSCAN: | |
764 if (!vo_config_count || !vo_fs) | |
765 return VO_FALSE; | |
766 return VO_TRUE; | |
767 case VOCTRL_FULLSCREEN: | |
768 vo_x11_fullscreen(); | |
769 /* indended, fallthrough to update panscan on fullscreen/windowed switch */ | |
770 case VOCTRL_SET_PANSCAN: | |
771 if ((vo_fs && (vo_panscan != vo_panscan_amount)) | |
772 || (!vo_fs && vo_panscan_amount)) | |
773 { | |
774 int old_y = vo_panscan_y; | |
775 | |
776 panscan_calc(); | |
777 | |
778 if (old_y != vo_panscan_y) | |
779 { | |
780 vo_x11_clearwindow_part(mDisplay, vo_window, | |
781 vo_dwidth + vo_panscan_x - 1, | |
782 vo_dheight + vo_panscan_y - 1, | |
783 1); | |
15190 | 784 vo_xv_draw_colorkey(drwX - (vo_panscan_x >> 1), |
785 drwY - (vo_panscan_y >> 1), | |
786 vo_dwidth + vo_panscan_x - 1, | |
787 vo_dheight + vo_panscan_y - 1); | |
12582 | 788 flip_page(); |
789 } | |
790 } | |
791 return VO_TRUE; | |
792 case VOCTRL_SET_EQUALIZER: | |
793 { | |
794 va_list ap; | |
795 int value; | |
796 | |
797 va_start(ap, data); | |
798 value = va_arg(ap, int); | |
799 | |
800 va_end(ap); | |
801 | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
802 return vo_xv_set_eq(xv_port, data, value); |
12582 | 803 } |
804 case VOCTRL_GET_EQUALIZER: | |
805 { | |
806 va_list ap; | |
807 int *value; | |
808 | |
809 va_start(ap, data); | |
810 value = va_arg(ap, int *); | |
811 | |
812 va_end(ap); | |
813 | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
814 return vo_xv_get_eq(xv_port, data, value); |
12582 | 815 } |
816 case VOCTRL_ONTOP: | |
817 vo_x11_ontop(); | |
818 return VO_TRUE; | |
22232 | 819 case VOCTRL_UPDATE_SCREENINFO: |
820 update_xinerama_info(); | |
821 return VO_TRUE; | |
12582 | 822 } |
823 return VO_NOTIMPL; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
824 } |