Remove unnecessary linking hack, compilation works fine without.
[mplayer/glamo.git] / libvo / vo_xv.c
blob47174d41a0a3dd7d227896b443d6db16b950a477
1 /*
2 * X11 Xv interface
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 // Number of buffers _FOR_DOUBLEBUFFERING_MODE_
22 // Use option -double to enable double buffering! (default: single buffer)
23 #define NUM_BUFFERS 3
26 Buffer allocation:
28 -nodr:
29 1: TEMP
30 2: 2*TEMP
32 -dr:
33 1: TEMP
34 3: 2*STATIC+TEMP
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
41 #include "config.h"
42 #include "mp_msg.h"
43 #include "help_mp.h"
44 #include "video_out.h"
45 #include "video_out_internal.h"
48 #include <X11/Xlib.h>
49 #include <X11/Xutil.h>
50 #include <errno.h>
52 #include "x11_common.h"
54 #include "fastmemcpy.h"
55 #include "sub.h"
56 #include "aspect.h"
58 #include "subopt-helper.h"
60 #include "input/input.h"
62 #ifdef CONFIG_GUI
63 #include "gui/interface.h"
64 #endif
66 #include "libavutil/common.h"
68 static const vo_info_t info = {
69 "X11/Xv",
70 "xv",
71 "Gerd Knorr <kraxel@goldbach.in-berlin.de> and others",
75 const LIBVO_EXTERN(xv)
76 #ifdef HAVE_SHM
77 #include <sys/ipc.h>
78 #include <sys/shm.h>
79 #include <X11/extensions/XShm.h>
81 static XShmSegmentInfo Shminfo[NUM_BUFFERS];
82 static int Shmem_Flag;
83 #endif
85 // Note: depends on the inclusion of X11/extensions/XShm.h
86 #include <X11/extensions/Xv.h>
87 #include <X11/extensions/Xvlib.h>
89 // FIXME: dynamically allocate this stuff
90 static void allocate_xvimage(int);
91 static unsigned int ver, rel, req, ev, err;
92 static unsigned int formats, adaptors, xv_format;
93 static XvAdaptorInfo *ai = NULL;
94 static XvImageFormatValues *fo=NULL;
96 static int current_buf = 0;
97 static int current_ip_buf = 0;
98 static int num_buffers = 1; // default
99 static int visible_buf = -1; // -1 means: no buffer was drawn yet
100 static XvImage *xvimage[NUM_BUFFERS];
103 static uint32_t image_width;
104 static uint32_t image_height;
105 static uint32_t image_format;
107 static int int_pause;
109 static struct vo_rect src_rect;
110 static struct vo_rect dst_rect;
111 static uint32_t max_width = 0, max_height = 0; // zero means: not set
113 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h,
114 unsigned char *src, unsigned char *srca,
115 int stride);
117 static void draw_alpha_yv12(int x0, int y0, int w, int h,
118 unsigned char *src, unsigned char *srca,
119 int stride)
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]);
129 static void draw_alpha_yuy2(int x0, int y0, int w, int h,
130 unsigned char *src, unsigned char *srca,
131 int stride)
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]);
141 static void draw_alpha_uyvy(int x0, int y0, int w, int h,
142 unsigned char *src, unsigned char *srca,
143 int stride)
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]);
153 static void draw_alpha_null(int x0, int y0, int w, int h,
154 unsigned char *src, unsigned char *srca,
155 int stride)
160 static void deallocate_xvimage(int foo);
162 static void resize(void)
164 calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
165 vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1);
166 vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
170 * connect to server, create and map window,
171 * allocate colors and (shared) memory
173 static int config(uint32_t width, uint32_t height, uint32_t d_width,
174 uint32_t d_height, uint32_t flags, char *title,
175 uint32_t format)
177 XVisualInfo vinfo;
178 XSetWindowAttributes xswa;
179 XWindowAttributes attribs;
180 unsigned long xswamask;
181 int depth;
183 #ifdef CONFIG_XF86VM
184 int vm = flags & VOFLAG_MODESWITCHING;
185 #endif
187 image_height = height;
188 image_width = width;
189 image_format = format;
191 if ((max_width != 0 && max_height != 0) &&
192 (image_width > max_width || image_height > max_height))
194 mp_msg( MSGT_VO, MSGL_ERR, MSGTR_VO_XV_ImagedimTooHigh,
195 image_width, image_height, max_width, max_height);
196 return -1;
199 int_pause = 0;
200 visible_buf = -1;
202 num_buffers =
203 vo_doublebuffering ? (vo_directrendering ? NUM_BUFFERS : 2) : 1;
205 /* check image formats */
207 unsigned int i;
209 xv_format = 0;
210 for (i = 0; i < formats; i++)
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;
219 if (!xv_format)
220 return -1;
223 #ifdef CONFIG_GUI
224 if (use_gui)
225 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
226 else
227 #endif
229 #ifdef CONFIG_XF86VM
230 if (vm)
232 vo_vm_switch();
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);
242 xswa.background_pixel = 0;
243 if (xv_ck_info.method == CK_METHOD_BACKGROUND)
245 xswa.background_pixel = xv_colorkey;
247 xswa.border_pixel = 0;
248 xswamask = CWBackPixel | CWBorderPixel;
250 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight,
251 flags, CopyFromParent, "xv", title);
252 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
254 #ifdef CONFIG_XF86VM
255 if (vm)
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);
264 #endif
267 mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n",
268 xv_port);
270 switch (xv_format)
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;
288 if (vo_config_count)
289 for (current_buf = 0; current_buf < num_buffers; ++current_buf)
290 deallocate_xvimage(current_buf);
292 for (current_buf = 0; current_buf < num_buffers; ++current_buf)
293 allocate_xvimage(current_buf);
295 current_buf = 0;
296 current_ip_buf = 0;
298 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
300 resize();
302 return 0;
305 static void allocate_xvimage(int foo)
308 * allocate XvImages. FIXME: no error checking, without
309 * mit-shm this will bomb... trzing to fix ::atmos
311 #ifdef HAVE_SHM
312 if (mLocalDisplay && XShmQueryExtension(mDisplay))
313 Shmem_Flag = 1;
314 else
316 Shmem_Flag = 0;
317 mp_msg(MSGT_VO, MSGL_INFO,
318 MSGTR_LIBVO_XV_SharedMemoryNotSupported);
320 if (Shmem_Flag)
322 xvimage[foo] =
323 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format,
324 NULL, image_width, image_height,
325 &Shminfo[foo]);
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;
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
337 #endif
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);
345 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size);
346 return;
349 static void deallocate_xvimage(int foo)
351 #ifdef HAVE_SHM
352 if (Shmem_Flag)
354 XShmDetach(mDisplay, &Shminfo[foo]);
355 shmdt(Shminfo[foo].shmaddr);
356 } else
357 #endif
359 free(xvimage[foo]->data);
361 XFree(xvimage[foo]);
363 XSync(mDisplay, False);
364 return;
367 static inline void put_xvimage( XvImage * xvi )
369 #ifdef HAVE_SHM
370 if (Shmem_Flag)
372 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc,
373 xvi,
374 src_rect.left, src_rect.top, src_rect.width, src_rect.height,
375 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height,
376 False);
377 } else
378 #endif
380 XvPutImage(mDisplay, xv_port, vo_window, vo_gc,
381 xvi,
382 src_rect.left, src_rect.top, src_rect.width, src_rect.height,
383 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
387 static void check_events(void)
389 int e = vo_x11_check_events(mDisplay);
391 if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
393 resize();
396 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause)
398 /* did we already draw a buffer */
399 if ( visible_buf != -1 )
401 /* redraw the last visible buffer */
402 put_xvimage( xvimage[visible_buf] );
407 static void draw_osd(void)
409 vo_draw_text(image_width -
410 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x),
411 image_height, draw_alpha_fnc);
414 static void flip_page(void)
416 put_xvimage( xvimage[current_buf] );
418 /* remember the currently visible buffer */
419 visible_buf = current_buf;
421 if (num_buffers > 1)
423 current_buf =
424 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers);
425 XFlush(mDisplay);
426 } else
427 XSync(mDisplay, False);
428 return;
431 static int draw_slice(uint8_t * image[], int stride[], int w, int h,
432 int x, int y)
434 uint8_t *dst;
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]);
441 x /= 2;
442 y /= 2;
443 w /= 2;
444 h /= 2;
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]);
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]);
464 return 0;
467 static int draw_frame(uint8_t * src[])
469 return VO_ERROR;
472 static uint32_t draw_image(mp_image_t * mpi)
474 if (mpi->flags & MP_IMGFLAG_DIRECT)
476 // direct rendering:
477 current_buf = (int) (mpi->priv); // hack!
478 return VO_TRUE;
480 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
481 return VO_TRUE; // done
482 if (mpi->flags & MP_IMGFLAG_PLANAR)
484 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0);
485 return VO_TRUE;
487 if (mpi->flags & MP_IMGFLAG_YUV)
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;
496 return VO_FALSE; // not (yet) supported
499 static uint32_t get_image(mp_image_t * mpi)
501 int buf = current_buf; // we shouldn't change current_buf unless we do DR!
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 :(
507 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
508 if (mpi->flags & MP_IMGFLAG_READABLE &&
509 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP))
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
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]))
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)
537 if (mpi->flags & MP_IMGFLAG_SWAPPED)
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
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];
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;
566 return VO_FALSE;
569 static int query_format(uint32_t format)
571 uint32_t i;
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
574 /* check image formats */
575 for (i = 0; i < formats; i++)
577 if (fo[i].id == format)
578 return flag; //xv_format = fo[i].id;
580 return 0;
583 static void uninit(void)
585 int i;
587 if (!vo_config_count)
588 return;
589 visible_buf = -1;
590 XvFreeAdaptorInfo(ai);
591 ai = NULL;
592 if(fo){
593 XFree(fo);
594 fo=NULL;
596 for (i = 0; i < num_buffers; i++)
597 deallocate_xvimage(i);
598 #ifdef CONFIG_XF86VM
599 vo_vm_close();
600 #endif
601 mp_input_rm_event_fd(ConnectionNumber(mDisplay));
602 vo_x11_uninit();
605 static int preinit(const char *arg)
607 XvPortID xv_p;
608 int busy_ports = 0;
609 unsigned int i;
610 strarg_t ck_src_arg = { 0, NULL };
611 strarg_t ck_method_arg = { 0, NULL };
612 int xv_adaptor = -1;
614 opt_t subopts[] =
616 /* name arg type arg var test */
617 { "port", OPT_ARG_INT, &xv_port, (opt_test_f)int_pos },
618 { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg },
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 }
624 xv_port = 0;
626 /* parse suboptions */
627 if ( subopt_parse( arg, subopts ) != 0 )
629 return -1;
632 /* modify colorkey settings according to the given options */
633 xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
635 if (!vo_init())
636 return -1;
638 /* check for Xvideo extension */
639 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err))
641 mp_msg(MSGT_VO, MSGL_ERR,
642 MSGTR_LIBVO_XV_XvNotSupportedByX11);
643 return -1;
646 /* check for Xvideo support */
647 if (Success !=
648 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors,
649 &ai))
651 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_XV_XvQueryAdaptorsFailed);
652 return -1;
655 /* check adaptors */
656 if (xv_port)
658 int port_found;
660 for (port_found = 0, i = 0; !port_found && i < adaptors; i++)
662 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
664 for (xv_p = ai[i].base_id;
665 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p)
667 if (xv_p == xv_port)
669 port_found = 1;
670 break;
675 if (port_found)
677 if (XvGrabPort(mDisplay, xv_port, CurrentTime))
678 xv_port = 0;
679 } else
681 mp_msg(MSGT_VO, MSGL_WARN,
682 MSGTR_LIBVO_XV_InvalidPortParameter);
683 xv_port = 0;
687 for (i = 0; i < adaptors && xv_port == 0; i++)
689 /* check if adaptor number has been specified */
690 if (xv_adaptor != -1 && xv_adaptor != i)
691 continue;
693 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
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))
699 xv_port = xv_p;
700 mp_msg(MSGT_VO, MSGL_V,
701 "[VO_XV] Using Xv Adapter #%d (%s)\n",
702 i, ai[i].name);
703 break;
704 } else
706 mp_msg(MSGT_VO, MSGL_WARN,
707 MSGTR_LIBVO_XV_CouldNotGrabPort, (int) xv_p);
708 ++busy_ports;
712 if (!xv_port)
714 if (busy_ports)
715 mp_msg(MSGT_VO, MSGL_ERR,
716 MSGTR_LIBVO_XV_CouldNotFindFreePort);
717 else
718 mp_msg(MSGT_VO, MSGL_ERR,
719 MSGTR_LIBVO_XV_NoXvideoSupport);
720 return -1;
723 if ( !vo_xv_init_colorkey() )
725 return -1; // bail out, colorkey setup failed
727 vo_xv_enable_vsync();
728 vo_xv_get_max_img_dim( &max_width, &max_height );
730 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);
732 mp_input_add_event_fd(ConnectionNumber(mDisplay), check_events);
733 return 0;
736 static int control(uint32_t request, void *data, ...)
738 switch (request)
740 case VOCTRL_PAUSE:
741 return int_pause = 1;
742 case VOCTRL_RESUME:
743 return int_pause = 0;
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))
763 int old_y = vo_panscan_y;
765 panscan_calc();
767 if (old_y != vo_panscan_y)
769 resize();
770 flip_page();
773 return VO_TRUE;
774 case VOCTRL_SET_EQUALIZER:
776 va_list ap;
777 int value;
779 va_start(ap, data);
780 value = va_arg(ap, int);
782 va_end(ap);
784 return vo_xv_set_eq(xv_port, data, value);
786 case VOCTRL_GET_EQUALIZER:
788 va_list ap;
789 int *value;
791 va_start(ap, data);
792 value = va_arg(ap, int *);
794 va_end(ap);
796 return vo_xv_get_eq(xv_port, data, value);
798 case VOCTRL_ONTOP:
799 vo_x11_ontop();
800 return VO_TRUE;
801 case VOCTRL_UPDATE_SCREENINFO:
802 update_xinerama_info();
803 return VO_TRUE;
805 return VO_NOTIMPL;