annotate libvo/vo_xover.c @ 28421:6284666d3794

Remove the Present call after adapter reinitialization, it can not work anyway since no video frame is uploaded to the new context yet.
author reimar
date Tue, 03 Feb 2009 10:54:27 +0000
parents 6f199f065e15
children 7681eab10aea
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
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
19 #include "config.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
20 #include "video_out.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_internal.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
22
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
23 #include <X11/Xlib.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
24 #include <X11/Xutil.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
25 //#include <X11/keysym.h>
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
26
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 27343
diff changeset
27 #ifdef CONFIG_XINERAMA
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
28 #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
29 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
30
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
31 #include "x11_common.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
32 #include "aspect.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
33 #include "mp_msg.h"
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
34
27343
5fe6a8adf569 Rename two GUI-related preprocessor directives:
diego
parents: 26755
diff changeset
35 #ifdef CONFIG_GUI
23077
17bf4f4b0715 Gui --> gui
diego
parents: 21623
diff changeset
36 #include "gui/interface.h"
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
37 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
38
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
39
25216
3aee342be929 Make vo info structs const
reimar
parents: 23822
diff changeset
40 static const vo_info_t info =
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
41 {
12783
d4739143fe2e output wording
diego
parents: 11542
diff changeset
42 "General X11 driver for overlay capable video output drivers",
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
43 "xover",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
44 "Albeu",
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
45 ""
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 LIBVO_EXTERN(xover)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
49
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
50 #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
51
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
52 /* X11 related variables */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
53 /* Colorkey handling */
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
54 static int colorkey;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
55
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
56 /* Image parameters */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
57 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
58 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
59 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
60
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
61 /* Window parameters */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
62 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
63 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
64
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
65 /* 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
66 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
67 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
68
25219
e82ecde2cbd4 Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents: 25216
diff changeset
69 static const vo_functions_t* sub_vo = NULL;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
70
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 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
73 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
74 Window mRoot;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
75 if ( WinID )
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
76 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
77 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
78 &drwHeight, &drwBorderWidth, &drwDepth);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
79 drwX = drwY = 0;
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 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
82 &drwcX, &drwcY, &mRoot);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
83 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
84 if (!vo_fs)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
85 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
86 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
87
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
88 /* 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
89 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
90 else
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
91 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
92 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
93 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
94 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
95
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
96 #if X11_FULLSCREEN
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
97 if (vo_fs)
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_ZOOM);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
100 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
101 drwcX = drwX;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
102 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
103 drwcY = drwY;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
104 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
105 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
106 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
107 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
108 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
109 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
110
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
111 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
112
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 27343
diff changeset
113 #ifdef CONFIG_XINERAMA
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
114 if (XineramaIsActive(mDisplay))
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 XineramaScreenInfo *screens;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
117 int num_screens;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
118 int i = 0;
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 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
121
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
122 /* 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
123 while (i<num_screens &&
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
124 ((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
125 (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
126 (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
127 (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
128 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
129 i++;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
130 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
131
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
132 if(i<num_screens)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
133 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
134 /* 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
135 xinerama_screen = i;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
136 } else {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
137 /* 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
138 * 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
139 * 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
140 * same screen
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
141 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
142 i = xinerama_screen;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
143 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
144
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
145 /* 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
146 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
147 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
148 XFree(screens);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
149 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
150 #endif
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 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
153 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
154 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
155 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
156 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
157 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
158 drwWidth+=vo_panscan_x;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
159 drwHeight+=vo_panscan_y;
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
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
162 /* 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
163 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
164 (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
165 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
166 mp_win_t w;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
167 // 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
168 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
169 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
170 vo_dx = drwcX;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
171 vo_dy = drwcY;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
172 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
173 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
174
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
175 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
176 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
177
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
178 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
179 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
180
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
181 /* mDrawColorKey: */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
182
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
183 /* fill drawable with specified color */
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
184 XSetBackground(mDisplay, vo_gc, 0L);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
185 XClearWindow( mDisplay,vo_window );
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
186 XSetForeground(mDisplay, vo_gc, colorkey);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
187 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
188 (vo_fs ? drwHeight - 1 : drwHeight));
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
189
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
190 /* flush, update drawable */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
191 XFlush(mDisplay);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
192
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
193 return;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
194 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
195
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
196 /* 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
197 * 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
198 */
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
199 static int config(uint32_t width, uint32_t height, uint32_t d_width,
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
200 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
201 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
202 XVisualInfo vinfo;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
203 // XSizeHints hint;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
204 XSetWindowAttributes xswa;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
205 unsigned long xswamask;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
206 XWindowAttributes attribs;
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
207 int window_depth, r, g, b;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
208 mp_colorkey_t colork;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
209 char _title[255];
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
210
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
211 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
212 title = _title;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
213
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
214 panscan_init();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
215
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
216 image_height = height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
217 image_width = width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
218 image_format = format;
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 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
221 aspect_save_prescale(d_width, d_height);
18116
d75953576ae4 Fix and improve xinerama support
reimar
parents: 16171
diff changeset
222 update_xinerama_info();
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
223
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
224 window_width = d_width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
225 window_height = d_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
226
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
227 r = (vo_colorkey & 0x00ff0000) >> 16;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
228 g = (vo_colorkey & 0x0000ff00) >> 8;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
229 b = vo_colorkey & 0x000000ff;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
230 switch(vo_depthonscreen)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
231 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
232 case 32:
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
233 colorkey = vo_colorkey;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
234 break;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
235 case 24:
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
236 colorkey = vo_colorkey & 0x00ffffff;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
237 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
238 case 16:
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
239 colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
240 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
241 case 15:
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
242 colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
9569
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 default:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
245 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
246 vo_depthonscreen);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
247 }
13946
e632b43f0598 Reduce excessive verbosity.
diego
parents: 13787
diff changeset
248 mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
249
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
250 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
251
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
252 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
18116
d75953576ae4 Fix and improve xinerama support
reimar
parents: 16171
diff changeset
253 vo_dx += xinerama_x;
d75953576ae4 Fix and improve xinerama support
reimar
parents: 16171
diff changeset
254 vo_dy += xinerama_y;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
255 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
256
27343
5fe6a8adf569 Rename two GUI-related preprocessor directives:
diego
parents: 26755
diff changeset
257 #ifdef CONFIG_GUI
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
258 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
259 else
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
260 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
261 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
262
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
263 #ifdef X11_FULLSCREEN
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
264 if ( ( flags&VOFLAG_FULLSCREEN )||(flags & VOFLAG_SWSCALE) ) aspect(&d_width, &d_height, A_ZOOM);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
265 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
266 dwidth = d_width;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
267 dheight = d_height;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
268 /* Make the window */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
269 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
270
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
271 /* from vo_x11 */
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
272 window_depth = attribs.depth;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
273 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
274 && (window_depth != 32))
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
275 window_depth = 24;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
276 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
277
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
278 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
279 xswa.border_pixel = 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
280 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
281 vinfo.visual, AllocNone);
27927
6f199f065e15 Factor common code like -wid handling, vo_gc creation etc. out into
reimar
parents: 27903
diff changeset
282 xswamask = CWBackPixel | CWBorderPixel | CWColormap;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
283
23655
00aa61cde84a Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents: 23616
diff changeset
284 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy,
00aa61cde84a Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents: 23616
diff changeset
285 window_width, window_height, flags,
23822
attila
parents: 23655
diff changeset
286 xswa.colormap, "xvidix", title);
23655
00aa61cde84a Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents: 23616
diff changeset
287 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
288
27343
5fe6a8adf569 Rename two GUI-related preprocessor directives:
diego
parents: 26755
diff changeset
289 #ifdef CONFIG_GUI
9569
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 #endif
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
292
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13946
diff changeset
293 if ( ( !WinID )&&( flags&VOFLAG_FULLSCREEN ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
294
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
295 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
296 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
297 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
298 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
299 }
10988
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
300 colork.x11 = colorkey;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
301 colork.r = r;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
302 colork.g = g;
c2bff70784d5 user settable colorkey
alex
parents: 10718
diff changeset
303 colork.b = b;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
304 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
305 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
306
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
307 set_window(1);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
308
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
309 XSync(mDisplay, False);
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 panscan_calc();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
312
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25219
diff changeset
313 return 0;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
314 }
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 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
317 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
318 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
319
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
320 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
321 set_window(0);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
322 sub_vo->check_events();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
323 return;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
324 }
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 /* 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
327 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
328 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
329 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
330 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
331 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
332
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
333 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
334 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
335 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
336 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
337
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
338 static int draw_slice(uint8_t *src[], int stride[],
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
339 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
340 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
341 UNUSED(src);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
342 UNUSED(stride);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
343 UNUSED(w);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
344 UNUSED(h);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
345 UNUSED(x);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
346 UNUSED(y);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
347 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
348 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
349 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
350
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
351 static int draw_frame(uint8_t *src[])
9569
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 UNUSED(src);
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
354 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
355 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
356 }
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 static void uninit(void)
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
359 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
360 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
361 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
362 sub_vo = NULL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
363 vo_x11_uninit();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
364 // Restore our callbacks
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
365 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
366 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
367 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
368 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
369 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
370
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
371 static int preinit(const char *arg)
9569
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 int i;
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 if(!arg) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
376 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
377 return 1;
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
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
380 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
381 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
382 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
383 break;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
384 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
385 if(!video_out_drivers[i]) {
10718
alex
parents: 10512
diff changeset
386 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
387 return 1;
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 if(video_out_drivers[i]->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
10718
alex
parents: 10512
diff changeset
390 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
391 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
392 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
393 // X11 init
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
394 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
395 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
396 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
397 return 1;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
398 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
399 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
400 // 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
401 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
402 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
403 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
404 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
405 return 0;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
406 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
407
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15540
diff changeset
408 static int control(uint32_t request, void *data, ...)
9569
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 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
411 switch (request) {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
412 case VOCTRL_GUISUPPORT:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
413 return VO_TRUE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
414 case VOCTRL_GET_PANSCAN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
415 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
416 return VO_TRUE;
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
417 case VOCTRL_ONTOP:
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
418 vo_x11_ontop();
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
419 return VO_TRUE;
9569
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
420 case VOCTRL_FULLSCREEN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
421 vo_x11_fullscreen();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
422 case VOCTRL_SET_PANSCAN:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
423 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
424 {
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
425 panscan_calc();
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
426 set_window(0);
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 return VO_TRUE;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
429 default:
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
430 // 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
431 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
432 }
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
433 return VO_NOTIMPL;
894d02a6469e vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff changeset
434 }