Mercurial > mplayer.hg
annotate libvo/vo_xover.c @ 34309:119af6360b00
Discard frames where the size does not match the AVCodecContext width/height.
This avoids possible crashes on video size changes. The problem
is that we reinitialize the vo on get_buffer but due to codec
delay libavcodec might still return frames with the old size
afterwards, which the vo might no longer be able to handle.
Ideally libavcodec should not show this behaviour, since it
requires that any application using DR1 can handle frames of
different sizes simultaneously - which seems a bit extreme.
author | reimar |
---|---|
date | Mon, 05 Dec 2011 18:08:29 +0000 |
parents | e7f393cb9d0f |
children |
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 /* |
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
2 * XOver a general x11 vo for MPlayer overlay drivers based on: |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
3 * VIDIX-accelerated overlay in an X window |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
4 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
5 * copyright (C) Alex Beregszaszi & Zoltan Ponekker & Nick Kurshev |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
6 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
7 * WS window manager by Pontscho/Fresh! |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
8 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
9 * based on vo_gl.c and vo_vesa.c and vo_xmga.c (.so mastah! ;)) |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
10 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
11 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
12 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
13 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
14 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
15 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
16 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
17 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
18 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
21 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
22 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
23 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
24 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27927
diff
changeset
|
26 */ |
9569
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 #include <stdio.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
29 #include <stdlib.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
30 #include <string.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
31 #include <math.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
32 #include <errno.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
33 #include <unistd.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
34 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
35 #include "config.h" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
36 #include "video_out.h" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
37 #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
|
38 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
39 #include <X11/Xlib.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
40 #include <X11/Xutil.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
41 //#include <X11/keysym.h> |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
42 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
43 #ifdef CONFIG_XINERAMA |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
44 #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
|
45 #endif |
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 #include "x11_common.h" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
48 #include "aspect.h" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
49 #include "mp_msg.h" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
50 |
27343 | 51 #ifdef CONFIG_GUI |
23077 | 52 #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
|
53 #endif |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
54 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
55 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
56 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
|
57 { |
12783 | 58 "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
|
59 "xover", |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
60 "Albeu", |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
61 "" |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
62 }; |
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 LIBVO_EXTERN(xover) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
65 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
66 /* X11 related variables */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
67 /* Colorkey handling */ |
10988 | 68 static int colorkey; |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
69 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
70 /* Image parameters */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
75 /* Window parameters */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
76 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
|
77 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
|
78 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
79 /* 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
|
80 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
|
81 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
|
82 |
25219
e82ecde2cbd4
Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents:
25216
diff
changeset
|
83 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
|
84 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
85 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
86 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
|
87 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
88 Window mRoot; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
89 if ( WinID ) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
90 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
91 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
|
92 &drwHeight, &drwBorderWidth, &drwDepth); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
93 drwX = drwY = 0; |
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 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
|
96 &drwcX, &drwcY, &mRoot); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
97 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
|
98 if (!vo_fs) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
99 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
|
100 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
|
101 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
102 /* following stuff copied from vo_xmga.c */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
103 } |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
104 else |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
105 { |
9569
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_NOZOOM); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
107 drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; |
9569
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 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
110 if (vo_fs) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
111 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
112 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
|
113 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
|
114 drwcX = drwX; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
115 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
|
116 drwcY = drwY; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 } |
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 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
|
124 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
125 #ifdef CONFIG_XINERAMA |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
126 if (XineramaIsActive(mDisplay)) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
127 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
128 XineramaScreenInfo *screens; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
129 int num_screens; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
130 int i = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
131 |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
132 screens = XineramaQueryScreens(mDisplay, &num_screens); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
133 |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
134 /* 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
|
135 while (i<num_screens && |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
136 ((screens[i].x_org < (int)drwcX) || |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
137 (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
|
138 (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
|
139 (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
|
140 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
141 i++; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
142 } |
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 if(i<num_screens) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
145 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
146 /* 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
|
147 xinerama_screen = i; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
148 } else { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
149 /* 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
|
150 * 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
|
151 * 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
|
152 * same screen |
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 i = xinerama_screen; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
155 } |
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 /* 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
|
158 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
|
159 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
|
160 XFree(screens); |
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 #endif |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
163 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
164 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
|
165 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
166 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
|
167 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
|
168 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
|
169 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
|
170 drwWidth+=vo_panscan_x; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
171 drwHeight+=vo_panscan_y; |
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 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
174 /* 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
|
175 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
|
176 (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
|
177 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
178 mp_win_t w; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
179 // 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
|
180 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
|
181 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
|
182 vo_dx = drwcX; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
183 vo_dy = drwcY; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
184 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
|
185 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
|
186 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
187 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
|
188 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
|
189 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
190 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
|
191 } |
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 /* mDrawColorKey: */ |
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 /* fill drawable with specified color */ |
10988 | 196 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
|
197 XClearWindow( mDisplay,vo_window ); |
10988 | 198 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
|
199 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
|
200 (vo_fs ? drwHeight - 1 : drwHeight)); |
11542 | 201 |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
202 /* flush, update drawable */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
203 XFlush(mDisplay); |
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 return; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
206 } |
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 /* 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
|
209 * 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
|
210 */ |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15540
diff
changeset
|
211 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
|
212 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
|
213 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
214 XVisualInfo vinfo; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
215 // XSizeHints hint; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
216 XSetWindowAttributes xswa; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
217 unsigned long xswamask; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
218 XWindowAttributes attribs; |
10988 | 219 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
|
220 mp_colorkey_t colork; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
221 char _title[255]; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
222 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
223 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
|
224 title = _title; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
225 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
226 panscan_init(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
227 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
228 image_height = height; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
229 image_width = width; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
230 image_format = format; |
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 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
|
233 aspect_save_prescale(d_width, d_height); |
18116 | 234 update_xinerama_info(); |
9569
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 window_width = d_width; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
237 window_height = d_height; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
238 |
10988 | 239 r = (vo_colorkey & 0x00ff0000) >> 16; |
240 g = (vo_colorkey & 0x0000ff00) >> 8; | |
241 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
|
242 switch(vo_depthonscreen) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
243 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
244 case 32: |
10988 | 245 colorkey = vo_colorkey; |
246 break; | |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
247 case 24: |
10988 | 248 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
|
249 break; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
250 case 16: |
10988 | 251 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
|
252 break; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
253 case 15: |
10988 | 254 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
|
255 break; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
256 default: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
257 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
|
258 vo_depthonscreen); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
259 } |
13946 | 260 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
|
261 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
262 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
|
263 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
264 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; |
18116 | 265 vo_dx += xinerama_x; |
266 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
|
267 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
|
268 |
27343 | 269 #ifdef CONFIG_GUI |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33725
diff
changeset
|
270 if(use_gui) gui(GUI_SETUP_VIDEO_WINDOW, 0); // the GUI will set up / resize the window |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
271 else |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
272 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
273 #endif |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
274 |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
275 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
|
276 dwidth = d_width; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
277 dheight = d_height; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
278 /* Make the window */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
279 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
|
280 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
281 /* from vo_x11 */ |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
282 window_depth = attribs.depth; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
283 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
|
284 && (window_depth != 32)) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
285 window_depth = 24; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
286 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
|
287 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
288 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
|
289 xswa.border_pixel = 0; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
290 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
|
291 vinfo.visual, AllocNone); |
27927
6f199f065e15
Factor common code like -wid handling, vo_gc creation etc. out into
reimar
parents:
27903
diff
changeset
|
292 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
|
293 |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23616
diff
changeset
|
294 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
|
295 window_width, window_height, flags, |
23822 | 296 xswa.colormap, "xvidix", title); |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23616
diff
changeset
|
297 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
298 |
27343 | 299 #ifdef CONFIG_GUI |
9569
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 #endif |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
302 |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13946
diff
changeset
|
303 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
|
304 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 return 1; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
309 } |
10988 | 310 colork.x11 = colorkey; |
311 colork.r = r; | |
312 colork.g = g; | |
313 colork.b = b; | |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
314 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
|
315 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
|
316 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
317 set_window(1); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
318 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
319 XSync(mDisplay, False); |
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 panscan_calc(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
322 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25219
diff
changeset
|
323 return 0; |
9569
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 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
|
327 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
328 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
|
329 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
330 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
|
331 set_window(0); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
332 sub_vo->check_events(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
333 return; |
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 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
336 /* 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
|
337 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
|
338 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
|
339 { |
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_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
|
341 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
342 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
343 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
|
344 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
345 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
|
346 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
347 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15540
diff
changeset
|
348 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
|
349 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
|
350 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
351 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
|
352 return 1; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15540
diff
changeset
|
355 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
|
356 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
357 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
|
358 return 1; |
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 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
361 static void uninit(void) |
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 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
|
364 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
|
365 sub_vo = NULL; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
366 vo_x11_uninit(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
367 // Restore our callbacks |
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_frame = draw_frame; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
369 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
|
370 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
|
371 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
|
372 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
373 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15540
diff
changeset
|
374 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
|
375 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
376 int i; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
377 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
378 if(!arg) { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
379 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
|
380 return 1; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
381 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
382 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 break; |
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 if(!video_out_drivers[i]) { |
10718 | 389 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
|
390 return 1; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
391 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
392 if(video_out_drivers[i]->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) { |
10718 | 393 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
|
394 return 1; |
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 // X11 init |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
397 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
|
398 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
|
399 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
|
400 return 1; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
401 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
402 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
|
403 // 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
|
404 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
|
405 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
|
406 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
|
407 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
|
408 return 0; |
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 |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
32336
diff
changeset
|
411 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
|
412 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
413 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
|
414 switch (request) { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
415 case VOCTRL_GUISUPPORT: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
416 return VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
417 case VOCTRL_GET_PANSCAN: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
418 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
|
419 return VO_TRUE; |
11542 | 420 case VOCTRL_ONTOP: |
421 vo_x11_ontop(); | |
422 return VO_TRUE; | |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
423 case VOCTRL_FULLSCREEN: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
424 vo_x11_fullscreen(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
425 case VOCTRL_SET_PANSCAN: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
426 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
|
427 { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
428 panscan_calc(); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
429 set_window(0); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
430 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
431 return VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
432 default: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
433 // 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
|
434 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
|
435 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
436 return VO_NOTIMPL; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
diff
changeset
|
437 } |