annotate libvo/vo_xover.c @ 10740:0b5748047607

sync
author gabucino
date Sun, 31 Aug 2003 20:34:14 +0000
parents e3727e92e9d8
children c2bff70784d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
1 /*
9570
602264261d3e 10L the comment header again. That's it when you stole someone else code ;)
albeu
parents: 9569
diff changeset
2 XOver a general x11 vo for mplayer overlay drivers based on :
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
3 VIDIX accelerated overlay in a X window
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
4
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
5 (C) Alex Beregszaszi & Zoltan Ponekker & Nick Kurshev
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
6
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
7 WS window manager by Pontscho/Fresh!
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
8
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
9 Based on vo_gl.c and vo_vesa.c and vo_xmga.c (.so mastah! ;))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
10 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
11
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
12 #include <stdio.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
13 #include <stdlib.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
14 #include <string.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
15 #include <math.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
16 #include <errno.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
17 #include <unistd.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
18 #include <sys/ioctl.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
19
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
20 #include "config.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
21 #include "video_out.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
22 #include "video_out_internal.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
23
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
24 #include <X11/Xlib.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
25 #include <X11/Xutil.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
26 //#include <X11/keysym.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
27
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
28 #ifdef HAVE_XINERAMA
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
29 #include <X11/extensions/Xinerama.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
30 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
31
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
32 #include "x11_common.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
33 #include "aspect.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
34 #include "mp_msg.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
35
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
36 #ifdef HAVE_NEW_GUI
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
37 #include "../Gui/interface.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
38 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
39
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
40
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
41 static vo_info_t info =
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
42 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
43 "General X11 driver for overlay capable vo's",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
44 "xover",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
45 "Albeu",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
46 ""
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
47 };
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
48
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
49 LIBVO_EXTERN(xover)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
50
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
51 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
52
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
53 /* X11 related variables */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
54 /* Colorkey handling */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
55 static XGCValues mGCV;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
56 static uint32_t fgColor;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
57 static uint32_t bgColor;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
58
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
59 /* Image parameters */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
60 static uint32_t image_width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
61 static uint32_t image_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
62 static uint32_t image_format;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
63
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
64 /* Window parameters */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
65 static uint32_t window_x, window_y;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
66 static uint32_t window_width, window_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
67
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
68 /* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
69 static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
70 drwDepth, drwcX, drwcY, dwidth, dheight;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
71
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
72 #ifdef HAVE_XINERAMA
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
73 extern int xinerama_screen;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
74 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
75
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
76 static vo_functions_t* sub_vo = NULL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
77
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
78
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
79 static void set_window(int force_update)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
80 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
81 Window mRoot;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
82 if ( WinID )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
83 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
84 XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
85 &drwHeight, &drwBorderWidth, &drwDepth);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
86 drwX = drwY = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
87
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
88 XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
89 &drwcX, &drwcY, &mRoot);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
90 aspect(&dwidth,&dheight,A_NOZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
91 if (!vo_fs)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
92 mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
93 drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
94
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
95 /* following stuff copied from vo_xmga.c */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
96 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
97 else
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
98 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
99 aspect(&dwidth,&dheight,A_NOZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
100 drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
101 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
102
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
103 #if X11_FULLSCREEN
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
104 if (vo_fs)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
105 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
106 aspect(&dwidth,&dheight,A_ZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
107 drwX = (vo_screenwidth - ((int)dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
108 drwcX = drwX;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
109 drwY = (vo_screenheight - ((int)dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
110 drwcY = drwY;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
111 drwWidth = ((int)dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
112 drwHeight = ((int)dheight > vo_screenheight ? vo_screenheight : dheight);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
113 mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
114 drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
115 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
116 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
117
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
118 vo_dwidth=drwWidth; vo_dheight=drwHeight;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
119
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
120 #ifdef HAVE_XINERAMA
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
121 if (XineramaIsActive(mDisplay))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
122 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
123 XineramaScreenInfo *screens;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
124 int num_screens;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
125 int i = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
126
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
127 screens = XineramaQueryScreens(mDisplay, &num_screens);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
128
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
129 /* find the screen we are on */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
130 while (i<num_screens &&
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
131 ((screens[i].x_org < (int)drwcX) ||
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
132 (screens[i].y_org < (int)drwcY) ||
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
133 (screens[i].x_org + screens[i].width >= (int)drwcX) ||
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
134 (screens[i].y_org + screens[i].height >= (int)drwcY)))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
135 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
136 i++;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
137 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
138
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
139 if(i<num_screens)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
140 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
141 /* save the screen we are on */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
142 xinerama_screen = i;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
143 } else {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
144 /* oops.. couldnt find the screen we are on
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
145 * because the upper left corner left the
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
146 * visual range. assume we are still on the
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
147 * same screen
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
148 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
149 i = xinerama_screen;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
150 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
151
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
152 /* set drwcX and drwcY to the right values */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
153 drwcX = drwcX - screens[i].x_org;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
154 drwcY = drwcY - screens[i].y_org;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
155 XFree(screens);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
156 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
157 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
158
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
159 if ( vo_panscan > 0.0f && vo_fs )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
160 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
161 drwcX-=vo_panscan_x >> 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
162 drwcY-=vo_panscan_y >> 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
163 drwX-=vo_panscan_x >> 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
164 drwY-=vo_panscan_y >> 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
165 drwWidth+=vo_panscan_x;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
166 drwHeight+=vo_panscan_y;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
167 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
168
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
169 /* set new values in VIDIX */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
170 if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
171 (window_width != drwWidth) || (window_height != drwHeight))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
172 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
173 mp_win_t w;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
174 // do a backup of window coordinates
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
175 w.x = window_x = drwcX;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
176 w.y = window_y = drwcY;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
177 vo_dx = drwcX;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
178 vo_dy = drwcY;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
179 w.w = window_width = drwWidth;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
180 w.h = window_height = drwHeight;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
181
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
182 if(sub_vo->control(VOCTRL_XOVERLAY_SET_WIN,&w) != VO_TRUE)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
183 mp_msg(MSGT_VO, MSGL_ERR, "xvidx: set_overlay failed\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
184
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
185 mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n", vo_dx, vo_dy, window_width, window_height);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
186 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
187
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
188 /* mDrawColorKey: */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
189
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
190 /* fill drawable with specified color */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
191 XSetBackground( mDisplay,vo_gc,bgColor );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
192 XClearWindow( mDisplay,vo_window );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
193 XSetForeground(mDisplay, vo_gc, fgColor);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
194 XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
195 (vo_fs ? drwHeight - 1 : drwHeight));
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
196 /* flush, update drawable */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
197 XFlush(mDisplay);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
198
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
199 return;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
200 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
201
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
202 /* connect to server, create and map window,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
203 * allocate colors and (shared) memory
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
204 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
205 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
206 uint32_t d_height, uint32_t flags, char *title, uint32_t format)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
207 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
208 XVisualInfo vinfo;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
209 // XSizeHints hint;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
210 XSetWindowAttributes xswa;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
211 unsigned long xswamask;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
212 XWindowAttributes attribs;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
213 int window_depth;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
214 mp_colorkey_t colork;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
215 char _title[255];
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
216
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
217 sprintf(_title,"MPlayer %s X11 Overlay",sub_vo->info->name);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
218 title = _title;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
219
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
220 panscan_init();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
221
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
222 image_height = height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
223 image_width = width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
224 image_format = format;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
225 vo_mouse_autohide=1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
226
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
227 aspect_save_orig(width, height);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
228 aspect_save_prescale(d_width, d_height);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
229 aspect_save_screenres(vo_screenwidth, vo_screenheight);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
230
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
231 vo_dx = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
232 vo_dy = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
233 window_width = d_width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
234 window_height = d_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
235
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
236 /* from xmga.c */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
237 bgColor = 0x0L;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
238 switch(vo_depthonscreen)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
239 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
240 case 32:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
241 case 24:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
242 fgColor = 0x00ff00ffL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
243 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
244 case 16:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
245 fgColor = 0xf81fL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
246 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
247 case 15:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
248 fgColor = 0x7c1fL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
249 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
250 default:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
251 mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
252 vo_depthonscreen);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
253 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
254
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
255 aspect(&d_width, &d_height, A_NOZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
256
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
257 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
258 vo_dwidth=d_width; vo_dheight=d_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
259
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
260 #ifdef HAVE_NEW_GUI
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
261 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
262 else
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
263 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
264 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
265
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
266 #ifdef X11_FULLSCREEN
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
267 if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
268 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
269 dwidth = d_width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
270 dheight = d_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
271 /* Make the window */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
272 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
273
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
274 /* from vo_x11 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
275 window_depth = attribs.depth;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
276 if ((window_depth != 15) && (window_depth != 16) && (window_depth != 24)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
277 && (window_depth != 32))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
278 window_depth = 24;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
279 XMatchVisualInfo(mDisplay, mScreen, window_depth, TrueColor, &vinfo);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
280
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
281 xswa.background_pixel = BlackPixel(mDisplay, mScreen);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
282 xswa.border_pixel = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
283 xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
284 vinfo.visual, AllocNone);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
285 xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
286 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
287 xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
288
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
289 if (WinID >= 0)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
290 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
291 vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay, mScreen);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
292 if ( WinID )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
293 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
294 XUnmapWindow(mDisplay, vo_window);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
295 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
296 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
297 } else XSelectInput( mDisplay,vo_window,ExposureMask );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
298 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
299 else
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
300 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
301 if ( vo_window == None )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
302 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
303 vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
304 vo_dx, vo_dy, window_width, window_height, xswa.border_pixel,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
305 vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
306
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
307 vo_x11_classhint(mDisplay, vo_window, "xvidix");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
308 vo_hidecursor(mDisplay, vo_window);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
309 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
310
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
311 XStoreName(mDisplay, vo_window, title);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
312 XMapWindow(mDisplay, vo_window);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
313
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
314 if ( flags&1 ) vo_x11_fullscreen();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
315
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
316 #ifdef HAVE_XINERAMA
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
317 vo_x11_xinerama_move(mDisplay, vo_window);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
318 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
319 } else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
320 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
321
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
322 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
323 vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
324 #ifdef HAVE_NEW_GUI
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
325 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
326 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
327
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
328 if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
329
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
330 if(sub_vo->config(image_width,image_height,vo_dwidth,vo_dheight,
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
331 flags | VOFLAG_XOVERLAY_SUB_VO,NULL,format)) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
332 mp_msg(MSGT_VO, MSGL_ERR, "xover: sub vo config failed\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
333 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
334 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
335 colork.x11 = fgColor;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
336 colork.r = 255;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
337 colork.g = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
338 colork.b = 255;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
339 if(sub_vo->control(VOCTRL_XOVERLAY_SET_COLORKEY,&colork) != VO_TRUE)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
340 mp_msg(MSGT_VO, MSGL_WARN, "xover: set_colorkey failed\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
341
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
342 set_window(1);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
343
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
344 XFlush(mDisplay);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
345 XSync(mDisplay, False);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
346
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
347 panscan_calc();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
348
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
349 saver_off(mDisplay); /* turning off screen saver */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
350
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
351 return(0);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
352 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
353
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
354 static void check_events(void)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
355 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
356 const int event = vo_x11_check_events(mDisplay);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
357
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
358 if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
359 set_window(0);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
360 sub_vo->check_events();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
361 return;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
362 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
363
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
364 /* draw_osd, flip_page, draw_slice, draw_frame should be
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
365 overwritten with vidix functions (vosub_vidix.c) */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
366 static void draw_osd(void)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
367 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
368 mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_osd!\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
369 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
370
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
371 static void flip_page(void)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
372 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
373 mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo flip_page!\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
374 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
375
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
376 static uint32_t draw_slice(uint8_t *src[], int stride[],
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
377 int w, int h, int x, int y)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
378 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
379 UNUSED(src);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
380 UNUSED(stride);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
381 UNUSED(w);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
382 UNUSED(h);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
383 UNUSED(x);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
384 UNUSED(y);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
385 mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_slice!\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
386 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
387 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
388
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
389 static uint32_t draw_frame(uint8_t *src[])
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
390 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
391 UNUSED(src);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
392 mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_frame!\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
393 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
394 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
395
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
396 static void uninit(void)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
397 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
398 if(!vo_config_count) return;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
399 if(sub_vo) sub_vo->uninit();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
400 sub_vo = NULL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
401 saver_on(mDisplay); /* screen saver back on */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
402 vo_x11_uninit();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
403 // Restore our callbacks
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
404 video_out_xover.draw_frame = draw_frame;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
405 video_out_xover.draw_slice = draw_slice;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
406 video_out_xover.flip_page = flip_page;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
407 video_out_xover.draw_osd = draw_osd;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
408 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
409
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
410 static uint32_t preinit(const char *arg)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
411 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
412 int i;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
413
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
414 if(!arg) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
415 mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay need a subdriver\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
416 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
417 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
418
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
419 for(i = 0 ; video_out_drivers[i] != NULL ; i++) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
420 if(!strcmp(video_out_drivers[i]->info->short_name,arg) &&
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
421 strcmp(video_out_drivers[i]->info->short_name,"xover"))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
422 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
423 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
424 if(!video_out_drivers[i]) {
10718
alex
parents: 10512
diff changeset
425 mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subdriver %s not found\n", arg);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
426 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
427 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
428 if(video_out_drivers[i]->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
10718
alex
parents: 10512
diff changeset
429 mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: %s doesn't support XOverlay\n", arg);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
430 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
431 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
432 // X11 init
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
433 if (!vo_init()) return VO_FALSE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
434 if(video_out_drivers[i]->preinit(NULL)) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
435 mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subvo init failed\n");
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
436 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
437 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
438 sub_vo = video_out_drivers[i];
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
439 // Setup the sub vo callbacks
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
440 video_out_xover.draw_frame = sub_vo->draw_frame;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
441 video_out_xover.draw_slice = sub_vo->draw_slice;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
442 video_out_xover.flip_page = sub_vo->flip_page;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
443 video_out_xover.draw_osd = sub_vo->draw_osd;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
444 return 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
445 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
446
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
447 static uint32_t control(uint32_t request, void *data, ...)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
448 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
449 if(!sub_vo) return VO_ERROR;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
450 switch (request) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
451 case VOCTRL_GUISUPPORT:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
452 return VO_TRUE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
453 case VOCTRL_GET_PANSCAN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
454 if ( !vo_config_count || !vo_fs ) return VO_FALSE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
455 return VO_TRUE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
456 case VOCTRL_FULLSCREEN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
457 vo_x11_fullscreen();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
458 case VOCTRL_SET_PANSCAN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
459 if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
460 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
461 panscan_calc();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
462 set_window(0);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
463 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
464 return VO_TRUE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
465 default:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
466 // Safe atm bcs nothing use more than 1 arg
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
467 return sub_vo->control(request,data);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
468 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
469 return VO_NOTIMPL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
470 }