Mercurial > mplayer.hg
annotate libvo/vo_sdl.c @ 34615:306ee51a2fa0
Deduplicate some code that exists both in the if and else branch.
author | reimar |
---|---|
date | Sun, 12 Feb 2012 19:27:35 +0000 |
parents | f1a31e5fc35f |
children | 7ed1813fa657 |
rev | line source |
---|---|
1 | 1 /* |
351 | 2 * vo_sdl.c |
3 * | |
579 | 4 * (was video_out_sdl.c from OMS project/mpeg2dec -> http://linuxvideo.org) |
1 | 5 * |
28307
2391228b7ff0
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
28021
diff
changeset
|
6 * Copyright (C) Ryan C. Gordon <icculus@lokigames.com> - April 22, 2000 |
1 | 7 * |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
8 * Copyright (C) Felix Buenemann <atmosfear@users.sourceforge.net> - 2001 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
9 * |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
10 * (for extensive code enhancements) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
11 * |
579 | 12 * Current maintainer for MPlayer project (report bugs to that address): |
13 * Felix Buenemann <atmosfear@users.sourceforge.net> | |
14 * | |
15 * This file is a video out driver using the SDL library (http://libsdl.org/), | |
24871 | 16 * to be used with MPlayer, further info from http://www.mplayerhq.hu |
579 | 17 * |
18 * -- old disclaimer -- | |
19 * | |
1 | 20 * A mpeg2dec display driver that does output through the |
21 * Simple DirectMedia Layer (SDL) library. This effectively gives us all | |
22 * sorts of output options: X11, SVGAlib, fbcon, AAlib, GGI. Win32, MacOS | |
23 * and BeOS support, too. Yay. SDL info, source, and binaries can be found | |
24 * at http://slouken.devolution.com/SDL/ | |
25 * | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
26 * -- end old disclaimer -- |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
27 * |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
28 * This file is part of MPlayer. |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
29 * |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
30 * MPlayer is free software; you can redistribute it and/or modify |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
31 * it under the terms of the GNU General Public License as published by |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
32 * the Free Software Foundation; either version 2 of the License, or |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
33 * (at your option) any later version. |
579 | 34 * |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
35 * MPlayer is distributed in the hope that it will be useful, |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
38 * GNU General Public License for more details. |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
39 * |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
40 * You should have received a copy of the GNU General Public License along |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
41 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26329
diff
changeset
|
42 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
1 | 43 */ |
44 | |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
45 /* define to force software-surface (video surface stored in system memory)*/ |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
46 #undef SDL_NOHWSURFACE |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
47 |
1197 | 48 /* define to enable surface locks, this might be needed on SMP machines */ |
49 #undef SDL_ENABLE_LOCKS | |
50 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
51 /* MONITOR_ASPECT MUST BE FLOAT */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
52 #define MONITOR_ASPECT 4.0/3.0 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
53 |
1 | 54 #include <stdio.h> |
55 #include <stdlib.h> | |
56 #include <string.h> | |
57 #include <inttypes.h> | |
58 | |
26203 | 59 #include "config.h" |
17932 | 60 #include "mp_msg.h" |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
61 #include "mp_msg.h" |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
62 #include "help_mp.h" |
1 | 63 #include "video_out.h" |
64 #include "video_out_internal.h" | |
65 | |
354 | 66 #include "fastmemcpy.h" |
32467 | 67 #include "sub/sub.h" |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
68 #include "aspect.h" |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
69 #include "libmpcodecs/vfcap.h" |
350 | 70 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
26739
diff
changeset
|
71 #ifdef CONFIG_X11 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
72 #include <X11/Xlib.h> |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
73 #include "x11_common.h" |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
74 #endif |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
75 |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
76 #include "subopt-helper.h" |
4590
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
77 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
78 static const vo_info_t info = |
1 | 79 { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
80 "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)", |
1 | 81 "sdl", |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
82 "Ryan C. Gordon <icculus@lokigames.com>, Felix Buenemann <atmosfear@users.sourceforge.net>", |
1 | 83 "" |
84 }; | |
85 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
86 const LIBVO_EXTERN(sdl) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8123
diff
changeset
|
87 |
31032
362425fe3de8
Add sdl_common file and use it to share the input handling between -vo gl
reimar
parents:
31025
diff
changeset
|
88 #include "sdl_common.h" |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
89 //#include <SDL/SDL_syswm.h> |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
90 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
91 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
92 #ifdef SDL_ENABLE_LOCKS |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
93 #define SDL_OVR_LOCK(x) if (SDL_LockYUVOverlay (priv->overlay)) { \ |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
94 mp_msg(MSGT_VO,MSGL_V, "SDL: Couldn't lock YUV overlay\n"); \ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
95 return x; \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
96 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
97 #define SDL_OVR_UNLOCK SDL_UnlockYUVOverlay (priv->overlay); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
98 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
99 #define SDL_SRF_LOCK(srf, x) if(SDL_MUSTLOCK(srf)) { \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
100 if(SDL_LockSurface (srf)) { \ |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
101 mp_msg(MSGT_VO,MSGL_V, "SDL: Couldn't lock RGB surface\n"); \ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
102 return x; \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
103 } \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
104 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
105 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
106 #define SDL_SRF_UNLOCK(srf) if(SDL_MUSTLOCK(srf)) \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
107 SDL_UnlockSurface (srf); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
108 #else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
109 #define SDL_OVR_LOCK(x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
110 #define SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
111 #define SDL_SRF_LOCK(srf, x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
112 #define SDL_SRF_UNLOCK(srf) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
113 #endif |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
114 |
1 | 115 /** Private SDL Data structure **/ |
116 | |
117 static struct sdl_priv_s { | |
118 | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
119 /* output driver used by sdl */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
120 char driver[8]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
121 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
122 /* SDL display surface */ |
1 | 123 SDL_Surface *surface; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
124 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
125 /* SDL RGB surface */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
126 SDL_Surface *rgbsurface; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
127 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
128 /* SDL YUV overlay */ |
1 | 129 SDL_Overlay *overlay; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
130 |
1 | 131 /* available fullscreen modes */ |
132 SDL_Rect **fullmodes; | |
133 | |
134 /* surface attributes for fullscreen and windowed mode */ | |
135 Uint32 sdlflags, sdlfullflags; | |
136 | |
137 /* save the windowed output extents */ | |
138 SDL_Rect windowsize; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
139 |
1 | 140 /* Bits per Pixel */ |
141 Uint8 bpp; | |
142 | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
143 /* RGB or YUV? */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
144 Uint8 mode; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
145 #define YUV 0 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
146 #define RGB 1 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
147 #define BGR 2 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
148 |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
149 /* use direct blitting to surface */ |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
150 int dblit; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
151 |
1 | 152 /* current fullscreen mode, 0 = highest available fullscreen mode */ |
153 int fullmode; | |
154 | |
155 /* YUV ints */ | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
156 int framePlaneY, framePlaneUV, framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
157 int stridePlaneY, stridePlaneUV, stridePlaneYUY; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
158 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
159 /* RGB ints */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
160 int framePlaneRGB; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
161 int stridePlaneRGB; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
162 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
163 /* Flip image */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
164 int flip; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
165 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
166 /* fullscreen behaviour; see init */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
167 int fulltype; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
168 |
951 | 169 /* is X running (0/1) */ |
170 int X; | |
171 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
172 /* X11 Resolution */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
173 int XWidth, XHeight; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
174 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
175 /* original image dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
176 int width, height; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
177 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
178 /* destination dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
179 int dstwidth, dstheight; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
180 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
181 /* Draw image at coordinate y on the SDL surfaces */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
182 int y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
183 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
184 /* The image is displayed between those y coordinates in priv->surface */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
185 int y_screen_top, y_screen_bottom; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
186 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
187 /* 1 if the OSD has changed otherwise 0 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
188 int osd_has_changed; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
189 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
190 /* source image format (YUV/RGB/...) */ |
5058 | 191 uint32_t format; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
192 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
193 /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
194 dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
195 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
196 SDL_Rect dirty_off_frame[2]; |
1 | 197 } sdl_priv; |
198 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
199 static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
200 static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
201 static int setup_surfaces(void); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
202 static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
203 static void erase_rectangle(int x, int y, int w, int h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
204 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
205 /* Expand 'rect' to contain the rectangle specified by x, y, w and h */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
206 static void expand_rect(SDL_Rect* rect, int x, int y, int w, int h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
207 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
208 if(rect->x < 0 || rect->y < 0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
209 rect->x = x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
210 rect->y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
211 rect->w = w; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
212 rect->h = h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
213 return; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
214 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
215 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
216 if(rect->x > x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
217 rect->x = x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
218 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
219 if(rect->y > y) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
220 rect->y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
221 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
222 if(rect->x + rect->w < x + w) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
223 rect->w = x + w - rect->x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
224 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
225 if(rect->y + rect->h < y + h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
226 rect->h = y + h - rect->y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
227 } |
1 | 228 |
351 | 229 /** libvo Plugin functions **/ |
230 | |
231 /** | |
232 * draw_alpha is used for osd and subtitle display. | |
233 * | |
234 **/ | |
235 | |
236 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
408 | 237 struct sdl_priv_s *priv = &sdl_priv; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
238 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
239 if(priv->osd_has_changed) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
240 /* OSD did change. Store a bounding box of everything drawn into the OSD */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
241 if(priv->y >= y0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
242 /* Make sure we don't mark part of the frame area dirty */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
243 if(h + y0 > priv->y) |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
244 expand_rect(&priv->dirty_off_frame[0], x0, y0, w, priv->y - y0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
245 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
246 expand_rect(&priv->dirty_off_frame[0], x0, y0, w, h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
247 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
248 else if(priv->y + priv->height <= y0 + h) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
249 /* Make sure we don't mark part of the frame area dirty */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
250 if(y0 < priv->y + priv->height) |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
251 expand_rect(&priv->dirty_off_frame[1], x0, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
252 priv->y + priv->height, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
253 w, h - ((priv->y + priv->height) - y0)); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
254 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
255 expand_rect(&priv->dirty_off_frame[1], x0, y0, w, h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
256 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
257 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
258 else { /* OSD contents didn't change only draw parts that was erased by the frame */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
259 if(priv->y >= y0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
260 src = src + (priv->y - y0) * stride; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
261 srca = srca + (priv->y - y0) * stride; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
262 h -= priv->y - y0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
263 y0 = priv->y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
264 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
265 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
266 if(priv->y + priv->height <= y0 + h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
267 h = priv->y + priv->height - y0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
268 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
269 if(h <= 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
270 return; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
271 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
272 |
408 | 273 switch(priv->format) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
274 case IMGFMT_YV12: |
408 | 275 case IMGFMT_I420: |
276 case IMGFMT_IYUV: | |
5260 | 277 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); |
408 | 278 break; |
279 case IMGFMT_YUY2: | |
5260 | 280 case IMGFMT_YVYU: |
281 x0 *= 2; | |
282 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
283 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
284 case IMGFMT_UYVY: |
5260 | 285 x0 *= 2; |
286 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
287 break; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
288 |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
289 default: |
5260 | 290 if(priv->dblit) { |
291 x0 *= priv->surface->format->BytesPerPixel; | |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
292 switch(priv->format) { |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
293 case IMGFMT_RGB15: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
294 case IMGFMT_BGR15: |
5260 | 295 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
296 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
297 case IMGFMT_RGB16: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
298 case IMGFMT_BGR16: |
5260 | 299 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
300 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
301 case IMGFMT_RGB24: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
302 case IMGFMT_BGR24: |
5260 | 303 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
304 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
305 case IMGFMT_RGB32: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
306 case IMGFMT_BGR32: |
5260 | 307 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
308 break; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
309 } |
5260 | 310 } |
311 else { | |
312 x0 *= priv->rgbsurface->format->BytesPerPixel; | |
313 switch(priv->format) { | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
314 case IMGFMT_RGB15: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
315 case IMGFMT_BGR15: |
5260 | 316 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
317 break; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
318 case IMGFMT_RGB16: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
319 case IMGFMT_BGR16: |
5260 | 320 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
321 break; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
322 case IMGFMT_RGB24: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
323 case IMGFMT_BGR24: |
5260 | 324 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
325 break; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
326 case IMGFMT_RGB32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
327 case IMGFMT_BGR32: |
5260 | 328 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
329 break; |
5260 | 330 } |
331 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
332 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
333 } |
351 | 334 } |
1 | 335 |
336 | |
337 /** | |
338 * Take a null-terminated array of pointers, and find the last element. | |
339 * | |
340 * params : array == array of which we want to find the last element. | |
341 * returns : index of last NON-NULL element. | |
342 **/ | |
343 | |
344 static inline int findArrayEnd (SDL_Rect **array) | |
345 { | |
346 int i = 0; | |
347 while ( array[i++] ); /* keep loopin' ... */ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
348 |
1 | 349 /* return the index of the last array element */ |
350 return i - 1; | |
351 } | |
352 | |
353 | |
354 /** | |
355 * Open and prepare SDL output. | |
356 * | |
357 * params : *plugin == | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
358 * *name == |
1 | 359 * returns : 0 on success, -1 on failure |
360 **/ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
361 |
1 | 362 static int sdl_open (void *plugin, void *name) |
363 { | |
364 struct sdl_priv_s *priv = &sdl_priv; | |
365 const SDL_VideoInfo *vidInfo = NULL; | |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
366 /*static int opened = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
367 |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
368 if (opened) |
1 | 369 return 0; |
4528
bd2324553533
Fix multifile playback (sdl was not fully reinitialized).
atmos4
parents:
4433
diff
changeset
|
370 opened = 1;*/ |
1 | 371 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
372 |
1 | 373 /* other default values */ |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
374 #ifdef SDL_NOHWSURFACE |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
375 mp_msg(MSGT_VO,MSGL_V, "SDL: using software-surface\n"); |
12683
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
376 priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT; |
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
377 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT; |
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
378 // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
379 #else |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
380 /*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) { |
17932 | 381 if( mp_msg_test(MSGT_VO,MSGL_V) ) { |
382 printf("SDL: using software-surface\n"); } | |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
383 priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
384 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
385 } |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
386 else { */ |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
387 mp_msg(MSGT_VO,MSGL_V, "SDL: using hardware-surface\n"); |
12683
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
388 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE/*|SDL_ANYFORMAT*/; |
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
389 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN/*|SDL_ANYFORMAT*/; |
411c38e35f0a
asyncblit slows down on UP systems, regarding to the SDL docs, noticed by John Phillip
alex
parents:
12682
diff
changeset
|
390 // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
391 //} |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
392 #endif |
10945 | 393 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
394 #if !defined( __AMIGAOS4__ ) && !defined( __APPLE__ ) |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
395 priv->sdlfullflags |= SDL_DOUBLEBUF; |
10945 | 396 #endif |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
397 |
1 | 398 /* get information about the graphics adapter */ |
399 vidInfo = SDL_GetVideoInfo (); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
400 |
1 | 401 /* collect all fullscreen & hardware modes available */ |
402 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { | |
403 | |
404 /* non hardware accelerated fullscreen modes */ | |
405 priv->sdlfullflags &= ~SDL_HWSURFACE; | |
406 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); | |
407 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
408 |
1 | 409 /* test for normal resizeable & windowed hardware accellerated surfaces */ |
410 if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
411 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
412 /* test for NON hardware accelerated resizeable surfaces - poor you. |
1 | 413 * That's all we have. If this fails there's nothing left. |
414 * Theoretically there could be Fullscreenmodes left - we ignore this for now. | |
415 */ | |
416 priv->sdlflags &= ~SDL_HWSURFACE; | |
417 if ((!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) && (!priv->fullmodes)) { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
418 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_CouldntGetAnyAcceptableSDLModeForOutput); |
1 | 419 return -1; |
420 } | |
421 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
422 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
423 |
1 | 424 /* YUV overlays need at least 16-bit color depth, but the |
425 * display might less. The SDL AAlib target says it can only do | |
426 * 8-bits, for example. So, if the display is less than 16-bits, | |
427 * we'll force the BPP to 16, and pray that SDL can emulate for us. | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
428 */ |
1 | 429 priv->bpp = vidInfo->vfmt->BitsPerPixel; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
430 if (priv->mode == YUV && priv->bpp < 16) { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
431 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
432 mp_msg(MSGT_VO,MSGL_V, "SDL: Your SDL display target wants to be at a color " |
5240 | 433 "depth of (%d), but we need it to be at least 16 " |
434 "bits, so we need to emulate 16-bit color. This is " | |
435 "going to slow things down; you might want to " | |
436 "increase your display's color depth, if possible.\n", | |
437 priv->bpp); | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
438 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
439 priv->bpp = 16; |
1 | 440 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
441 |
1 | 442 /* Success! */ |
443 return 0; | |
444 } | |
445 | |
446 | |
447 /** | |
448 * Close SDL, Cleanups, Free Memory | |
449 * | |
450 * params : *plugin | |
451 * returns : non-zero on success, zero on error. | |
452 **/ | |
453 | |
454 static int sdl_close (void) | |
455 { | |
456 struct sdl_priv_s *priv = &sdl_priv; | |
457 | |
9669
4d9f067a80da
pass correct key for ESCAPE, bug noticed by Vladimir Mosgalin <mosgalin@VM10124.spb.edu> and moved SDL_ShowCursor from the check_keys() to uninit() (by me)
alex
parents:
9380
diff
changeset
|
458 if (priv->fullmode) |
4d9f067a80da
pass correct key for ESCAPE, bug noticed by Vladimir Mosgalin <mosgalin@VM10124.spb.edu> and moved SDL_ShowCursor from the check_keys() to uninit() (by me)
alex
parents:
9380
diff
changeset
|
459 SDL_ShowCursor(1); |
4d9f067a80da
pass correct key for ESCAPE, bug noticed by Vladimir Mosgalin <mosgalin@VM10124.spb.edu> and moved SDL_ShowCursor from the check_keys() to uninit() (by me)
alex
parents:
9380
diff
changeset
|
460 |
1 | 461 /* Cleanup YUV Overlay structure */ |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
462 if (priv->overlay) { |
1 | 463 SDL_FreeYUVOverlay(priv->overlay); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
464 priv->overlay=NULL; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
465 } |
1 | 466 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
467 /* Free RGB Surface */ |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
468 if (priv->rgbsurface) { |
1126 | 469 SDL_FreeSurface(priv->rgbsurface); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
470 priv->rgbsurface=NULL; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
471 } |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
472 |
1 | 473 /* Free our blitting surface */ |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
474 if (priv->surface) { |
1 | 475 SDL_FreeSurface(priv->surface); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
476 priv->surface=NULL; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
477 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
478 |
11000 | 479 /* DON'T attempt to free the fullscreen modes array. SDL_Quit* does this for us */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
480 |
1 | 481 return 0; |
482 } | |
483 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
484 /* Set video mode. Not fullscreen */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
485 static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
486 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
487 struct sdl_priv_s *priv = &sdl_priv; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
488 SDL_Surface* newsurface; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
489 |
8149 | 490 if(priv->rgbsurface) |
491 SDL_FreeSurface(priv->rgbsurface); | |
492 else if(priv->overlay) | |
493 SDL_FreeYUVOverlay(priv->overlay); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
494 |
8149 | 495 priv->rgbsurface = NULL; |
496 priv->overlay = NULL; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
497 |
34611 | 498 vo_dwidth = width; |
499 vo_dheight = height; | |
500 newsurface = sdl_set_mode(bpp, sdlflags); | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
501 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
502 if(newsurface) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
503 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
504 /* priv->surface will be NULL the first time this function is called. */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
505 if(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
506 SDL_FreeSurface(priv->surface); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
507 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
508 priv->surface = newsurface; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
509 priv->dstwidth = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
510 priv->dstheight = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
511 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
512 setup_surfaces(); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
513 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
514 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
515 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
516 static void set_fullmode (int mode) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
517 struct sdl_priv_s *priv = &sdl_priv; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
518 SDL_Surface *newsurface = NULL; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
519 int screen_surface_w, screen_surface_h; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
520 |
8149 | 521 if(priv->rgbsurface) |
522 SDL_FreeSurface(priv->rgbsurface); | |
523 else if(priv->overlay) | |
524 SDL_FreeYUVOverlay(priv->overlay); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
525 |
8149 | 526 priv->rgbsurface = NULL; |
527 priv->overlay = NULL; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
528 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
529 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */ |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
530 /* But select a mode where the full video enter */ |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
531 if(priv->X && priv->fulltype & VOFLAG_FULLSCREEN) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
532 screen_surface_w = priv->XWidth; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
533 screen_surface_h = priv->XHeight; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
534 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
535 else if (mode < 0) { |
8054 | 536 int i,j,imax; |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
537 mode = 0; // Default to the biggest mode avaible |
17932 | 538 if ( mp_msg_test(MSGT_VO,MSGL_V) ) for(i=0;priv->fullmodes[i];++i) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
539 mp_msg(MSGT_VO,MSGL_V, "SDL Mode: %d: %d x %d\n", i, priv->fullmodes[i]->w, priv->fullmodes[i]->h); |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
540 for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
541 if( (priv->fullmodes[i]->w >= priv->dstwidth) && |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
542 (priv->fullmodes[i]->h >= priv->dstheight) ) { |
8054 | 543 imax = i; |
544 for (j = findArrayEnd(priv->fullmodes) - 1; j >=0; j--) { | |
545 if (priv->fullmodes[j]->w > priv->fullmodes[imax]->w | |
546 && priv->fullmodes[j]->h == priv->fullmodes[imax]->h) | |
547 imax = j; | |
548 } | |
549 mode = imax; | |
550 break; | |
551 } | |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
552 } |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
553 mp_msg(MSGT_VO,MSGL_V, "SET SDL Mode: %d: %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h); |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
554 priv->fullmode = mode; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
555 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
556 screen_surface_h = priv->fullmodes[mode]->h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
557 screen_surface_w = priv->fullmodes[mode]->w; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
558 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
559 aspect_save_screenres(screen_surface_w, screen_surface_h); |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
560 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
561 /* calculate new video size/aspect */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
562 if(priv->mode == YUV) { |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
563 if(priv->fulltype&VOFLAG_FULLSCREEN) |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
564 aspect_save_screenres(priv->XWidth, priv->XHeight); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
565 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
566 aspect(&priv->dstwidth, &priv->dstheight, A_ZOOM); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
567 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
568 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
569 /* try to change to given fullscreenmode */ |
34611 | 570 vo_dwidth = priv->dstwidth; |
571 vo_dheight = screen_surface_h; | |
572 newsurface = sdl_set_mode(priv->bpp, priv->sdlfullflags); | |
7201
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
573 |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
574 /* |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
575 * In Mac OS X (and possibly others?) SDL_SetVideoMode() appears to |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
576 * destroy the datastructure previously retrived, so we need to |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
577 * re-assign it. The comment in sdl_close() seems to imply that we |
7201
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
578 * should not free() anything. |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
579 */ |
25397
084619331d92
Replace some more broken SYS_DARWIN preprocessor conditionals with __APPLE__.
diego
parents:
25220
diff
changeset
|
580 #ifdef __APPLE__ |
7201
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
581 { |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
582 const SDL_VideoInfo *vidInfo = NULL; |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
583 vidInfo = SDL_GetVideoInfo (); |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
584 |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
585 /* collect all fullscreen & hardware modes available */ |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
586 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
587 |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
588 /* non hardware accelerated fullscreen modes */ |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
589 priv->sdlfullflags &= ~SDL_HWSURFACE; |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
590 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
591 } |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
592 } |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
593 #endif |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
594 |
22beff6edf75
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
atmos4
parents:
7124
diff
changeset
|
595 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
596 |
24736 | 597 /* if creation of new surface was successful, save it and hide mouse cursor */ |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
598 if(newsurface) { |
1126 | 599 if (priv->surface) |
600 SDL_FreeSurface(priv->surface); | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
601 priv->surface = newsurface; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
602 SDL_ShowCursor(0); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
603 SDL_SRF_LOCK(priv->surface, -1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
604 SDL_FillRect(priv->surface, NULL, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
605 SDL_SRF_UNLOCK(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
606 setup_surfaces(); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
607 } |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
608 } |
1126 | 609 |
1 | 610 |
611 /** | |
612 * Initialize an SDL surface and an SDL YUV overlay. | |
613 * | |
614 * params : width == width of video we'll be displaying. | |
615 * height == height of video we'll be displaying. | |
616 * fullscreen == want to be fullscreen? | |
617 * title == Title for window titlebar. | |
618 * returns : non-zero on success, zero on error. | |
619 **/ | |
620 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
621 static int |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7111
diff
changeset
|
622 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
1 | 623 //static int sdl_setup (int width, int height) |
624 { | |
625 struct sdl_priv_s *priv = &sdl_priv; | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
626 |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
627 switch(format){ |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
628 case IMGFMT_I420: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
629 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_MappingI420ToIYUV); |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
630 format = SDL_IYUV_OVERLAY; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
631 case IMGFMT_YV12: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
632 case IMGFMT_IYUV: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
633 case IMGFMT_YUY2: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
634 case IMGFMT_UYVY: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
635 case IMGFMT_YVYU: |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
636 priv->mode = YUV; |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
637 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
638 case IMGFMT_BGR15: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
639 case IMGFMT_BGR16: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
640 case IMGFMT_BGR24: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
641 case IMGFMT_BGR32: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
642 priv->mode = BGR; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
643 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
644 case IMGFMT_RGB15: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
645 case IMGFMT_RGB16: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
646 case IMGFMT_RGB24: |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
647 case IMGFMT_RGB32: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
648 priv->mode = RGB; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
649 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
650 default: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
651 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_UnsupportedImageFormat,format); |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
652 return -1; |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
653 } |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
654 |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
655 if ( vo_config_count ) sdl_close(); |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
656 |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
657 mp_msg(MSGT_VO,MSGL_V, "SDL: Using 0x%X (%s) image format\n", format, vo_format_name(format)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
658 |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
659 if(priv->mode != YUV) { |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
660 priv->sdlflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
661 priv->sdlfullflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
662 } |
1 | 663 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
664 /* SDL can only scale YUV data */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
665 if(priv->mode == RGB || priv->mode == BGR) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
666 d_width = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
667 d_height = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
668 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
669 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
670 aspect_save_orig(width,height); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
671 aspect_save_prescale(d_width ? d_width : width, d_height ? d_height : height); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
672 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
673 /* Save the original Image size */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
674 priv->width = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
675 priv->height = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
676 priv->dstwidth = d_width ? d_width : width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
677 priv->dstheight = d_height ? d_height : height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
678 |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
679 priv->format = format; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
680 |
1080 | 681 if (sdl_open(NULL, NULL) != 0) |
682 return -1; | |
1 | 683 |
34552 | 684 if (WinID < 0) { |
351 | 685 /* Set output window title */ |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
686 SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
687 //SDL_WM_SetCaption (title, title); |
34552 | 688 } |
351 | 689 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
690 if(priv->X) { |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
691 aspect_save_screenres(priv->XWidth,priv->XHeight); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
692 aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
693 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
694 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
695 priv->windowsize.w = priv->dstwidth; |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
696 priv->windowsize.h = priv->dstheight; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
697 |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
698 /* bit 0 (0x01) means fullscreen (-fs) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
699 * bit 1 (0x02) means mode switching (-vm) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
700 * bit 2 (0x04) enables software scaling (-zoom) |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
701 * bit 3 (0x08) enables flipping (-flip) |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
702 */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
703 // printf("SDL: flags are set to: %i\n", flags); |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
704 // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
705 if(flags&VOFLAG_FLIPPING) { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
706 mp_msg(MSGT_VO,MSGL_V, "SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
707 priv->flip = 1; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
708 } |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
709 if(flags&VOFLAG_FULLSCREEN) { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
710 mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen without modeswitching\n"); |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
711 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_InfoPleaseUseVmOrZoom); |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
712 priv->fulltype = VOFLAG_FULLSCREEN; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
713 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
714 /*if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags))) |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
715 SDL_ShowCursor(0);*/ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
716 } else |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
717 if(flags&VOFLAG_MODESWITCHING) { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
718 mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n"); |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
719 priv->fulltype = VOFLAG_MODESWITCHING; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
720 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
721 /*if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags))) |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
722 SDL_ShowCursor(0);*/ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
723 } else |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
724 if(flags&VOFLAG_SWSCALE) { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
725 mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n"); |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
726 priv->fulltype = VOFLAG_SWSCALE; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
727 set_fullmode(priv->fullmode); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
728 } |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
729 else { |
4925 | 730 if((strcmp(priv->driver, "x11") == 0) |
731 ||(strcmp(priv->driver, "windib") == 0) | |
732 ||(strcmp(priv->driver, "directx") == 0) | |
8246
a8128852c18d
Add Quartz (OS X GUI) to SDL window-capable list, patch by Tomas Hurka <tom at hukatronic.cz>
atmos4
parents:
8149
diff
changeset
|
733 ||(strcmp(priv->driver, "Quartz") == 0) |
10945 | 734 ||(strcmp(priv->driver, "cgx") == 0) |
21734 | 735 ||(strcmp(priv->driver, "os4video") == 0) |
10945 | 736 ||((strcmp(priv->driver, "aalib") == 0) && priv->X)){ |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
737 mp_msg(MSGT_VO,MSGL_V, "SDL: setting windowed mode\n"); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
738 set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
739 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
740 else { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
741 mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n"); |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14876
diff
changeset
|
742 priv->fulltype = VOFLAG_SWSCALE; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
743 set_fullmode(priv->fullmode); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
744 } |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
745 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
746 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
747 if(!priv->surface) { // cannot SetVideoMode |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
748 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_FailedToSetVideoMode, SDL_GetError()); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
749 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
750 } |
1 | 751 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
752 return 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
753 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
754 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
755 /* Free priv->rgbsurface or priv->overlay if they are != NULL. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
756 * Setup priv->rgbsurface or priv->overlay depending on source format. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
757 * The size of the created surface or overlay depends on the size of |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
758 * priv->surface, priv->width, priv->height, priv->dstwidth and priv->dstheight. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
759 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
760 static int setup_surfaces(void) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
761 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
762 struct sdl_priv_s *priv = &sdl_priv; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
763 float v_scale = ((float) priv->dstheight) / priv->height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
764 int surfwidth, surfheight; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
765 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
766 surfwidth = priv->width; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
767 surfheight = priv->height + (priv->surface->h - priv->dstheight) / v_scale; |
5358 | 768 surfheight&= ~1; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
769 /* Place the image in the middle of the screen */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
770 priv->y = (surfheight - priv->height) / 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
771 priv->y_screen_top = priv->y * v_scale; |
5313 | 772 priv->y_screen_bottom = priv->y_screen_top + priv->dstheight; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
773 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
774 priv->dirty_off_frame[0].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
775 priv->dirty_off_frame[0].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
776 priv->dirty_off_frame[1].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
777 priv->dirty_off_frame[1].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
778 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
779 /* Make sure the entire screen is updated */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
780 vo_osd_changed(1); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
781 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
782 if(priv->rgbsurface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
783 SDL_FreeSurface(priv->rgbsurface); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
784 else if(priv->overlay) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
785 SDL_FreeYUVOverlay(priv->overlay); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
786 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
787 priv->rgbsurface = NULL; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
788 priv->overlay = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
789 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
790 if(priv->mode != YUV && (priv->format&0xFF) == priv->bpp) { |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
791 if(strcmp(priv->driver, "x11") == 0) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
792 priv->dblit = 1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
793 priv->framePlaneRGB = priv->width * priv->height * priv->surface->format->BytesPerPixel; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
794 priv->stridePlaneRGB = priv->width * priv->surface->format->BytesPerPixel; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
795 erase_rectangle(0, 0, priv->surface->w, priv->surface->h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
796 return 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
797 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
798 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
799 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
800 switch(priv->format) { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
801 /* Initialize and create the RGB Surface used for video out in BGR/RGB mode */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
802 //SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
803 // SDL_SWSURFACE,SDL_HWSURFACE,SDL_SRCCOLORKEY, priv->flags? guess: exchange Rmask and Bmask for BGR<->RGB |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
804 // 32 bit: a:ff000000 r:ff000 g:ff00 b:ff |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
805 // 24 bit: r:ff0000 g:ff00 b:ff |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
806 // 16 bit: r:1111100000000000b g:0000011111100000b b:0000000000011111b |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
807 // 15 bit: r:111110000000000b g:000001111100000b b:000000000011111b |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
808 // FIXME: colorkey detect based on bpp, FIXME static bpp value, FIXME alpha value correct? |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
809 case IMGFMT_RGB15: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
810 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31, 992, 31744, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
811 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
812 case IMGFMT_BGR15: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
813 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31744, 992, 31, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
814 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
815 case IMGFMT_RGB16: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
816 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 31, 2016, 63488, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
817 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
818 case IMGFMT_BGR16: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
819 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 63488, 2016, 31, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
820 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
821 case IMGFMT_RGB24: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
822 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0x0000FF, 0x00FF00, 0xFF0000, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
823 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
824 case IMGFMT_BGR24: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
825 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0xFF0000, 0x00FF00, 0x0000FF, 0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
826 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
827 case IMGFMT_RGB32: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
828 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0/*0xFF000000*/); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
829 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
830 case IMGFMT_BGR32: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
831 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
832 break; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
833 default: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
834 /* Initialize and create the YUV Overlay used for video out */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
835 if (!(priv->overlay = SDL_CreateYUVOverlay (surfwidth, surfheight, priv->format, priv->surface))) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
836 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_CouldntCreateAYUVOverlay, SDL_GetError()); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
837 return -1; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
838 } |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
839 priv->framePlaneY = priv->width * priv->height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
840 priv->framePlaneUV = (priv->width * priv->height) >> 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
841 priv->framePlaneYUY = priv->width * priv->height * 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
842 priv->stridePlaneY = priv->width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
843 priv->stridePlaneUV = priv->width/2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
844 priv->stridePlaneYUY = priv->width * 2; |
1 | 845 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
846 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
847 if(priv->mode != YUV) { |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
848 if(!priv->rgbsurface) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
849 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_CouldntCreateARGBSurface, SDL_GetError()); |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
850 return -1; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
851 } |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
852 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
853 priv->dblit = 0; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
854 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
855 if((priv->format&0xFF) != priv->bpp) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
856 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_UsingDepthColorspaceConversion, priv->format&0xFF, priv->bpp); |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
857 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
858 priv->framePlaneRGB = priv->width * priv->height * priv->rgbsurface->format->BytesPerPixel; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
859 priv->stridePlaneRGB = priv->width * priv->rgbsurface->format->BytesPerPixel; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
860 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
861 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
862 erase_rectangle(0, 0, surfwidth, surfheight); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
863 |
1 | 864 return 0; |
865 } | |
866 | |
867 | |
868 /** | |
869 * Draw a frame to the SDL YUV overlay. | |
870 * | |
871 * params : *src[] == the Y, U, and V planes that make up the frame. | |
872 * returns : non-zero on success, zero on error. | |
873 **/ | |
874 | |
875 //static int sdl_draw_frame (frame_t *frame) | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
876 static int draw_frame(uint8_t *src[]) |
1 | 877 { |
878 struct sdl_priv_s *priv = &sdl_priv; | |
879 uint8_t *dst; | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
880 int i; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
881 uint8_t *mysrc = src[0]; |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
882 |
5313 | 883 switch(priv->format){ |
1 | 884 case IMGFMT_YUY2: |
408 | 885 case IMGFMT_UYVY: |
886 case IMGFMT_YVYU: | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
887 SDL_OVR_LOCK(-1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
888 dst = (uint8_t *) *(priv->overlay->pixels) + priv->overlay->pitches[0]*priv->y; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
889 if(priv->flip) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
890 mysrc+=priv->framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
891 for(i = 0; i < priv->height; i++) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
892 mysrc-=priv->stridePlaneYUY; |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
893 fast_memcpy (dst, mysrc, priv->stridePlaneYUY); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
894 dst+=priv->overlay->pitches[0]; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
895 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
896 } |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
897 else fast_memcpy (dst, src[0], priv->framePlaneYUY); |
1197 | 898 SDL_OVR_UNLOCK |
1 | 899 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
900 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
901 case IMGFMT_RGB15: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
902 case IMGFMT_BGR15: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
903 case IMGFMT_RGB16: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
904 case IMGFMT_BGR16: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
905 case IMGFMT_RGB24: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
906 case IMGFMT_BGR24: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
907 case IMGFMT_RGB32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
908 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
909 if(priv->dblit) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
910 SDL_SRF_LOCK(priv->surface, -1) |
7692 | 911 dst = (uint8_t *) priv->surface->pixels + priv->y*priv->surface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
912 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
913 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
914 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
915 mysrc-=priv->stridePlaneRGB; |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
916 fast_memcpy (dst, mysrc, priv->stridePlaneRGB); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
917 dst += priv->surface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
918 } |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
919 } |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
920 else fast_memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 921 SDL_SRF_UNLOCK(priv->surface) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
922 } else { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
923 SDL_SRF_LOCK(priv->rgbsurface, -1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
924 dst = (uint8_t *) priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
925 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
926 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
927 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
928 mysrc-=priv->stridePlaneRGB; |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
929 fast_memcpy (dst, mysrc, priv->stridePlaneRGB); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
930 dst += priv->rgbsurface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
931 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
932 } |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22823
diff
changeset
|
933 else fast_memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 934 SDL_SRF_UNLOCK(priv->rgbsurface) |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
935 } |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
936 break; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
937 |
1 | 938 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
939 |
1 | 940 return 0; |
941 } | |
942 | |
943 | |
944 /** | |
945 * Draw a slice (16 rows of image) to the SDL YUV overlay. | |
946 * | |
947 * params : *src[] == the Y, U, and V planes that make up the slice. | |
948 * returns : non-zero on error, zero on success. | |
949 **/ | |
950 | |
951 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num) | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
952 static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
1 | 953 { |
954 struct sdl_priv_s *priv = &sdl_priv; | |
955 uint8_t *dst; | |
956 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
957 SDL_OVR_LOCK(-1) |
1 | 958 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
959 y += priv->y; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
960 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
961 dst = priv->overlay->pixels[0] + priv->overlay->pitches[0]*y + x; |
7692 | 962 memcpy_pic(dst, image[0], w, h, priv->overlay->pitches[0], stride[0]); |
963 x/=2;y/=2;w/=2;h/=2; | |
1 | 964 |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
965 switch(priv->format) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
966 case IMGFMT_YV12: |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
967 dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x; |
7692 | 968 memcpy_pic(dst, image[1], w, h, priv->overlay->pitches[2], stride[1]); |
969 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
970 dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x; |
7692 | 971 memcpy_pic(dst, image[2], w, h, priv->overlay->pitches[1], stride[2]); |
972 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
973 break; |
7692 | 974 case IMGFMT_I420: |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
975 case IMGFMT_IYUV: |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
976 dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x; |
7692 | 977 memcpy_pic(dst, image[1], w, h, priv->overlay->pitches[1], stride[1]); |
1 | 978 |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
979 dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x; |
7692 | 980 memcpy_pic(dst, image[2], w, h, priv->overlay->pitches[2], stride[2]); |
981 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
982 break; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
983 default: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
984 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_UnsupportedImageFormatInDrawslice); |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
985 } |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
986 |
1197 | 987 SDL_OVR_UNLOCK |
1 | 988 |
989 return 0; | |
990 } | |
991 | |
992 | |
993 | |
994 /** | |
995 * Checks for SDL keypress and window resize events | |
996 * | |
997 * params : none | |
998 * returns : doesn't return | |
999 **/ | |
1000 | |
1001 static void check_events (void) | |
1002 { | |
1003 struct sdl_priv_s *priv = &sdl_priv; | |
1004 SDL_Event event; | |
27706 | 1005 SDLKey keypressed = SDLK_UNKNOWN; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1006 |
1 | 1007 /* Poll the waiting SDL Events */ |
1008 while ( SDL_PollEvent(&event) ) { | |
1009 switch (event.type) { | |
1010 | |
1011 /* capture window resize events */ | |
1012 case SDL_VIDEORESIZE: | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1013 if(!priv->dblit) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1014 set_video_mode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags); |
1 | 1015 |
1016 /* save video extents, to restore them after going fullscreen */ | |
1017 //if(!(priv->surface->flags & SDL_FULLSCREEN)) { | |
1018 priv->windowsize.w = priv->surface->w; | |
1019 priv->windowsize.h = priv->surface->h; | |
1020 //} | |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1021 mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Window resize\n"); |
1 | 1022 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1023 |
1 | 1024 /* graphics mode selection shortcuts */ |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1025 case SDL_KEYDOWN: |
1 | 1026 keypressed = event.key.keysym.sym; |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1027 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Key pressed: '%i'\n", keypressed); |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
1028 |
357 | 1029 /* c key pressed. c cycles through available fullscreenmodes, if we have some */ |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
1030 if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) { |
1 | 1031 /* select next fullscreen mode */ |
1032 priv->fullmode++; | |
1033 if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0; | |
1034 set_fullmode(priv->fullmode); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1035 |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1036 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Set next available fullscreen mode.\n"); |
1 | 1037 } |
1038 | |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1039 else if ( keypressed == SDLK_n ) { |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
26739
diff
changeset
|
1040 #ifdef CONFIG_X11 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1041 aspect(&priv->dstwidth, &priv->dstheight,A_NOZOOM); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1042 #endif |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1043 if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1044 set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1045 priv->windowsize.w = priv->surface->w; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1046 priv->windowsize.h = priv->surface->h; |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1047 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Normal size\n"); |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1048 } else |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1049 if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1050 set_video_mode(priv->dstwidth * 2, priv->dstheight * 2, priv->bpp, priv->sdlflags); |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1051 priv->windowsize.w = priv->surface->w; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1052 priv->windowsize.h = priv->surface->h; |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1053 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Double size\n"); |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1054 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1055 } |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1056 |
31032
362425fe3de8
Add sdl_common file and use it to share the input handling between -vo gl
reimar
parents:
31025
diff
changeset
|
1057 else sdl_default_handle_event(&event); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1058 |
1 | 1059 break; |
31032
362425fe3de8
Add sdl_common file and use it to share the input handling between -vo gl
reimar
parents:
31025
diff
changeset
|
1060 default: sdl_default_handle_event(&event); break; |
1 | 1061 } |
1062 } | |
1063 } | |
1064 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1065 /* Erase (paint it black) the rectangle specified by x, y, w and h in the surface |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1066 or overlay which is used for OSD |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1067 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1068 static void erase_rectangle(int x, int y, int w, int h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1069 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1070 struct sdl_priv_s *priv = &sdl_priv; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1071 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1072 switch(priv->format) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1073 case IMGFMT_YV12: |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1074 case IMGFMT_I420: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1075 case IMGFMT_IYUV: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1076 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1077 SDL_OVR_LOCK((void) 0) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1078 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1079 /* Erase Y plane */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1080 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1081 priv->overlay->pitches[0], 0, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1082 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1083 priv->overlay->pitches[0]*y); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1084 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1085 /* Erase U and V planes */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1086 w /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1087 x /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1088 h /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1089 y /= 2; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1090 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1091 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1092 priv->overlay->pitches[1], 128, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1093 priv->overlay->pixels[1] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1094 priv->overlay->pitches[1]*y); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1095 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1096 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1097 priv->overlay->pitches[2], 128, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1098 priv->overlay->pixels[2] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1099 priv->overlay->pitches[2]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1100 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1101 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1102 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1103 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1104 case IMGFMT_YUY2: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1105 case IMGFMT_YVYU: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1106 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1107 /* yuy2 and yvyu represent black the same way */ |
33318 | 1108 uint32_t yuy2_black = HAVE_BIGENDIAN ? 0x00800080 : 0x80008000; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1109 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1110 SDL_OVR_LOCK((void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1111 erase_area_4(x*2, w*2, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1112 priv->overlay->pitches[0], |
33318 | 1113 yuy2_black, |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1114 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1115 priv->overlay->pitches[0]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1116 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1117 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1118 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1119 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1120 case IMGFMT_UYVY: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1121 { |
33318 | 1122 uint32_t uyvy_black = HAVE_BIGENDIAN ? 0x80008000 : 0x00800080; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1123 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1124 SDL_OVR_LOCK((void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1125 erase_area_4(x*2, w*2, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1126 priv->overlay->pitches[0], |
33318 | 1127 uyvy_black, |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1128 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1129 priv->overlay->pitches[0]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1130 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1131 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1132 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1133 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1134 case IMGFMT_RGB15: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1135 case IMGFMT_BGR15: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1136 case IMGFMT_RGB16: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1137 case IMGFMT_BGR16: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1138 case IMGFMT_RGB24: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1139 case IMGFMT_BGR24: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1140 case IMGFMT_RGB32: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1141 case IMGFMT_BGR32: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1142 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1143 SDL_Rect rect; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1144 rect.w = w; rect.h = h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1145 rect.x = x; rect.y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1146 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1147 if(priv->dblit) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1148 SDL_SRF_LOCK(priv->surface, (void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1149 SDL_FillRect(priv->surface, &rect, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1150 SDL_SRF_UNLOCK(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1151 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1152 else { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1153 SDL_SRF_LOCK(priv->rgbsurface, (void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1154 SDL_FillRect(priv->rgbsurface, &rect, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1155 SDL_SRF_UNLOCK(priv->rgbsurface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1156 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1157 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1158 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1159 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1160 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1161 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1162 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1163 { struct sdl_priv_s *priv = &sdl_priv; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1164 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1165 priv->osd_has_changed = vo_osd_changed(0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1166 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1167 if(priv->osd_has_changed) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1168 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1169 int i; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1170 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1171 for(i = 0; i < 2; i++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1172 if(priv->dirty_off_frame[i].x < 0 || priv->dirty_off_frame[i].y < 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1173 continue; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1174 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1175 erase_rectangle(priv->dirty_off_frame[i].x, priv->dirty_off_frame[i].y, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1176 priv->dirty_off_frame[i].w, priv->dirty_off_frame[i].h); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1177 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1178 priv->dirty_off_frame[i].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1179 priv->dirty_off_frame[i].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1180 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1181 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1182 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1183 /* update osd/subtitles */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1184 if(priv->mode == YUV) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1185 vo_draw_text(priv->overlay->w, priv->overlay->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1186 else { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1187 if(priv->dblit) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1188 vo_draw_text(priv->surface->w, priv->surface->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1189 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1190 vo_draw_text(priv->rgbsurface->w, priv->rgbsurface->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1191 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1192 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1193 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1194 /* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch' |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1195 * are given in bytes. 4 bytes at a time. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1196 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1197 static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1198 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1199 int x_end = x_start/4 + width/4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1200 int x, y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1201 uint32_t* data = (uint32_t*) pixels; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1202 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1203 x_start /= 4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1204 pitch /= 4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1205 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1206 for(y = 0; y < height; y++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1207 for(x = x_start; x < x_end; x++) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1208 data[y*pitch + x] = color; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1209 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1210 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1211 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1212 /* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch' |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1213 * are given in bytes. 1 byte at a time. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1214 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1215 static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1216 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1217 int y; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1218 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1219 for(y = 0; y < height; y++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1220 memset(&pixels[y*pitch + x_start], color, width); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1221 } |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1222 } |
1 | 1223 |
1224 /** | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1225 * Display the surface we have written our data to |
1 | 1226 * |
1227 * params : mode == index of the desired fullscreen mode | |
1228 * returns : doesn't return | |
1229 **/ | |
1230 | |
1231 static void flip_page (void) | |
1232 { | |
1233 struct sdl_priv_s *priv = &sdl_priv; | |
1234 | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1235 switch(priv->format) { |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1236 case IMGFMT_RGB15: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1237 case IMGFMT_BGR15: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1238 case IMGFMT_RGB16: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1239 case IMGFMT_BGR16: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1240 case IMGFMT_RGB24: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1241 case IMGFMT_BGR24: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1242 case IMGFMT_RGB32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1243 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
1244 if(!priv->dblit) { |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1245 /* blit to the RGB surface */ |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1246 if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
1247 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_BlitFailed, SDL_GetError()); |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1248 } |
1 | 1249 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1250 /* update screen */ |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1251 //SDL_UpdateRect(priv->surface, 0, 0, priv->surface->clip_rect.w, priv->surface->clip_rect.h); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1252 if(priv->osd_has_changed) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1253 priv->osd_has_changed = 0; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1254 SDL_UpdateRects(priv->surface, 1, &priv->surface->clip_rect); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1255 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1256 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1257 SDL_UpdateRect(priv->surface, 0, priv->y_screen_top, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1258 priv->surface->clip_rect.w, priv->y_screen_bottom); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1259 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1260 /* check if we have a double buffered surface and flip() if we do. */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1261 if ( priv->surface->flags & SDL_DOUBLEBUF ) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1262 SDL_Flip(priv->surface); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1263 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1264 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1265 default: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1266 /* blit to the YUV overlay */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1267 SDL_DisplayYUVOverlay (priv->overlay, &priv->surface->clip_rect); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1268 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1269 /* check if we have a double buffered surface and flip() if we do. */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1270 if ( priv->surface->flags & SDL_DOUBLEBUF ) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1271 SDL_Flip(priv->surface); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1272 |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1273 //SDL_LockYUVOverlay (priv->overlay); // removed because unused!? |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1274 } |
1 | 1275 } |
1276 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
1277 static int |
1 | 1278 query_format(uint32_t format) |
1279 { | |
1280 switch(format){ | |
1281 case IMGFMT_YV12: | |
6440
2997a3faf381
Streamline enter-key behaviour suggested by Christian Ohm and disable I420/IYUV because
atmos4
parents:
5894
diff
changeset
|
1282 // it seems buggy (not hw accelerated), so just use YV12 instead! |
2997a3faf381
Streamline enter-key behaviour suggested by Christian Ohm and disable I420/IYUV because
atmos4
parents:
5894
diff
changeset
|
1283 // case IMGFMT_I420: |
2997a3faf381
Streamline enter-key behaviour suggested by Christian Ohm and disable I420/IYUV because
atmos4
parents:
5894
diff
changeset
|
1284 // case IMGFMT_IYUV: |
1 | 1285 case IMGFMT_YUY2: |
408 | 1286 case IMGFMT_UYVY: |
1287 case IMGFMT_YVYU: | |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1288 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | |
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1289 VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1290 case IMGFMT_RGB15: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1291 case IMGFMT_BGR15: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1292 case IMGFMT_RGB16: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1293 case IMGFMT_BGR16: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1294 case IMGFMT_RGB24: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1295 case IMGFMT_BGR24: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1296 case IMGFMT_RGB32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1297 case IMGFMT_BGR32: |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1298 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_FLIP; |
1 | 1299 } |
1300 return 0; | |
1301 } | |
1302 | |
1303 | |
1304 static void | |
1305 uninit(void) | |
1306 { | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
26739
diff
changeset
|
1307 #ifdef CONFIG_X11 |
12787 | 1308 struct sdl_priv_s *priv = &sdl_priv; |
1309 if(priv->X) { | |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1310 mp_msg(MSGT_VO,MSGL_V, "SDL: activating XScreensaver/DPMS\n"); |
12787 | 1311 vo_x11_uninit(); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1312 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1313 #endif |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1314 sdl_close(); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1315 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1316 /* Cleanup SDL */ |
31037 | 1317 vo_sdl_uninit(); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1318 |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1319 mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Closed Plugin\n"); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1320 |
1 | 1321 } |
4352 | 1322 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
1323 static int preinit(const char *arg) |
4352 | 1324 { |
5240 | 1325 struct sdl_priv_s *priv = &sdl_priv; |
14876 | 1326 char * sdl_driver = NULL; |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1327 int sdl_hwaccel; |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1328 int sdl_forcexv; |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
28307
diff
changeset
|
1329 const opt_t subopts[] = { |
28922
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
1330 {"forcexv", OPT_ARG_BOOL, &sdl_forcexv, NULL}, |
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
1331 {"hwaccel", OPT_ARG_BOOL, &sdl_hwaccel, NULL}, |
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
1332 {"driver", OPT_ARG_MSTRZ, &sdl_driver, NULL}, |
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
1333 {NULL, 0, NULL, NULL} |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1334 }; |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1335 |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1336 sdl_forcexv = 1; |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1337 sdl_hwaccel = 1; |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1338 |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1339 if (subopt_parse(arg, subopts) != 0) return -1; |
5240 | 1340 |
1341 priv->rgbsurface = NULL; | |
1342 priv->overlay = NULL; | |
1343 priv->surface = NULL; | |
1344 | |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1345 mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Opening Plugin\n"); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1346 |
14876 | 1347 if(sdl_driver) { |
1348 setenv("SDL_VIDEODRIVER", sdl_driver, 1); | |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1349 free(sdl_driver); |
14876 | 1350 } |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1351 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1352 /* does the user want SDL to try and force Xv */ |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1353 if(sdl_forcexv) setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1354 else setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "0", 1); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1355 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1356 /* does the user want to disable Xv and use software scaling instead */ |
14857
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1357 if(sdl_hwaccel) setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); |
29a09f111b41
Remove -noxv and -forcexv command line options and replace them by
ivo
parents:
14577
diff
changeset
|
1358 else setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1359 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1360 /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */ |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1361 priv->fullmode = -2; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1362 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1363 priv->fullmodes = NULL; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1364 priv->bpp = 0; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1365 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1366 /* initialize the SDL Video system */ |
31037 | 1367 if (!vo_sdl_init()) { |
18335 | 1368 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_InitializationFailed, SDL_GetError()); |
1369 | |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1370 return -1; |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1371 } |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1372 |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1373 SDL_VideoDriverName(priv->driver, 8); |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17932
diff
changeset
|
1374 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_UsingDriver, priv->driver); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1375 |
8935 | 1376 priv->X = 0; |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
26739
diff
changeset
|
1377 #ifdef CONFIG_X11 |
12787 | 1378 if(vo_init()) { |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1379 mp_msg(MSGT_VO,MSGL_V, "SDL: deactivating XScreensaver/DPMS\n"); |
12787 | 1380 priv->XWidth = vo_screenwidth; |
1381 priv->XHeight = vo_screenheight; | |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1382 priv->X = 1; |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1383 mp_msg(MSGT_VO,MSGL_V, "SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); |
8840
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1384 } |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1385 #endif |
cecb561fcb21
- init & check SDL availability at preinit() (fixes -vo sdl,mga)
arpi
parents:
8246
diff
changeset
|
1386 |
5240 | 1387 return 0; |
4352 | 1388 } |
1389 | |
5058 | 1390 static uint32_t get_image(mp_image_t *mpi) |
1391 { | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1392 struct sdl_priv_s *priv = &sdl_priv; |
5058 | 1393 |
1394 if(priv->format != mpi->imgfmt) return VO_FALSE; | |
1395 if(mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) { | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1396 if(mpi->flags&MP_IMGFLAG_PLANAR) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1397 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1398 mpi->stride[0] = priv->overlay->pitches[0]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1399 if(mpi->flags&MP_IMGFLAG_SWAPPED) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1400 mpi->planes[1] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1401 mpi->stride[1] = priv->overlay->pitches[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1402 mpi->planes[2] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1403 mpi->stride[2] = priv->overlay->pitches[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1404 } else { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1405 mpi->planes[2] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1406 mpi->stride[2] = priv->overlay->pitches[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1407 mpi->planes[1] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1408 mpi->stride[1] = priv->overlay->pitches[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1409 } |
5058 | 1410 } |
1411 else if(IMGFMT_IS_RGB(priv->format) || IMGFMT_IS_BGR(priv->format)) { | |
1412 if(priv->dblit) { | |
1413 if(mpi->type == MP_IMGTYPE_STATIC && (priv->surface->flags & SDL_DOUBLEBUF)) | |
1414 return VO_FALSE; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
1415 |
23619 | 1416 mpi->planes[0] = (uint8_t *)priv->surface->pixels + priv->y*priv->surface->pitch; |
5058 | 1417 mpi->stride[0] = priv->surface->pitch; |
1418 } | |
1419 else { | |
23619 | 1420 mpi->planes[0] = (uint8_t *)priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch; |
5058 | 1421 mpi->stride[0] = priv->rgbsurface->pitch; |
1422 } | |
1423 } | |
1424 else { | |
1425 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; | |
1426 mpi->stride[0] = priv->overlay->pitches[0]; | |
1427 } | |
1428 | |
1429 mpi->flags|=MP_IMGFLAG_DIRECT; | |
1430 return VO_TRUE; | |
1431 } | |
1432 | |
1433 return VO_FALSE; | |
1434 } | |
1435 | |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
32467
diff
changeset
|
1436 static int control(uint32_t request, void *data) |
4352 | 1437 { |
4772 | 1438 struct sdl_priv_s *priv = &sdl_priv; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1439 switch (request) { |
5058 | 1440 case VOCTRL_GET_IMAGE: |
1441 return get_image(data); | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1442 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1443 return query_format(*((uint32_t*)data)); |
4772 | 1444 case VOCTRL_FULLSCREEN: |
1445 if (priv->surface->flags & SDL_FULLSCREEN) { | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1446 set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); |
4772 | 1447 SDL_ShowCursor(1); |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1448 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Windowed mode\n"); |
4772 | 1449 } else if (priv->fullmodes) { |
1450 set_fullmode(priv->fullmode); | |
28021
1bbc09f93acb
Remove a lot of completely pointless mp_msg_test calls.
reimar
parents:
27706
diff
changeset
|
1451 mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Set fullscreen mode\n"); |
4772 | 1452 } |
4790 | 1453 return VO_TRUE; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1454 } |
4772 | 1455 |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1456 return VO_NOTIMPL; |
4352 | 1457 } |