Add const where appropriate, also gets rid of a compiler warning.
[mplayer/glamo.git] / libvo / vo_xv.c
blobb7e0e74b81ab821e595a41b03c9e1bf84ae65064
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 resize();
300 return 0;
303 static void allocate_xvimage(int foo)
306 * allocate XvImages. FIXME: no error checking, without
307 * mit-shm this will bomb... trzing to fix ::atmos
309 #ifdef HAVE_SHM
310 if (mLocalDisplay && XShmQueryExtension(mDisplay))
311 Shmem_Flag = 1;
312 else
314 Shmem_Flag = 0;
315 mp_msg(MSGT_VO, MSGL_INFO,
316 MSGTR_LIBVO_XV_SharedMemoryNotSupported);
318 if (Shmem_Flag)
320 xvimage[foo] =
321 (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format,
322 NULL, image_width, image_height,
323 &Shminfo[foo]);
325 Shminfo[foo].shmid =
326 shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
327 Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);
328 Shminfo[foo].readOnly = False;
330 xvimage[foo]->data = Shminfo[foo].shmaddr;
331 XShmAttach(mDisplay, &Shminfo[foo]);
332 XSync(mDisplay, False);
333 shmctl(Shminfo[foo].shmid, IPC_RMID, 0);
334 } else
335 #endif
337 xvimage[foo] =
338 (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL,
339 image_width, image_height);
340 xvimage[foo]->data = malloc(xvimage[foo]->data_size);
341 XSync(mDisplay, False);
343 memset(xvimage[foo]->data, 128, xvimage[foo]->data_size);
344 return;
347 static void deallocate_xvimage(int foo)
349 #ifdef HAVE_SHM
350 if (Shmem_Flag)
352 XShmDetach(mDisplay, &Shminfo[foo]);
353 shmdt(Shminfo[foo].shmaddr);
354 } else
355 #endif
357 free(xvimage[foo]->data);
359 XFree(xvimage[foo]);
361 XSync(mDisplay, False);
362 return;
365 static inline void put_xvimage( XvImage * xvi )
367 #ifdef HAVE_SHM
368 if (Shmem_Flag)
370 XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc,
371 xvi,
372 src_rect.left, src_rect.top, src_rect.width, src_rect.height,
373 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height,
374 False);
375 } else
376 #endif
378 XvPutImage(mDisplay, xv_port, vo_window, vo_gc,
379 xvi,
380 src_rect.left, src_rect.top, src_rect.width, src_rect.height,
381 dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
385 static void check_events(void)
387 int e = vo_x11_check_events(mDisplay);
389 if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
391 resize();
394 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause)
396 /* did we already draw a buffer */
397 if ( visible_buf != -1 )
399 /* redraw the last visible buffer */
400 put_xvimage( xvimage[visible_buf] );
405 static void draw_osd(void)
407 vo_draw_text(image_width -
408 image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x),
409 image_height, draw_alpha_fnc);
412 static void flip_page(void)
414 put_xvimage( xvimage[current_buf] );
416 /* remember the currently visible buffer */
417 visible_buf = current_buf;
419 if (num_buffers > 1)
421 current_buf =
422 vo_directrendering ? 0 : ((current_buf + 1) % num_buffers);
423 XFlush(mDisplay);
424 } else
425 XSync(mDisplay, False);
426 return;
429 static int draw_slice(uint8_t * image[], int stride[], int w, int h,
430 int x, int y)
432 uint8_t *dst;
434 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] +
435 xvimage[current_buf]->pitches[0] * y + x;
436 memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0],
437 stride[0]);
439 x /= 2;
440 y /= 2;
441 w /= 2;
442 h /= 2;
444 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] +
445 xvimage[current_buf]->pitches[1] * y + x;
446 if (image_format != IMGFMT_YV12)
447 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1],
448 stride[1]);
449 else
450 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1],
451 stride[2]);
453 dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] +
454 xvimage[current_buf]->pitches[2] * y + x;
455 if (image_format == IMGFMT_YV12)
456 memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1],
457 stride[1]);
458 else
459 memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1],
460 stride[2]);
462 return 0;
465 static int draw_frame(uint8_t * src[])
467 return VO_ERROR;
470 static uint32_t draw_image(mp_image_t * mpi)
472 if (mpi->flags & MP_IMGFLAG_DIRECT)
474 // direct rendering:
475 current_buf = (int) (mpi->priv); // hack!
476 return VO_TRUE;
478 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
479 return VO_TRUE; // done
480 if (mpi->flags & MP_IMGFLAG_PLANAR)
482 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0);
483 return VO_TRUE;
485 if (mpi->flags & MP_IMGFLAG_YUV)
487 // packed YUV:
488 memcpy_pic(xvimage[current_buf]->data +
489 xvimage[current_buf]->offsets[0], mpi->planes[0],
490 mpi->w * (mpi->bpp / 8), mpi->h,
491 xvimage[current_buf]->pitches[0], mpi->stride[0]);
492 return VO_TRUE;
494 return VO_FALSE; // not (yet) supported
497 static uint32_t get_image(mp_image_t * mpi)
499 int buf = current_buf; // we shouldn't change current_buf unless we do DR!
501 if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1)
502 return VO_FALSE; // it is not static
503 if (mpi->imgfmt != image_format)
504 return VO_FALSE; // needs conversion :(
505 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
506 if (mpi->flags & MP_IMGFLAG_READABLE &&
507 (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP))
509 // reference (I/P) frame of IP or IPB:
510 if (num_buffers < 2)
511 return VO_FALSE; // not enough
512 current_ip_buf ^= 1;
513 // for IPB with 2 buffers we can DR only one of the 2 P frames:
514 if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3
515 && current_ip_buf)
516 return VO_FALSE;
517 buf = current_ip_buf;
518 if (mpi->type == MP_IMGTYPE_IPB)
519 ++buf; // preserve space for B
521 if (mpi->height > xvimage[buf]->height)
522 return VO_FALSE; //buffer to small
523 if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0])
524 return VO_FALSE; //buffer to small
525 if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))
526 || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0]))
528 current_buf = buf;
529 mpi->planes[0] =
530 xvimage[current_buf]->data + xvimage[current_buf]->offsets[0];
531 mpi->stride[0] = xvimage[current_buf]->pitches[0];
532 mpi->width = mpi->stride[0] / (mpi->bpp / 8);
533 if (mpi->flags & MP_IMGFLAG_PLANAR)
535 if (mpi->flags & MP_IMGFLAG_SWAPPED)
537 // I420
538 mpi->planes[1] =
539 xvimage[current_buf]->data +
540 xvimage[current_buf]->offsets[1];
541 mpi->planes[2] =
542 xvimage[current_buf]->data +
543 xvimage[current_buf]->offsets[2];
544 mpi->stride[1] = xvimage[current_buf]->pitches[1];
545 mpi->stride[2] = xvimage[current_buf]->pitches[2];
546 } else
548 // YV12
549 mpi->planes[1] =
550 xvimage[current_buf]->data +
551 xvimage[current_buf]->offsets[2];
552 mpi->planes[2] =
553 xvimage[current_buf]->data +
554 xvimage[current_buf]->offsets[1];
555 mpi->stride[1] = xvimage[current_buf]->pitches[2];
556 mpi->stride[2] = xvimage[current_buf]->pitches[1];
559 mpi->flags |= MP_IMGFLAG_DIRECT;
560 mpi->priv = (void *) current_buf;
561 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n");
562 return VO_TRUE;
564 return VO_FALSE;
567 static int query_format(uint32_t format)
569 uint32_t i;
570 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
572 /* check image formats */
573 for (i = 0; i < formats; i++)
575 if (fo[i].id == format)
576 return flag; //xv_format = fo[i].id;
578 return 0;
581 static void uninit(void)
583 int i;
585 if (!vo_config_count)
586 return;
587 visible_buf = -1;
588 XvFreeAdaptorInfo(ai);
589 ai = NULL;
590 if(fo){
591 XFree(fo);
592 fo=NULL;
594 for (i = 0; i < num_buffers; i++)
595 deallocate_xvimage(i);
596 #ifdef CONFIG_XF86VM
597 vo_vm_close();
598 #endif
599 mp_input_rm_event_fd(ConnectionNumber(mDisplay));
600 vo_x11_uninit();
603 static int preinit(const char *arg)
605 XvPortID xv_p;
606 int busy_ports = 0;
607 unsigned int i;
608 strarg_t ck_src_arg = { 0, NULL };
609 strarg_t ck_method_arg = { 0, NULL };
610 int xv_adaptor = -1;
612 const opt_t subopts[] =
614 /* name arg type arg var test */
615 { "port", OPT_ARG_INT, &xv_port, (opt_test_f)int_pos },
616 { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg },
617 { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck },
618 { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm },
619 { NULL }
622 xv_port = 0;
624 /* parse suboptions */
625 if ( subopt_parse( arg, subopts ) != 0 )
627 return -1;
630 /* modify colorkey settings according to the given options */
631 xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
633 if (!vo_init())
634 return -1;
636 /* check for Xvideo extension */
637 if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err))
639 mp_msg(MSGT_VO, MSGL_ERR,
640 MSGTR_LIBVO_XV_XvNotSupportedByX11);
641 return -1;
644 /* check for Xvideo support */
645 if (Success !=
646 XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors,
647 &ai))
649 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_XV_XvQueryAdaptorsFailed);
650 return -1;
653 /* check adaptors */
654 if (xv_port)
656 int port_found;
658 for (port_found = 0, i = 0; !port_found && i < adaptors; i++)
660 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
662 for (xv_p = ai[i].base_id;
663 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p)
665 if (xv_p == xv_port)
667 port_found = 1;
668 break;
673 if (port_found)
675 if (XvGrabPort(mDisplay, xv_port, CurrentTime))
676 xv_port = 0;
677 } else
679 mp_msg(MSGT_VO, MSGL_WARN,
680 MSGTR_LIBVO_XV_InvalidPortParameter);
681 xv_port = 0;
685 for (i = 0; i < adaptors && xv_port == 0; i++)
687 /* check if adaptor number has been specified */
688 if (xv_adaptor != -1 && xv_adaptor != i)
689 continue;
691 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
693 for (xv_p = ai[i].base_id;
694 xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p)
695 if (!XvGrabPort(mDisplay, xv_p, CurrentTime))
697 xv_port = xv_p;
698 mp_msg(MSGT_VO, MSGL_V,
699 "[VO_XV] Using Xv Adapter #%d (%s)\n",
700 i, ai[i].name);
701 break;
702 } else
704 mp_msg(MSGT_VO, MSGL_WARN,
705 MSGTR_LIBVO_XV_CouldNotGrabPort, (int) xv_p);
706 ++busy_ports;
710 if (!xv_port)
712 if (busy_ports)
713 mp_msg(MSGT_VO, MSGL_ERR,
714 MSGTR_LIBVO_XV_CouldNotFindFreePort);
715 else
716 mp_msg(MSGT_VO, MSGL_ERR,
717 MSGTR_LIBVO_XV_NoXvideoSupport);
718 return -1;
721 if ( !vo_xv_init_colorkey() )
723 return -1; // bail out, colorkey setup failed
725 vo_xv_enable_vsync();
726 vo_xv_get_max_img_dim( &max_width, &max_height );
728 fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);
730 mp_input_add_event_fd(ConnectionNumber(mDisplay), check_events);
731 return 0;
734 static int control(uint32_t request, void *data, ...)
736 switch (request)
738 case VOCTRL_PAUSE:
739 return int_pause = 1;
740 case VOCTRL_RESUME:
741 return int_pause = 0;
742 case VOCTRL_QUERY_FORMAT:
743 return query_format(*((uint32_t *) data));
744 case VOCTRL_GET_IMAGE:
745 return get_image(data);
746 case VOCTRL_DRAW_IMAGE:
747 return draw_image(data);
748 case VOCTRL_GUISUPPORT:
749 return VO_TRUE;
750 case VOCTRL_GET_PANSCAN:
751 if (!vo_config_count || !vo_fs)
752 return VO_FALSE;
753 return VO_TRUE;
754 case VOCTRL_FULLSCREEN:
755 vo_x11_fullscreen();
756 /* indended, fallthrough to update panscan on fullscreen/windowed switch */
757 case VOCTRL_SET_PANSCAN:
758 if ((vo_fs && (vo_panscan != vo_panscan_amount))
759 || (!vo_fs && vo_panscan_amount))
761 int old_y = vo_panscan_y;
763 panscan_calc();
765 if (old_y != vo_panscan_y)
767 resize();
768 flip_page();
771 return VO_TRUE;
772 case VOCTRL_SET_EQUALIZER:
774 va_list ap;
775 int value;
777 va_start(ap, data);
778 value = va_arg(ap, int);
780 va_end(ap);
782 return vo_xv_set_eq(xv_port, data, value);
784 case VOCTRL_GET_EQUALIZER:
786 va_list ap;
787 int *value;
789 va_start(ap, data);
790 value = va_arg(ap, int *);
792 va_end(ap);
794 return vo_xv_get_eq(xv_port, data, value);
796 case VOCTRL_ONTOP:
797 vo_x11_ontop();
798 return VO_TRUE;
799 case VOCTRL_UPDATE_SCREENINFO:
800 update_xinerama_info();
801 return VO_TRUE;
803 return VO_NOTIMPL;