Mercurial > mplayer.hg
annotate libvo/vo_xv.c @ 28791:4e4b39c8e25d
Update libass changelog.
author | greg |
---|---|
date | Thu, 05 Mar 2009 21:16:21 +0000 |
parents | 4172d83194f2 |
children | 56eee6ffba9b |
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 |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
109 static struct vo_rect src_rect; |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
110 static struct vo_rect dst_rect; |
16958 | 111 static uint32_t max_width = 0, max_height = 0; // zero means: not set |
1 | 112 |
12582 | 113 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, |
114 unsigned char *src, unsigned char *srca, | |
115 int stride); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
116 |
12582 | 117 static void draw_alpha_yv12(int x0, int y0, int w, int h, |
118 unsigned char *src, unsigned char *srca, | |
119 int stride) | |
120 { | |
121 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
122 vo_draw_alpha_yv12(w, h, src, srca, stride, | |
123 xvimage[current_buf]->data + | |
124 xvimage[current_buf]->offsets[0] + | |
125 xvimage[current_buf]->pitches[0] * y0 + x0, | |
126 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
127 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
128 |
12582 | 129 static void draw_alpha_yuy2(int x0, int y0, int w, int h, |
130 unsigned char *src, unsigned char *srca, | |
131 int stride) | |
132 { | |
133 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
134 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
135 xvimage[current_buf]->data + | |
136 xvimage[current_buf]->offsets[0] + | |
137 xvimage[current_buf]->pitches[0] * y0 + 2 * x0, | |
138 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
139 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
140 |
12582 | 141 static void draw_alpha_uyvy(int x0, int y0, int w, int h, |
142 unsigned char *src, unsigned char *srca, | |
143 int stride) | |
144 { | |
145 x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); | |
146 vo_draw_alpha_yuy2(w, h, src, srca, stride, | |
147 xvimage[current_buf]->data + | |
148 xvimage[current_buf]->offsets[0] + | |
149 xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1, | |
150 xvimage[current_buf]->pitches[0]); | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
151 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
152 |
12582 | 153 static void draw_alpha_null(int x0, int y0, int w, int h, |
154 unsigned char *src, unsigned char *srca, | |
155 int stride) | |
156 { | |
1647
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
157 } |
22480104ddfd
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
atlka
parents:
1501
diff
changeset
|
158 |
6786 | 159 |
7757 | 160 static void deallocate_xvimage(int foo); |
161 | |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
162 static void resize(void) |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
163 { |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28511
diff
changeset
|
164 calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL); |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
165 vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1); |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
166 vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height); |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
167 } |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
168 |
182 | 169 /* |
170 * connect to server, create and map window, | |
1 | 171 * allocate colors and (shared) memory |
172 */ | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
173 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
12582 | 174 uint32_t d_height, uint32_t flags, char *title, |
175 uint32_t format) | |
1 | 176 { |
12582 | 177 XVisualInfo vinfo; |
178 XSetWindowAttributes xswa; | |
179 XWindowAttributes attribs; | |
180 unsigned long xswamask; | |
181 int depth; | |
182 | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
183 #ifdef CONFIG_XF86VM |
27952
94bab93a8d17
Simplify handling of VOFLAG_MODESWITCHNG, merge assignment and declaration
reimar
parents:
27951
diff
changeset
|
184 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
|
185 #endif |
1 | 186 |
12582 | 187 image_height = height; |
188 image_width = width; | |
189 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
|
190 |
16958 | 191 if ((max_width != 0 && max_height != 0) && |
192 (image_width > max_width || image_height > max_height)) | |
193 { | |
20765 | 194 mp_msg( MSGT_VO, MSGL_ERR, MSGTR_VO_XV_ImagedimTooHigh, |
16958 | 195 image_width, image_height, max_width, max_height); |
196 return -1; | |
197 } | |
198 | |
12582 | 199 int_pause = 0; |
14782 | 200 visible_buf = -1; |
1 | 201 |
12582 | 202 num_buffers = |
203 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
|
204 |
12582 | 205 /* check image formats */ |
206 { | |
207 unsigned int i; | |
10855 | 208 |
12582 | 209 xv_format = 0; |
210 for (i = 0; i < formats; i++) | |
211 { | |
212 mp_msg(MSGT_VO, MSGL_V, | |
213 "Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id, | |
214 (char *) &fo[i].id, | |
215 (fo[i].format == XvPacked) ? "packed" : "planar"); | |
216 if (fo[i].id == format) | |
217 xv_format = fo[i].id; | |
218 } | |
219 if (!xv_format) | |
220 return -1; | |
221 } | |
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
|
222 |
27343 | 223 #ifdef CONFIG_GUI |
12582 | 224 if (use_gui) |
27878 | 225 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
|
226 else |
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
227 #endif |
723 | 228 { |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
229 #ifdef CONFIG_XF86VM |
12582 | 230 if (vm) |
231 { | |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27889
diff
changeset
|
232 vo_vm_switch(); |
27895
69b4b8d73b5e
Remove a nonsensical "else" for the video mode switching case.
reimar
parents:
27892
diff
changeset
|
233 } |
12582 | 234 #endif |
235 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), | |
236 &attribs); | |
237 depth = attribs.depth; | |
238 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) | |
239 depth = 24; | |
240 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); | |
723 | 241 |
12582 | 242 xswa.background_pixel = 0; |
14742 | 243 if (xv_ck_info.method == CK_METHOD_BACKGROUND) |
244 { | |
245 xswa.background_pixel = xv_colorkey; | |
246 } | |
12582 | 247 xswa.border_pixel = 0; |
248 xswamask = CWBackPixel | CWBorderPixel; | |
1 | 249 |
27891
8742bcad99b5
Use vo_dwidth/vo_dheight for creating the windows instead of d_width/d_height.
reimar
parents:
27890
diff
changeset
|
250 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
|
251 flags, CopyFromParent, "xv", title); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23077
diff
changeset
|
252 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
12582 | 253 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
254 #ifdef CONFIG_XF86VM |
12582 | 255 if (vm) |
256 { | |
257 /* Grab the mouse pointer in our window */ | |
258 if (vo_grabpointer) | |
259 XGrabPointer(mDisplay, vo_window, True, 0, | |
260 GrabModeAsync, GrabModeAsync, | |
261 vo_window, None, CurrentTime); | |
262 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); | |
263 } | |
4426
1ceadec3ea67
using the common -vm code, patch by Santi B«±jar <tiarda@yahoo.es>
arpi
parents:
4406
diff
changeset
|
264 #endif |
12582 | 265 } |
266 | |
267 mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n", | |
268 xv_port); | |
1 | 269 |
12582 | 270 switch (xv_format) |
271 { | |
272 case IMGFMT_YV12: | |
273 case IMGFMT_I420: | |
274 case IMGFMT_IYUV: | |
275 draw_alpha_fnc = draw_alpha_yv12; | |
276 break; | |
277 case IMGFMT_YUY2: | |
278 case IMGFMT_YVYU: | |
279 draw_alpha_fnc = draw_alpha_yuy2; | |
280 break; | |
281 case IMGFMT_UYVY: | |
282 draw_alpha_fnc = draw_alpha_uyvy; | |
283 break; | |
284 default: | |
285 draw_alpha_fnc = draw_alpha_null; | |
286 } | |
182 | 287 |
12582 | 288 if (vo_config_count) |
289 for (current_buf = 0; current_buf < num_buffers; ++current_buf) | |
290 deallocate_xvimage(current_buf); | |
7757 | 291 |
12582 | 292 for (current_buf = 0; current_buf < num_buffers; ++current_buf) |
293 allocate_xvimage(current_buf); | |
676
428755f858f7
multi buffering added (modify NUM_BUFFERS in the source)
arpi_esp
parents:
616
diff
changeset
|
294 |
12582 | 295 current_buf = 0; |
296 current_ip_buf = 0; | |
1 | 297 |
22461
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22232
diff
changeset
|
298 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; |
18384
29a25bcb3d99
Make sure black borders are drawn when switching videos with -fixed-vo.
reimar
parents:
18234
diff
changeset
|
299 |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
300 resize(); |
5945 | 301 |
12582 | 302 return 0; |
1 | 303 } |
304 | |
182 | 305 static void allocate_xvimage(int foo) |
1 | 306 { |
12582 | 307 /* |
308 * allocate XvImages. FIXME: no error checking, without | |
309 * mit-shm this will bomb... trzing to fix ::atmos | |
310 */ | |
6416 | 311 #ifdef HAVE_SHM |
12582 | 312 if (mLocalDisplay && XShmQueryExtension(mDisplay)) |
313 Shmem_Flag = 1; | |
314 else | |
315 { | |
316 Shmem_Flag = 0; | |
317 mp_msg(MSGT_VO, MSGL_INFO, | |
20765 | 318 MSGTR_LIBVO_XV_SharedMemoryNotSupported); |
12582 | 319 } |
320 if (Shmem_Flag) | |
321 { | |
322 xvimage[foo] = | |
323 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, | |
324 NULL, image_width, image_height, | |
325 &Shminfo[foo]); | |
1 | 326 |
12582 | 327 Shminfo[foo].shmid = |
328 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777); | |
329 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0); | |
330 Shminfo[foo].readOnly = False; | |
1 | 331 |
12582 | 332 xvimage[foo]->data = Shminfo[foo].shmaddr; |
333 XShmAttach(mDisplay, &Shminfo[foo]); | |
334 XSync(mDisplay, False); | |
335 shmctl(Shminfo[foo].shmid, IPC_RMID, 0); | |
336 } else | |
6416 | 337 #endif |
12582 | 338 { |
339 xvimage[foo] = | |
340 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, | |
341 image_width, image_height); | |
342 xvimage[foo]->data = malloc(xvimage[foo]->data_size); | |
343 XSync(mDisplay, False); | |
344 } | |
345 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size); | |
346 return; | |
1 | 347 } |
348 | |
1794 | 349 static void deallocate_xvimage(int foo) |
350 { | |
6416 | 351 #ifdef HAVE_SHM |
12582 | 352 if (Shmem_Flag) |
353 { | |
354 XShmDetach(mDisplay, &Shminfo[foo]); | |
355 shmdt(Shminfo[foo].shmaddr); | |
356 } else | |
6416 | 357 #endif |
12582 | 358 { |
359 free(xvimage[foo]->data); | |
360 } | |
361 XFree(xvimage[foo]); | |
362 | |
363 XSync(mDisplay, False); | |
364 return; | |
1794 | 365 } |
366 | |
14782 | 367 static inline void put_xvimage( XvImage * xvi ) |
368 { | |
369 #ifdef HAVE_SHM | |
370 if (Shmem_Flag) | |
371 { | |
372 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
373 xvi, |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
374 src_rect.left, src_rect.top, src_rect.width, src_rect.height, |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
375 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height, |
14782 | 376 False); |
377 } else | |
378 #endif | |
379 { | |
380 XvPutImage(mDisplay, xv_port, vo_window, vo_gc, | |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
381 xvi, |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
382 src_rect.left, src_rect.top, src_rect.width, src_rect.height, |
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
383 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height); |
14782 | 384 } |
385 } | |
386 | |
31 | 387 static void check_events(void) |
1 | 388 { |
12582 | 389 int e = vo_x11_check_events(mDisplay); |
390 | |
14742 | 391 if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) |
392 { | |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
393 resize(); |
14742 | 394 } |
395 | |
12582 | 396 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) |
14782 | 397 { |
398 /* did we already draw a buffer */ | |
399 if ( visible_buf != -1 ) | |
400 { | |
401 /* redraw the last visible buffer */ | |
402 put_xvimage( xvimage[visible_buf] ); | |
403 } | |
404 } | |
1 | 405 } |
406 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
407 static void draw_osd(void) |
12582 | 408 { |
409 vo_draw_text(image_width - | |
410 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x), | |
411 image_height, draw_alpha_fnc); | |
412 } | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1265
diff
changeset
|
413 |
182 | 414 static void flip_page(void) |
1 | 415 { |
14782 | 416 put_xvimage( xvimage[current_buf] ); |
6304
ee65527096c2
pan&scan support with -vo xv by ?? <mplayer@svennevid.net>
arpi
parents:
6295
diff
changeset
|
417 |
14782 | 418 /* remember the currently visible buffer */ |
419 visible_buf = current_buf; | |
420 | |
12582 | 421 if (num_buffers > 1) |
422 { | |
423 current_buf = | |
424 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers); | |
425 XFlush(mDisplay); | |
426 } else | |
427 XSync(mDisplay, False); | |
428 return; | |
1 | 429 } |
430 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
431 static int draw_slice(uint8_t * image[], int stride[], int w, int h, |
12582 | 432 int x, int y) |
1 | 433 { |
12582 | 434 uint8_t *dst; |
182 | 435 |
12582 | 436 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + |
437 xvimage[current_buf]->pitches[0] * y + x; | |
438 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0], | |
439 stride[0]); | |
182 | 440 |
12582 | 441 x /= 2; |
442 y /= 2; | |
443 w /= 2; | |
444 h /= 2; | |
1 | 445 |
12582 | 446 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + |
447 xvimage[current_buf]->pitches[1] * y + x; | |
448 if (image_format != IMGFMT_YV12) | |
449 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
450 stride[1]); | |
451 else | |
452 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
453 stride[2]); | |
5316 | 454 |
12582 | 455 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + |
456 xvimage[current_buf]->pitches[2] * y + x; | |
457 if (image_format == IMGFMT_YV12) | |
458 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1], | |
459 stride[1]); | |
460 else | |
461 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1], | |
462 stride[2]); | |
6231 | 463 |
12582 | 464 return 0; |
1 | 465 } |
466 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
467 static int draw_frame(uint8_t * src[]) |
12582 | 468 { |
27883
96831cf06109
Remove code from unused and since ages deprecated draw_frame function.
reimar
parents:
27882
diff
changeset
|
469 return VO_ERROR; |
1 | 470 } |
471 | |
12582 | 472 static uint32_t draw_image(mp_image_t * mpi) |
473 { | |
474 if (mpi->flags & MP_IMGFLAG_DIRECT) | |
475 { | |
476 // direct rendering: | |
477 current_buf = (int) (mpi->priv); // hack! | |
478 return VO_TRUE; | |
6760 | 479 } |
12582 | 480 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
481 return VO_TRUE; // done | |
482 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
483 { | |
484 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); | |
485 return VO_TRUE; | |
7684 | 486 } |
12582 | 487 if (mpi->flags & MP_IMGFLAG_YUV) |
488 { | |
489 // packed YUV: | |
490 memcpy_pic(xvimage[current_buf]->data + | |
491 xvimage[current_buf]->offsets[0], mpi->planes[0], | |
492 mpi->w * (mpi->bpp / 8), mpi->h, | |
493 xvimage[current_buf]->pitches[0], mpi->stride[0]); | |
494 return VO_TRUE; | |
7684 | 495 } |
12582 | 496 return VO_FALSE; // not (yet) supported |
6760 | 497 } |
498 | |
12582 | 499 static uint32_t get_image(mp_image_t * mpi) |
500 { | |
501 int buf = current_buf; // we shouldn't change current_buf unless we do DR! | |
502 | |
503 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1) | |
504 return VO_FALSE; // it is not static | |
505 if (mpi->imgfmt != image_format) | |
506 return VO_FALSE; // needs conversion :( | |
4980 | 507 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
12582 | 508 if (mpi->flags & MP_IMGFLAG_READABLE && |
509 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) | |
510 { | |
511 // reference (I/P) frame of IP or IPB: | |
512 if (num_buffers < 2) | |
513 return VO_FALSE; // not enough | |
514 current_ip_buf ^= 1; | |
515 // for IPB with 2 buffers we can DR only one of the 2 P frames: | |
516 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3 | |
517 && current_ip_buf) | |
518 return VO_FALSE; | |
519 buf = current_ip_buf; | |
520 if (mpi->type == MP_IMGTYPE_IPB) | |
521 ++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
|
522 } |
12582 | 523 if (mpi->height > xvimage[buf]->height) |
524 return VO_FALSE; //buffer to small | |
525 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0]) | |
526 return VO_FALSE; //buffer to small | |
527 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) | |
528 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0])) | |
529 { | |
530 current_buf = buf; | |
531 mpi->planes[0] = | |
532 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0]; | |
533 mpi->stride[0] = xvimage[current_buf]->pitches[0]; | |
534 mpi->width = mpi->stride[0] / (mpi->bpp / 8); | |
535 if (mpi->flags & MP_IMGFLAG_PLANAR) | |
536 { | |
537 if (mpi->flags & MP_IMGFLAG_SWAPPED) | |
538 { | |
539 // I420 | |
540 mpi->planes[1] = | |
541 xvimage[current_buf]->data + | |
542 xvimage[current_buf]->offsets[1]; | |
543 mpi->planes[2] = | |
544 xvimage[current_buf]->data + | |
545 xvimage[current_buf]->offsets[2]; | |
546 mpi->stride[1] = xvimage[current_buf]->pitches[1]; | |
547 mpi->stride[2] = xvimage[current_buf]->pitches[2]; | |
548 } else | |
549 { | |
550 // YV12 | |
551 mpi->planes[1] = | |
552 xvimage[current_buf]->data + | |
553 xvimage[current_buf]->offsets[2]; | |
554 mpi->planes[2] = | |
555 xvimage[current_buf]->data + | |
556 xvimage[current_buf]->offsets[1]; | |
557 mpi->stride[1] = xvimage[current_buf]->pitches[2]; | |
558 mpi->stride[2] = xvimage[current_buf]->pitches[1]; | |
559 } | |
560 } | |
561 mpi->flags |= MP_IMGFLAG_DIRECT; | |
562 mpi->priv = (void *) current_buf; | |
563 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
564 return VO_TRUE; | |
4980 | 565 } |
566 return VO_FALSE; | |
567 } | |
568 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
569 static int query_format(uint32_t format) |
1 | 570 { |
10855 | 571 uint32_t i; |
12582 | 572 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 |
573 | |
574 /* check image formats */ | |
575 for (i = 0; i < formats; i++) | |
576 { | |
577 if (fo[i].id == format) | |
578 return flag; //xv_format = fo[i].id; | |
579 } | |
580 return 0; | |
1 | 581 } |
582 | |
12582 | 583 static void uninit(void) |
1852 | 584 { |
12582 | 585 int i; |
586 | |
587 if (!vo_config_count) | |
588 return; | |
14782 | 589 visible_buf = -1; |
12582 | 590 XvFreeAdaptorInfo(ai); |
591 ai = NULL; | |
13953 | 592 if(fo){ |
593 XFree(fo); | |
594 fo=NULL; | |
595 } | |
12582 | 596 for (i = 0; i < num_buffers; i++) |
597 deallocate_xvimage(i); | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
598 #ifdef CONFIG_XF86VM |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27889
diff
changeset
|
599 vo_vm_close(); |
6016 | 600 #endif |
24133 | 601 mp_input_rm_event_fd(ConnectionNumber(mDisplay)); |
12582 | 602 vo_x11_uninit(); |
322
4e69a8e2700a
Screensaver and monitor powersafe function is switched off when playing a
laaz
parents:
249
diff
changeset
|
603 } |
1 | 604 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
605 static int preinit(const char *arg) |
4352 | 606 { |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
607 XvPortID xv_p; |
12582 | 608 int busy_ports = 0; |
10855 | 609 unsigned int i; |
14742 | 610 strarg_t ck_src_arg = { 0, NULL }; |
611 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
|
612 int xv_adaptor = -1; |
14742 | 613 |
614 opt_t subopts[] = | |
615 { | |
616 /* name arg type arg var test */ | |
617 { "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
|
618 { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg }, |
14742 | 619 { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, |
620 { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, | |
621 { NULL } | |
622 }; | |
12582 | 623 |
10826 | 624 xv_port = 0; |
625 | |
14742 | 626 /* parse suboptions */ |
627 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
|
628 { |
14742 | 629 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
|
630 } |
14742 | 631 |
632 /* modify colorkey settings according to the given options */ | |
633 xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str ); | |
634 | |
12582 | 635 if (!vo_init()) |
636 return -1; | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
637 |
12582 | 638 /* check for Xvideo extension */ |
639 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err)) | |
640 { | |
641 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 642 MSGTR_LIBVO_XV_XvNotSupportedByX11); |
12582 | 643 return -1; |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
644 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
645 |
12582 | 646 /* check for Xvideo support */ |
647 if (Success != | |
648 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors, | |
649 &ai)) | |
650 { | |
20765 | 651 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_XV_XvQueryAdaptorsFailed); |
12582 | 652 return -1; |
653 } | |
654 | |
655 /* check adaptors */ | |
656 if (xv_port) | |
657 { | |
10839 | 658 int port_found; |
12582 | 659 |
660 for (port_found = 0, i = 0; !port_found && i < adaptors; i++) | |
661 { | |
662 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) | |
663 { | |
664 for (xv_p = ai[i].base_id; | |
665 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
666 { | |
667 if (xv_p == xv_port) | |
668 { | |
10839 | 669 port_found = 1; |
670 break; | |
671 } | |
672 } | |
673 } | |
674 } | |
12582 | 675 if (port_found) |
676 { | |
10839 | 677 if (XvGrabPort(mDisplay, xv_port, CurrentTime)) |
678 xv_port = 0; | |
12582 | 679 } else |
680 { | |
681 mp_msg(MSGT_VO, MSGL_WARN, | |
20765 | 682 MSGTR_LIBVO_XV_InvalidPortParameter); |
10839 | 683 xv_port = 0; |
684 } | |
10826 | 685 } |
12582 | 686 |
687 for (i = 0; i < adaptors && xv_port == 0; i++) | |
688 { | |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
689 /* 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
|
690 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
|
691 continue; |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25963
diff
changeset
|
692 |
12582 | 693 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) |
694 { | |
695 for (xv_p = ai[i].base_id; | |
696 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p) | |
697 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) | |
698 { | |
699 xv_port = xv_p; | |
27031
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
700 mp_msg(MSGT_VO, MSGL_V, |
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
701 "[VO_XV] Using Xv Adapter #%d (%s)\n", |
0f7770b2230d
Move message about which adapter is used to verbose mode.
diego
parents:
26755
diff
changeset
|
702 i, ai[i].name); |
12582 | 703 break; |
704 } else | |
705 { | |
706 mp_msg(MSGT_VO, MSGL_WARN, | |
20765 | 707 MSGTR_LIBVO_XV_CouldNotGrabPort, (int) xv_p); |
12582 | 708 ++busy_ports; |
709 } | |
710 } | |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
711 } |
12582 | 712 if (!xv_port) |
713 { | |
714 if (busy_ports) | |
715 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 716 MSGTR_LIBVO_XV_CouldNotFindFreePort); |
12582 | 717 else |
718 mp_msg(MSGT_VO, MSGL_ERR, | |
20765 | 719 MSGTR_LIBVO_XV_NoXvideoSupport); |
12582 | 720 return -1; |
5509
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
721 } |
1e90dd889c34
initialization moved to preinit(), query_format now really checks for supported formats
arpi
parents:
5466
diff
changeset
|
722 |
14742 | 723 if ( !vo_xv_init_colorkey() ) |
7857
3c690d2ad1ac
MPlayer being unable to display video properly on many nVidia graphics cards.
arpi
parents:
7848
diff
changeset
|
724 { |
14742 | 725 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
|
726 } |
15826
db966bdf6f5b
Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
reimar
parents:
15540
diff
changeset
|
727 vo_xv_enable_vsync(); |
16958 | 728 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
|
729 |
12582 | 730 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats); |
5566 | 731 |
24133 | 732 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
|
733 return 0; |
4352 | 734 } |
1 | 735 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15826
diff
changeset
|
736 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
|
737 { |
12582 | 738 switch (request) |
739 { | |
740 case VOCTRL_PAUSE: | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
741 return int_pause = 1; |
12582 | 742 case VOCTRL_RESUME: |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
743 return int_pause = 0; |
12582 | 744 case VOCTRL_QUERY_FORMAT: |
745 return query_format(*((uint32_t *) data)); | |
746 case VOCTRL_GET_IMAGE: | |
747 return get_image(data); | |
748 case VOCTRL_DRAW_IMAGE: | |
749 return draw_image(data); | |
750 case VOCTRL_GUISUPPORT: | |
751 return VO_TRUE; | |
752 case VOCTRL_GET_PANSCAN: | |
753 if (!vo_config_count || !vo_fs) | |
754 return VO_FALSE; | |
755 return VO_TRUE; | |
756 case VOCTRL_FULLSCREEN: | |
757 vo_x11_fullscreen(); | |
758 /* indended, fallthrough to update panscan on fullscreen/windowed switch */ | |
759 case VOCTRL_SET_PANSCAN: | |
760 if ((vo_fs && (vo_panscan != vo_panscan_amount)) | |
761 || (!vo_fs && vo_panscan_amount)) | |
762 { | |
763 int old_y = vo_panscan_y; | |
764 | |
765 panscan_calc(); | |
766 | |
767 if (old_y != vo_panscan_y) | |
768 { | |
28511
db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
reimar
parents:
28446
diff
changeset
|
769 resize(); |
12582 | 770 flip_page(); |
771 } | |
772 } | |
773 return VO_TRUE; | |
774 case VOCTRL_SET_EQUALIZER: | |
775 { | |
776 va_list ap; | |
777 int value; | |
778 | |
779 va_start(ap, data); | |
780 value = va_arg(ap, int); | |
781 | |
782 va_end(ap); | |
783 | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
784 return vo_xv_set_eq(xv_port, data, value); |
12582 | 785 } |
786 case VOCTRL_GET_EQUALIZER: | |
787 { | |
788 va_list ap; | |
789 int *value; | |
790 | |
791 va_start(ap, data); | |
792 value = va_arg(ap, int *); | |
793 | |
794 va_end(ap); | |
795 | |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
796 return vo_xv_get_eq(xv_port, data, value); |
12582 | 797 } |
798 case VOCTRL_ONTOP: | |
799 vo_x11_ontop(); | |
800 return VO_TRUE; | |
22232 | 801 case VOCTRL_UPDATE_SCREENINFO: |
802 update_xinerama_info(); | |
803 return VO_TRUE; | |
12582 | 804 } |
805 return VO_NOTIMPL; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
806 } |