Mercurial > mplayer.hg
annotate libvo/vo_sdl.c @ 4576:ccc0fd9ff352
better naming
author | arpi |
---|---|
date | Thu, 07 Feb 2002 20:22:56 +0000 |
parents | 22a4c7957f03 |
children | 3a76a4dcde2c |
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 * |
6 * Copyright (C) Ryan C. Gordon <icculus@lokigames.com> - April 22, 2000. | |
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/), | |
580 | 16 * to be used with MPlayer [The Movie Player for Linux] project, further info |
579 | 17 * from http://mplayer.sourceforge.net. |
18 * | |
19 * Current license is not decided yet, but we're heading for GPL. | |
20 * | |
21 * -- old disclaimer -- | |
22 * | |
1 | 23 * A mpeg2dec display driver that does output through the |
24 * Simple DirectMedia Layer (SDL) library. This effectively gives us all | |
25 * sorts of output options: X11, SVGAlib, fbcon, AAlib, GGI. Win32, MacOS | |
26 * and BeOS support, too. Yay. SDL info, source, and binaries can be found | |
27 * at http://slouken.devolution.com/SDL/ | |
28 * | |
29 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
30 * | |
31 * mpeg2dec is free software; you can redistribute it and/or modify | |
32 * it under the terms of the GNU General Public License as published by | |
33 * the Free Software Foundation; either version 2, or (at your option) | |
34 * any later version. | |
35 * | |
36 * mpeg2dec is distributed in the hope that it will be useful, | |
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
39 * GNU General Public License for more details. | |
40 * | |
41 * You should have received a copy of the GNU General Public License | |
42 * along with GNU Make; see the file COPYING. If not, write to | |
579 | 43 * the Free Software Foundation. |
44 * | |
45 * -- end old disclaimer -- | |
1 | 46 * |
47 * Changes: | |
48 * Dominik Schnitzer <dominik@schnitzer.at> - November 08, 2000. | |
84 | 49 * - Added resizing support, fullscreen: changed the sdlmodes selection |
1 | 50 * routine. |
51 * - SDL bugfixes: removed the atexit(SLD_Quit), SDL_Quit now resides in | |
52 * the plugin_exit routine. | |
53 * - Commented the source :) | |
54 * - Shortcuts: for switching between Fullscreen/Windowed mode and for | |
55 * cycling between the different Fullscreen modes. | |
56 * - Small bugfixes: proper width/height of movie | |
57 * Dominik Schnitzer <dominik@schnitzer.at> - November 11, 2000. | |
58 * - Cleanup code, more comments | |
59 * - Better error handling | |
60 * Bruno Barreyra <barreyra@ufl.edu> - December 10, 2000. | |
61 * - Eliminated memcpy's for entire frames | |
579 | 62 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 11, 2001 |
84 | 63 * - Added aspect-ratio awareness for fullscreen |
579 | 64 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 11, 2001 |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
65 * - Fixed aspect-ratio awareness, did only vertical scaling (black bars above |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
66 * and below), now also does horizontal scaling (black bars left and right), |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
67 * so you get the biggest possible picture with correct aspect-ratio. |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
68 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 12, 2001 |
579 | 69 * - Minor bugfix to aspect-ratio for non-4:3-resolutions (like 1280x1024) |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
70 * - Bugfix to check_events() to reveal mouse cursor after 'q'-quit in |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
71 * fullscreen-mode |
351 | 72 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 10, 2001 |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
73 * - Changed keypress-detection from keydown to keyup, seems to fix keyrepeat |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
74 * bug (key had to be pressed twice to be detected) |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
75 * - Changed key-handling: 'f' cycles fullscreen/windowed, ESC/RETURN/'q' quits |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
76 * - Bugfix which avoids exit, because return is passed to sdl-output on startup, |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
77 * which caused the player to exit (keyboard-buffer problem? better solution |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
78 * recommed) |
351 | 79 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 11, 2001 |
80 * - OSD and subtitle support added | |
81 * - some minor code-changes | |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
82 * - added code to comply with new fullscreen meaning |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
83 * - changed fullscreen-mode-cycling from '+' to 'c' (interferred with audiosync |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
84 * adjustment) |
386 | 85 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 13, 2001 |
86 * - added keymapping to toggle OSD ('o' key) | |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
87 * - added some defines to modify some sdl-out internas (see comments) |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
88 * |
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
89 * Felix Buenemann: further changes will be visible through cvs log, don't want |
579 | 90 * to update this all the time (CVS info on http://mplayer.sourceforge.net) |
91 * | |
1 | 92 */ |
93 | |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
94 /* 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
|
95 #undef SDL_NOHWSURFACE |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
96 |
1197 | 97 /* define to enable surface locks, this might be needed on SMP machines */ |
98 #undef SDL_ENABLE_LOCKS | |
99 | |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
100 //#define BUGGY_SDL //defined by configure |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
101 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
102 /* MONITOR_ASPECT MUST BE FLOAT */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
103 #define MONITOR_ASPECT 4.0/3.0 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
104 |
1 | 105 #include <stdio.h> |
106 #include <stdlib.h> | |
107 #include <string.h> | |
108 #include <inttypes.h> | |
109 | |
1100
7829676dc4ef
Ooops, wrong path to config.h - now you may enjoy code that was never before used =)
atmosfear
parents:
1080
diff
changeset
|
110 #include "../config.h" |
1 | 111 #include "video_out.h" |
112 #include "video_out_internal.h" | |
113 | |
354 | 114 #include "fastmemcpy.h" |
616 | 115 #include "sub.h" |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
116 #include "aspect.h" |
350 | 117 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
118 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
119 #include <X11/Xlib.h> |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
120 #include "x11_common.h" |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
121 #endif |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
122 |
1 | 123 LIBVO_EXTERN(sdl) |
124 | |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
125 extern int verbose; |
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
|
126 int sdl_noxv; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
127 int sdl_forcexv; |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
128 |
1 | 129 static vo_info_t vo_info = |
130 { | |
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
|
131 "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)", |
1 | 132 "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
|
133 "Ryan C. Gordon <icculus@lokigames.com>, Felix Buenemann <atmosfear@users.sourceforge.net>", |
1 | 134 "" |
135 }; | |
136 | |
1238 | 137 #include <SDL.h> |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
138 //#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
|
139 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
140 #if defined(sun) && defined(__svr4__) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
141 /* setenv is missing on solaris */ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
142 static void setenv(const char *name, const char *val, int _xx) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
143 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
144 int len = strlen(name) + strlen(val) + 2; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
145 char *env = malloc(len); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
146 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
147 if (env != NULL) { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
148 strcpy(env, name); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
149 strcat(env, "="); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
150 strcat(env, val); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
151 putenv(env); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
152 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
153 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
154 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
155 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
156 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
157 #define FS 0x01 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
158 #define VM 0x02 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
159 #define ZOOM 0x04 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
160 #define FLIP 0x08 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
161 |
1 | 162 /** Private SDL Data structure **/ |
163 | |
164 static struct sdl_priv_s { | |
165 | |
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
|
166 /* 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
|
167 char driver[8]; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
168 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
169 /* SDL display surface */ |
1 | 170 SDL_Surface *surface; |
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
|
171 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
172 /* 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
|
173 SDL_Surface *rgbsurface; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
174 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
175 /* SDL YUV overlay */ |
1 | 176 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
|
177 |
1 | 178 /* available fullscreen modes */ |
179 SDL_Rect **fullmodes; | |
180 | |
181 /* surface attributes for fullscreen and windowed mode */ | |
182 Uint32 sdlflags, sdlfullflags; | |
183 | |
184 /* save the windowed output extents */ | |
185 SDL_Rect windowsize; | |
186 | |
187 /* Bits per Pixel */ | |
188 Uint8 bpp; | |
189 | |
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
|
190 /* 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
|
191 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
|
192 #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
|
193 #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
|
194 #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
|
195 |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
196 /* use direct blitting to surface */ |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
197 int dblit; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
198 |
1 | 199 /* current fullscreen mode, 0 = highest available fullscreen mode */ |
200 int fullmode; | |
201 | |
202 /* YUV ints */ | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
203 int framePlaneY, framePlaneUV, framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
204 int stridePlaneY, stridePlaneUV, stridePlaneYUY; |
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
|
205 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
206 /* 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
|
207 int framePlaneRGB; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
208 int stridePlaneRGB; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
209 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
210 /* Flip image */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
211 int flip; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
212 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
213 /* fullscreen behaviour; see init */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
214 int fulltype; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
215 |
951 | 216 /* is X running (0/1) */ |
217 int X; | |
218 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
219 #ifdef HAVE_X11 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
220 /* X11 Resolution */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
221 int XWidth, XHeight; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
222 #endif |
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
|
223 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
224 /* original image dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
225 int width, height; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
226 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
227 /* destination dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
228 int dstwidth, dstheight; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
229 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
230 /* source image format (YUV/RGB/...) */ |
1 | 231 int format; |
232 } sdl_priv; | |
233 | |
234 | |
351 | 235 /** libvo Plugin functions **/ |
236 | |
237 /** | |
238 * draw_alpha is used for osd and subtitle display. | |
239 * | |
240 **/ | |
241 | |
242 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
408 | 243 struct sdl_priv_s *priv = &sdl_priv; |
351 | 244 |
408 | 245 switch(priv->format) { |
246 case IMGFMT_YV12: | |
247 case IMGFMT_I420: | |
248 case IMGFMT_IYUV: | |
249 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->width*y0+x0,priv->width); | |
250 break; | |
251 case IMGFMT_YUY2: | |
252 case IMGFMT_YVYU: | |
253 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0),2*priv->width); | |
254 break; | |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
255 case IMGFMT_UYVY: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
256 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0)+1,2*priv->width); |
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
|
257 break; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
258 default: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
259 if(priv->dblit) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
260 switch(priv->format) { |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
261 case IMGFMT_RGB15: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
262 case IMGFMT_BGR15: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
263 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width); |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
264 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
265 case IMGFMT_RGB16: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
266 case IMGFMT_BGR16: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
267 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width); |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
268 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
269 case IMGFMT_RGB24: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
270 case IMGFMT_BGR24: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
271 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+3*(y0*priv->width+x0),3*priv->width); |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
272 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
273 case IMGFMT_RGB32: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
274 case IMGFMT_BGR32: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
275 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+4*(y0*priv->width+x0),4*priv->width); |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
276 break; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
277 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
278 else |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+2*(y0*priv->width+x0),2*priv->width); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+2*(y0*priv->width+x0),2*priv->width); |
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; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
288 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
|
289 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
|
290 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+3*(y0*priv->width+x0),3*priv->width); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
291 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
|
292 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
|
293 case IMGFMT_BGR32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
294 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+4*(y0*priv->width+x0),4*priv->width); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
295 break; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
296 } |
408 | 297 } |
351 | 298 } |
1 | 299 |
300 | |
301 /** | |
302 * Take a null-terminated array of pointers, and find the last element. | |
303 * | |
304 * params : array == array of which we want to find the last element. | |
305 * returns : index of last NON-NULL element. | |
306 **/ | |
307 | |
308 static inline int findArrayEnd (SDL_Rect **array) | |
309 { | |
310 int i = 0; | |
311 while ( array[i++] ); /* keep loopin' ... */ | |
312 | |
313 /* return the index of the last array element */ | |
314 return i - 1; | |
315 } | |
316 | |
317 | |
318 /** | |
319 * Open and prepare SDL output. | |
320 * | |
321 * params : *plugin == | |
322 * *name == | |
323 * returns : 0 on success, -1 on failure | |
324 **/ | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
325 |
1 | 326 static int sdl_open (void *plugin, void *name) |
327 { | |
328 struct sdl_priv_s *priv = &sdl_priv; | |
329 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
|
330 /*static int opened = 0; |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
331 |
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
|
332 if (opened) |
1 | 333 return 0; |
4528
bd2324553533
Fix multifile playback (sdl was not fully reinitialized).
atmos4
parents:
4433
diff
changeset
|
334 opened = 1;*/ |
1 | 335 |
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
|
336 if(verbose > 2) printf("SDL: Opening Plugin\n"); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
337 |
1188 | 338 if(vo_subdevice) setenv("SDL_VIDEODRIVER", vo_subdevice, 1); |
351 | 339 |
340 /* does the user want SDL to try and force Xv */ | |
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
|
341 if(sdl_forcexv) setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 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
|
342 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
343 /* does the user want to disable Xv and use software scaling instead */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
344 if(sdl_noxv) setenv("SDL_VIDEO_YUV_HWACCEL", "0", 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
|
345 |
1 | 346 |
84 | 347 /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */ |
1 | 348 priv->fullmode = -2; |
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
|
349 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
350 priv->surface = NULL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
351 priv->rgbsurface = NULL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
352 priv->overlay = NULL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
353 priv->fullmodes = NULL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
354 priv->bpp = 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
|
355 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
356 /* initialize the SDL Video system */ |
4342
4395c96c64cd
Let mplayer handle signals so terminal gets cleaned up.
atmos4
parents:
3609
diff
changeset
|
357 if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) { |
1080 | 358 printf("SDL: Initializing of SDL failed: %s.\n", 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
|
359 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
|
360 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
361 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
362 SDL_VideoDriverName(priv->driver, 8); |
1080 | 363 printf("SDL: Using driver: %s\n", priv->driver); |
1 | 364 /* other default values */ |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
365 #ifdef SDL_NOHWSURFACE |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
366 if(verbose) printf("SDL: using software-surface\n"); |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
367 priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_ANYFORMAT; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
368 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_ANYFORMAT; |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
369 #else |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
370 /*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) { |
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
|
371 if(verbose) printf("SDL: using software-surface\n"); |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
372 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
|
373 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
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
|
374 } |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
375 else { */ |
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
|
376 if(verbose) printf("SDL: using hardware-surface\n"); |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
377 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
378 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
379 //} |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
380 #endif |
1 | 381 |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
382 /* Setup Keyrepeats (500/30 are defaults) */ |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
383 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); |
1 | 384 |
385 /* get information about the graphics adapter */ | |
386 vidInfo = SDL_GetVideoInfo (); | |
387 | |
388 /* collect all fullscreen & hardware modes available */ | |
389 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { | |
390 | |
391 /* non hardware accelerated fullscreen modes */ | |
392 priv->sdlfullflags &= ~SDL_HWSURFACE; | |
393 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); | |
394 } | |
395 | |
396 /* test for normal resizeable & windowed hardware accellerated surfaces */ | |
397 if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) { | |
398 | |
399 /* test for NON hardware accelerated resizeable surfaces - poor you. | |
400 * That's all we have. If this fails there's nothing left. | |
401 * Theoretically there could be Fullscreenmodes left - we ignore this for now. | |
402 */ | |
403 priv->sdlflags &= ~SDL_HWSURFACE; | |
404 if ((!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) && (!priv->fullmodes)) { | |
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
|
405 printf("SDL: Couldn't get any acceptable SDL Mode for output.\n"); |
1 | 406 return -1; |
407 } | |
408 } | |
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
|
409 |
1 | 410 |
411 /* YUV overlays need at least 16-bit color depth, but the | |
412 * display might less. The SDL AAlib target says it can only do | |
413 * 8-bits, for example. So, if the display is less than 16-bits, | |
414 * 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
|
415 */ |
1 | 416 priv->bpp = vidInfo->vfmt->BitsPerPixel; |
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
|
417 if (!priv->mode && priv->bpp < 16) { |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
418 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
419 if(verbose) printf("SDL: Your SDL display target wants to be at a color depth of (%d), but we need it to be at\ |
1 | 420 least 16 bits, so we need to emulate 16-bit color. This is going to slow things down; you might want to\ |
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
|
421 increase your display's color depth, if possible.\n", priv->bpp); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
422 |
1 | 423 priv->bpp = 16; |
424 } | |
425 | |
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
|
426 /* We don't want those in our event queue. |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
427 * We use SDL_KEYUP cause SDL_KEYDOWN seems to cause problems |
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 * with keys need to be pressed twice, to be recognized. |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
429 */ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
430 #ifndef BUGGY_SDL |
770
0e549c933515
Got rid of aalib crashing workaround with SDL1.2.1+
atmosfear
parents:
705
diff
changeset
|
431 SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); |
1 | 432 SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); |
433 SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE); | |
434 SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE); | |
1710 | 435 // SDL_EventState(SDL_QUIT, SDL_IGNORE); |
1 | 436 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); |
770
0e549c933515
Got rid of aalib crashing workaround with SDL1.2.1+
atmosfear
parents:
705
diff
changeset
|
437 SDL_EventState(SDL_USEREVENT, SDL_IGNORE); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
438 #endif |
1 | 439 |
440 /* Success! */ | |
441 return 0; | |
442 } | |
443 | |
444 | |
445 /** | |
446 * Close SDL, Cleanups, Free Memory | |
447 * | |
448 * params : *plugin | |
449 * returns : non-zero on success, zero on error. | |
450 **/ | |
451 | |
452 static int sdl_close (void) | |
453 { | |
454 struct sdl_priv_s *priv = &sdl_priv; | |
455 | |
456 /* Cleanup YUV Overlay structure */ | |
457 if (priv->overlay) | |
458 SDL_FreeYUVOverlay(priv->overlay); | |
459 | |
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
|
460 /* Free 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
|
461 if (priv->rgbsurface) |
1126 | 462 SDL_FreeSurface(priv->rgbsurface); |
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
|
463 |
1 | 464 /* Free our blitting surface */ |
465 if (priv->surface) | |
466 SDL_FreeSurface(priv->surface); | |
467 | |
351 | 468 /* DONT attempt to free the fullscreen modes array. SDL_Quit* does this for us */ |
1 | 469 |
470 /* Cleanup SDL */ | |
973 | 471 //SDL_Quit(); |
472 SDL_QuitSubSystem(SDL_INIT_VIDEO); | |
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
|
473 /* might have to be changed to quitsubsystem only, if plugins become |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
474 * changeable on the fly */ |
351 | 475 |
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
|
476 if(verbose > 2) printf("SDL: Closed Plugin\n"); |
1 | 477 |
478 return 0; | |
479 } | |
480 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
481 /** |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
482 * Do aspect ratio calculations |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
483 * |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
484 * params : srcw == sourcewidth |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
485 * srch == sourceheight |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
486 * dstw == destinationwidth |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
487 * dsth == destinationheight |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
488 * |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
489 * returns : SDL_Rect structure with new x and y, w and h |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
490 **/ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
491 |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
492 #if 0 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
493 static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
494 SDL_Rect newres; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
495 if(verbose > 1) printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
496 newres.h = ((float)dstw / (float)srcw * (float)srch) * ((float)dsth/((float)dstw/(MONITOR_ASPECT))); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
497 if(newres.h > dsth) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
498 newres.w = ((float)dsth / (float)newres.h) * dstw; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
499 newres.h = dsth; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
500 newres.x = (dstw - newres.w) / 2; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
501 newres.y = 0; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
502 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
503 else { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
504 newres.w = dstw; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
505 newres.x = 0; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
506 newres.y = (dsth - newres.h) / 2; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
507 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
508 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
509 if(verbose) printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
510 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
511 return newres; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
512 } |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
513 #endif |
1 | 514 |
515 /** | |
516 * Sets the specified fullscreen mode. | |
517 * | |
518 * params : mode == index of the desired fullscreen mode | |
519 * returns : doesn't return | |
520 **/ | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
521 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
522 #if 0 |
1 | 523 static void set_fullmode (int mode) |
524 { | |
525 struct sdl_priv_s *priv = &sdl_priv; | |
526 SDL_Surface *newsurface = NULL; | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
527 int haspect, waspect = 0; |
1 | 528 |
529 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */ | |
530 if (mode < 0) | |
531 mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1; | |
532 | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
533 /* Calculate proper aspect ratio for fullscreen |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
534 * Height smaller than expected: add horizontal black bars (haspect)*/ |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
535 haspect = (priv->width * (float) ((float) priv->fullmodes[mode]->h / (float) priv->fullmodes[mode]->w) - priv->height) * (float) ((float) priv->fullmodes[mode]->w / (float) priv->width); |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
536 /* Height bigger than expected: add vertical black bars (waspect)*/ |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
537 if (haspect < 0) { |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
538 haspect = 0; /* set haspect to zero because image will be scaled horizontal instead of vertical */ |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
539 waspect = priv->fullmodes[mode]->w - ((float) ((float) priv->fullmodes[mode]->h / (float) priv->height) * (float) priv->width); |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
540 } |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
541 // printf ("W-Aspect: %i H-Aspect: %i\n", waspect, haspect); |
84 | 542 |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
543 /* change to given fullscreen mode and hide the mouse cursor */ |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
544 newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w - waspect, priv->fullmodes[mode]->h - haspect, priv->bpp, priv->sdlfullflags); |
1 | 545 |
546 /* if we were successfull hide the mouse cursor and save the mode */ | |
547 if (newsurface) { | |
1126 | 548 if (priv->surface) |
549 SDL_FreeSurface(priv->surface); | |
1 | 550 priv->surface = newsurface; |
551 SDL_ShowCursor(0); | |
552 } | |
553 } | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
554 #endif |
1 | 555 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
556 static void set_fullmode (int mode) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
557 struct sdl_priv_s *priv = &sdl_priv; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
558 SDL_Surface *newsurface = NULL; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
559 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
560 /* 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
|
561 /* But select a mode where the full video enter */ |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
562 if (mode < 0) { |
4528
bd2324553533
Fix multifile playback (sdl was not fully reinitialized).
atmos4
parents:
4433
diff
changeset
|
563 int i = 0; |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
564 mode = 0; // Default to the biggest mode avaible |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
565 for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) { |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
566 if( (priv->fullmodes[i]->w >= priv->width) && |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
567 (priv->fullmodes[i]->h >= priv->height) ) { |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
568 mode = i; |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
569 break; |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
570 } |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
571 } |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
572 priv->fullmode = mode; |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
573 } |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
574 |
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
|
575 aspect_save_screenres(priv->fullmodes[mode]->w, priv->fullmodes[mode]->h); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
576 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
577 /* calculate new video size/aspect */ |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
578 if(!priv->mode) { |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
579 if(priv->fulltype&FS) { |
2182 | 580 #ifdef HAVE_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
|
581 aspect_save_screenres(priv->XWidth, priv->XHeight); |
2182 | 582 #endif |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
583 } |
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
|
584 aspect(&priv->dstwidth, &priv->dstheight, A_ZOOM); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
585 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
586 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
587 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
588 /* try to change to given fullscreenmode */ |
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
|
589 newsurface = SDL_SetVideoMode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlfullflags); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
590 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
591 /* if creation of new surface was successfull, save it and hide mouse cursor */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
592 if(newsurface) { |
1126 | 593 if (priv->surface) |
594 SDL_FreeSurface(priv->surface); | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
595 priv->surface = newsurface; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
596 SDL_ShowCursor(0); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
597 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
598 } |
1126 | 599 |
1 | 600 |
601 /** | |
602 * Initialize an SDL surface and an SDL YUV overlay. | |
603 * | |
604 * params : width == width of video we'll be displaying. | |
605 * height == height of video we'll be displaying. | |
606 * fullscreen == want to be fullscreen? | |
607 * title == Title for window titlebar. | |
608 * returns : non-zero on success, zero on error. | |
609 **/ | |
610 | |
611 static uint32_t | |
4433 | 612 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) |
1 | 613 //static int sdl_setup (int width, int height) |
614 { | |
615 struct sdl_priv_s *priv = &sdl_priv; | |
357 | 616 unsigned int sdl_format; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
617 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
618 static Display *XDisplay; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
619 static int XScreen; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
620 #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
|
621 aspect_save_orig(width,height); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
622 aspect_save_prescale(d_width,d_height); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
623 |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
624 sdl_format = format; |
1 | 625 switch(format){ |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
626 case IMGFMT_YV12: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
627 if(verbose) printf("SDL: Using 0x%X (YV12) image format\n", format); break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
628 case IMGFMT_IYUV: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
629 if(verbose) printf("SDL: Using 0x%X (IYUV) image format\n", format); break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
630 case IMGFMT_YUY2: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
631 if(verbose) printf("SDL: Using 0x%X (YUY2) image format\n", format); break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
632 case IMGFMT_UYVY: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
633 if(verbose) printf("SDL: Using 0x%X (UYVY) image format\n", format); break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
634 case IMGFMT_YVYU: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
635 if(verbose) printf("SDL: Using 0x%X (YVYU) image format\n", format); break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
636 case IMGFMT_I420: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
637 if(verbose) printf("SDL: Using 0x%X (I420) image format\n", format); |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
638 printf("SDL: Mapping I420 to IYUV\n"); |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
639 sdl_format = SDL_IYUV_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
|
640 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
|
641 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
|
642 if(verbose) printf("SDL: Using 0x%X (BGR15) image format\n", 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
|
643 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
|
644 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
|
645 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
|
646 if(verbose) printf("SDL: Using 0x%X (RGB15) image format\n", 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
|
647 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
|
648 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
|
649 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
|
650 if(verbose) printf("SDL: Using 0x%X (BGR16) image format\n", 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
|
651 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
|
652 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
|
653 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
|
654 if(verbose) printf("SDL: Using 0x%X (RGB16) image format\n", 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
|
655 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
|
656 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
|
657 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
|
658 if(verbose) printf("SDL: Using 0x%X (BGR24) image format\n", 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
|
659 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
|
660 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
|
661 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
|
662 if(verbose) printf("SDL: Using 0x%X (RGB24) image format\n", 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
|
663 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
|
664 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
|
665 case IMGFMT_BGR32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
666 if(verbose) printf("SDL: Using 0x%X (BGR32) image format\n", 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
|
667 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
|
668 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
|
669 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
|
670 if(verbose) printf("SDL: Using 0x%X (RGB32) image format\n", 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
|
671 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
|
672 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
673 default: |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
674 printf("SDL: Unsupported image format (0x%X)\n",format); |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
675 return -1; |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
676 } |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
677 if(priv->mode) { |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
678 priv->sdlflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
679 priv->sdlfullflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
680 } |
1 | 681 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
682 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
683 if(getenv("DISPLAY")) { |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
684 if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
685 XDisplay = XOpenDisplay(getenv("DISPLAY")); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
686 XScreen = DefaultScreen(XDisplay); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
687 priv->XWidth = DisplayWidth(XDisplay, XScreen); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
688 priv->XHeight = DisplayHeight(XDisplay, XScreen); |
951 | 689 priv->X = 1; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
690 if(verbose) printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
691 saver_off(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
692 XCloseDisplay(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
693 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
694 #endif |
1080 | 695 if (sdl_open(NULL, NULL) != 0) |
696 return -1; | |
1 | 697 |
351 | 698 /* Set output window title */ |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
699 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
|
700 //SDL_WM_SetCaption (title, title); |
351 | 701 |
1 | 702 /* Save the original Image size */ |
84 | 703 |
648
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
704 priv->width = width; |
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
705 priv->height = height; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
706 priv->dstwidth = d_width ? d_width : width; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
707 priv->dstheight = d_height ? d_height : height; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
708 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
709 /*priv->width = res.w; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
710 priv->height = res.h;*/ |
1 | 711 priv->format = format; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
712 #ifdef HAVE_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
|
713 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
|
714 aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
715 #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
|
716 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
|
717 priv->windowsize.h = priv->dstheight; |
1 | 718 |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
719 /* bit 0 (0x01) means fullscreen (-fs) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
720 * bit 1 (0x02) means mode switching (-vm) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
721 * bit 2 (0x04) enables software scaling (-zoom) |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
722 * bit 3 (0x08) enables flipping (-flip) |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
723 */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
724 // printf("SDL: flags are set to: %i\n", flags); |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
725 // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
726 if(flags&FLIP) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
727 if(verbose) printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
728 priv->flip = 1; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
729 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
730 if(flags&FS) { |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
731 if(verbose) printf("SDL: setting zoomed fullscreen without modeswitching\n"); |
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
|
732 printf("SDL: Info - please use -vm or -zoom to switch to best resolution.\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
733 priv->fulltype = FS; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
734 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
735 /*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
|
736 SDL_ShowCursor(0);*/ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
737 } else |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
738 if(flags&VM) { |
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
|
739 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
740 priv->fulltype = VM; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
741 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
742 /*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
|
743 SDL_ShowCursor(0);*/ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
744 } else |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
745 if(flags&ZOOM) { |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
746 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
747 priv->fulltype = ZOOM; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
748 set_fullmode(priv->fullmode); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
749 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
750 else { |
951 | 751 if((strcmp(priv->driver, "x11") == 0) || ((strcmp(priv->driver, "aalib") == 0) && priv->X)) { |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
752 if(verbose) printf("SDL: setting windowed mode\n"); |
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
|
753 priv->surface = SDL_SetVideoMode (priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
754 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
755 else { |
951 | 756 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
757 priv->fulltype = ZOOM; | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
758 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
759 } |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
760 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
761 |
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
|
762 if(!priv->surface) { // cannot SetVideoMode |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
763 printf("SDL: failed to set video mode: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
764 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
|
765 } |
1 | 766 |
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
|
767 switch(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
|
768 /* Initialize and create the RGB Surface used for video out in BGR/RGB 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
|
769 //SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
770 // 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
|
771 // 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
|
772 // 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
|
773 // 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
|
774 // 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
|
775 // 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
|
776 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
|
777 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 15, 31, 992, 31744, 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
|
778 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
779 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
|
780 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
781 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
|
782 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
|
783 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 15, 31744, 992, 31, 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
|
784 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
785 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
|
786 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
787 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
|
788 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
|
789 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 16, 31, 2016, 63488, 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
|
790 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
791 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
|
792 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
793 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
|
794 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
|
795 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 16, 63488, 2016, 31, 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
|
796 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
797 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
|
798 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
799 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
|
800 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
|
801 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 24, 0x0000FF, 0x00FF00, 0xFF0000, 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
|
802 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
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 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
|
804 } |
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 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
|
806 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
|
807 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 24, 0xFF0000, 0x00FF00, 0x0000FF, 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
|
808 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
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 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
|
810 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
811 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
|
812 case IMGFMT_RGB32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
813 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0/*0xFF000000*/))) { |
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
|
814 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
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 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
|
816 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
817 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
|
818 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
819 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/))) { |
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
|
820 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
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 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
|
822 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
823 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
|
824 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
|
825 /* Initialize and create the YUV Overlay used for video out */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
826 if (!(priv->overlay = SDL_CreateYUVOverlay (width, height, sdl_format, 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
|
827 printf ("SDL: Couldn't create a YUV overlay: %s\n", SDL_GetError()); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
828 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
|
829 } |
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 priv->framePlaneY = width * height; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
831 priv->framePlaneUV = (width * height) >> 2; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
832 priv->framePlaneYUY = width * height * 2; |
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 priv->stridePlaneY = width; |
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 priv->stridePlaneUV = width/2; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
835 priv->stridePlaneYUY = width * 2; |
1 | 836 } |
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 |
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 if(priv->mode) { |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
839 if((priv->format&0xFF) != priv->bpp) { priv->dblit = 0; printf("SDL: using depth/colorspace conversion, this will slow things down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp); } |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
840 else if(strcmp(priv->driver, "x11") == 0) priv->dblit = 1; |
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
|
841 priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
842 priv->stridePlaneRGB = width * priv->rgbsurface->format->BytesPerPixel; |
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
|
843 } |
1 | 844 return 0; |
845 } | |
846 | |
1197 | 847 #ifdef SDL_ENABLE_LOCKS |
848 #define SDL_OVR_LOCK if (SDL_LockYUVOverlay (priv->overlay)) { \ | |
849 if(verbose) printf("SDL: Couldn't lock YUV overlay\n"); \ | |
850 return -1; \ | |
851 } | |
852 #define SDL_OVR_UNLOCK SDL_UnlockYUVOverlay (priv->overlay); | |
853 | |
854 #define SDL_SRF_LOCK(srf) if(SDL_MUSTLOCK(srf)) { \ | |
855 if(SDL_LockSurface (srf)) { \ | |
856 if(verbose) printf("SDL: Couldn't lock RGB surface\n"); \ | |
857 return -1; \ | |
858 } \ | |
859 } | |
860 | |
861 #define SDL_SRF_UNLOCK(srf) if(SDL_MUSTLOCK(srf)) \ | |
862 SDL_UnlockSurface (srf); | |
863 #else | |
864 #define SDL_OVR_LOCK | |
865 #define SDL_OVR_UNLOCK | |
866 #define SDL_SRF_LOCK(srf) | |
867 #define SDL_SRF_UNLOCK(srf) | |
868 #endif | |
1 | 869 |
870 /** | |
871 * Draw a frame to the SDL YUV overlay. | |
872 * | |
873 * params : *src[] == the Y, U, and V planes that make up the frame. | |
874 * returns : non-zero on success, zero on error. | |
875 **/ | |
876 | |
877 //static int sdl_draw_frame (frame_t *frame) | |
878 static uint32_t draw_frame(uint8_t *src[]) | |
879 { | |
880 struct sdl_priv_s *priv = &sdl_priv; | |
881 uint8_t *dst; | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
882 int i; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
883 uint8_t *mysrc = src[0]; |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
884 |
1 | 885 switch(priv->format){ |
886 case IMGFMT_YV12: | |
408 | 887 case IMGFMT_I420: |
888 case IMGFMT_IYUV: | |
1197 | 889 SDL_OVR_LOCK |
1 | 890 dst = (uint8_t *) *(priv->overlay->pixels); |
891 memcpy (dst, src[0], priv->framePlaneY); | |
892 dst += priv->framePlaneY; | |
893 memcpy (dst, src[2], priv->framePlaneUV); | |
894 dst += priv->framePlaneUV; | |
895 memcpy (dst, src[1], priv->framePlaneUV); | |
1197 | 896 SDL_OVR_UNLOCK |
1 | 897 break; |
408 | 898 |
1 | 899 case IMGFMT_YUY2: |
408 | 900 case IMGFMT_UYVY: |
901 case IMGFMT_YVYU: | |
1197 | 902 SDL_OVR_LOCK |
1 | 903 dst = (uint8_t *) *(priv->overlay->pixels); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
904 if(priv->flip) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
905 mysrc+=priv->framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
906 for(i = 0; i < priv->height; i++) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
907 mysrc-=priv->stridePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
908 memcpy (dst, mysrc, priv->stridePlaneYUY); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
909 dst+=priv->stridePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
910 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
911 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
912 else memcpy (dst, src[0], priv->framePlaneYUY); |
1197 | 913 SDL_OVR_UNLOCK |
1 | 914 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
|
915 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 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
|
920 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
|
921 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
|
922 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
|
923 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
924 if(priv->dblit) { |
1197 | 925 SDL_SRF_LOCK(priv->surface) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
926 dst = (uint8_t *) priv->surface->pixels; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
927 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
928 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
929 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
930 mysrc-=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
931 memcpy (dst, mysrc, priv->stridePlaneRGB); |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
932 dst+=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
933 } |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
934 } |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
935 else memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 936 SDL_SRF_UNLOCK(priv->surface) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
937 } else { |
1197 | 938 SDL_SRF_LOCK(priv->rgbsurface) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
939 dst = (uint8_t *) priv->rgbsurface->pixels; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
940 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
941 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
942 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
943 mysrc-=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
944 memcpy (dst, mysrc, priv->stridePlaneRGB); |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
945 dst+=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
946 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
947 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
948 else memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 949 SDL_SRF_UNLOCK(priv->rgbsurface) |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
950 } |
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
|
951 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
|
952 |
1 | 953 } |
954 | |
955 return 0; | |
956 } | |
957 | |
958 | |
959 /** | |
960 * Draw a slice (16 rows of image) to the SDL YUV overlay. | |
961 * | |
962 * params : *src[] == the Y, U, and V planes that make up the slice. | |
963 * returns : non-zero on error, zero on success. | |
964 **/ | |
965 | |
966 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num) | |
967 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
968 { | |
969 struct sdl_priv_s *priv = &sdl_priv; | |
970 uint8_t *dst; | |
971 uint8_t *src; | |
972 int i; | |
973 | |
1197 | 974 SDL_OVR_LOCK |
1 | 975 |
976 dst = (uint8_t *) *(priv->overlay->pixels) | |
977 + (priv->stridePlaneY * y + x); | |
978 src = image[0]; | |
979 for(i=0;i<h;i++){ | |
980 memcpy(dst,src,w); | |
981 src+=stride[0]; | |
982 dst+=priv->stridePlaneY; | |
983 } | |
984 | |
985 x/=2;y/=2;w/=2;h/=2; | |
986 | |
987 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY | |
988 + (priv->stridePlaneUV * y + x); | |
989 src = image[2]; | |
990 for(i=0;i<h;i++){ | |
991 memcpy(dst,src,w); | |
992 src+=stride[2]; | |
993 dst+=priv->stridePlaneUV; | |
994 } | |
995 | |
996 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY | |
997 + priv->framePlaneUV + (priv->stridePlaneUV * y + x); | |
998 src = image[1]; | |
999 for(i=0;i<h;i++){ | |
1000 memcpy(dst,src,w); | |
1001 src+=stride[1]; | |
1002 dst+=priv->stridePlaneUV; | |
1003 } | |
1004 | |
1197 | 1005 SDL_OVR_UNLOCK |
1 | 1006 |
1007 return 0; | |
1008 } | |
1009 | |
1010 | |
1011 | |
1012 /** | |
1013 * Checks for SDL keypress and window resize events | |
1014 * | |
1015 * params : none | |
1016 * returns : doesn't return | |
1017 **/ | |
1018 | |
1019 #include "../linux/keycodes.h" | |
1020 extern void mplayer_put_key(int code); | |
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
|
1021 |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1022 #define shift_key (event.key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) |
1 | 1023 static void check_events (void) |
1024 { | |
1025 struct sdl_priv_s *priv = &sdl_priv; | |
1026 SDL_Event event; | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1027 SDLKey keypressed = 0; |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1028 static int firstcheck = 0; |
1 | 1029 |
1030 /* Poll the waiting SDL Events */ | |
1031 while ( SDL_PollEvent(&event) ) { | |
1032 switch (event.type) { | |
1033 | |
1034 /* capture window resize events */ | |
1035 case SDL_VIDEORESIZE: | |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
1036 if(!priv->dblit) priv->surface = SDL_SetVideoMode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags); |
1 | 1037 |
1038 /* save video extents, to restore them after going fullscreen */ | |
1039 //if(!(priv->surface->flags & SDL_FULLSCREEN)) { | |
1040 priv->windowsize.w = priv->surface->w; | |
1041 priv->windowsize.h = priv->surface->h; | |
1042 //} | |
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
|
1043 if(verbose > 2) printf("SDL: Window resize\n"); |
1 | 1044 break; |
1045 | |
1046 | |
1047 /* graphics mode selection shortcuts */ | |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1048 #ifdef BUGGY_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
|
1049 case SDL_KEYDOWN: |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1050 switch(event.key.keysym.sym) { |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1051 case SDLK_UP: mplayer_put_key(KEY_UP); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1052 case SDLK_DOWN: mplayer_put_key(KEY_DOWN); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1053 case SDLK_LEFT: mplayer_put_key(KEY_LEFT); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1054 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT); break; |
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
|
1055 case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1056 case SDLK_GREATER: mplayer_put_key('>'); break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1057 case SDLK_ASTERISK: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1058 case SDLK_KP_MULTIPLY: |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1059 case SDLK_w: mplayer_put_key('*'); break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1060 case SDLK_SLASH: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1061 case SDLK_KP_DIVIDE: |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1062 case SDLK_s: mplayer_put_key('/'); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1063 default: break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1064 } |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1065 break; |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1066 case SDL_KEYUP: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1067 #else |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1068 case SDL_KEYDOWN: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1069 #endif |
1 | 1070 keypressed = event.key.keysym.sym; |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1071 if(verbose > 1) printf("SDL: Key pressed: '%i'\n", keypressed); |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
1072 |
357 | 1073 /* 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
|
1074 if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) { |
1 | 1075 /* select next fullscreen mode */ |
1076 priv->fullmode++; | |
1077 if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0; | |
1078 set_fullmode(priv->fullmode); | |
1079 | |
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
|
1080 if(verbose > 1) printf("SDL: Set next available fullscreen mode.\n"); |
1 | 1081 } |
1082 | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1083 /* f key pressed toggles/exits fullscreenmode */ |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1084 else if ( keypressed == SDLK_f ) { |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
1085 if (priv->surface->flags & SDL_FULLSCREEN) { |
1 | 1086 priv->surface = SDL_SetVideoMode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); |
1087 SDL_ShowCursor(1); | |
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
|
1088 if(verbose > 1) printf("SDL: Windowed mode\n"); |
1 | 1089 } |
1090 else if (priv->fullmodes){ | |
1091 set_fullmode(priv->fullmode); | |
1092 | |
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
|
1093 if(verbose > 1) printf("SDL: Set fullscreen mode\n"); |
1 | 1094 } |
1095 } | |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1096 |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1097 else if ( keypressed == SDLK_n ) { |
2182 | 1098 #ifdef HAVE_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
|
1099 aspect(&priv->dstwidth, &priv->dstheight,A_NOZOOM); |
2182 | 1100 #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
|
1101 if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1102 priv->surface = SDL_SetVideoMode(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
|
1103 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
|
1104 priv->windowsize.h = priv->surface->h; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1105 if(verbose > 1) printf("SDL: Normal size\n"); |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1106 } 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
|
1107 if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) { |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1108 priv->surface = SDL_SetVideoMode(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
|
1109 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
|
1110 priv->windowsize.h = priv->surface->h; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1111 if(verbose > 1) printf("SDL: Double size\n"); |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1112 } |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1113 } |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1114 |
1 | 1115 else switch(keypressed){ |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1116 case SDLK_RETURN: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1117 if (!firstcheck) { firstcheck = 1; break; } |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1118 case SDLK_ESCAPE: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1119 case SDLK_q: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1120 SDL_ShowCursor(1); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1121 mplayer_put_key('q'); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1122 break; |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1123 /*case SDLK_o: mplayer_put_key('o');break; |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1124 case SDLK_SPACE: mplayer_put_key(' ');break; |
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1125 case SDLK_p: mplayer_put_key('p');break;*/ |
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
|
1126 case SDLK_7: mplayer_put_key(shift_key?'/':'7'); |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1127 case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+'); |
1 | 1128 case SDLK_KP_PLUS: mplayer_put_key('+');break; |
1129 case SDLK_MINUS: | |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1130 case SDLK_KP_MINUS: mplayer_put_key('-');break; |
637
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
1131 case SDLK_TAB: mplayer_put_key('\t');break; |
653 | 1132 case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; |
1133 case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1134 #ifdef BUGGY_SDL |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1135 case SDLK_UP: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1136 case SDLK_DOWN: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1137 case SDLK_LEFT: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1138 case SDLK_RIGHT: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1139 case SDLK_ASTERISK: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1140 case SDLK_KP_MULTIPLY: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1141 case SDLK_w: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1142 case SDLK_SLASH: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1143 case SDLK_KP_DIVIDE: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1144 case SDLK_s: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1145 break; |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1146 #else |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1147 case SDLK_UP: mplayer_put_key(KEY_UP);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1148 case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1149 case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1150 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
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
|
1151 case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1152 case SDLK_GREATER: mplayer_put_key('>'); break; |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1153 case SDLK_ASTERISK: |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1154 case SDLK_KP_MULTIPLY: |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1155 case SDLK_w: mplayer_put_key('*');break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1156 case SDLK_SLASH: |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1157 case SDLK_KP_DIVIDE: |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1158 case SDLK_s: mplayer_put_key('/');break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1159 #endif |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1160 default: |
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
|
1161 //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1162 mplayer_put_key(keypressed); |
1 | 1163 } |
1164 | |
1165 break; | |
1710 | 1166 case SDL_QUIT: |
1167 SDL_ShowCursor(1); | |
1168 mplayer_put_key('q'); | |
1169 break; | |
1 | 1170 } |
1171 } | |
1172 } | |
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
|
1173 #undef shift_key |
1 | 1174 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1175 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1176 { struct sdl_priv_s *priv = &sdl_priv; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1177 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1178 /* update osd/subtitles */ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1179 vo_draw_text(priv->width,priv->height,draw_alpha); |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1180 } |
1 | 1181 |
1182 /** | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1183 * Display the surface we have written our data to |
1 | 1184 * |
1185 * params : mode == index of the desired fullscreen mode | |
1186 * returns : doesn't return | |
1187 **/ | |
1188 | |
1189 static void flip_page (void) | |
1190 { | |
1191 struct sdl_priv_s *priv = &sdl_priv; | |
1192 | |
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
|
1193 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
|
1194 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
|
1195 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
|
1196 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
|
1197 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
|
1198 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
|
1199 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
|
1200 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
|
1201 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
1202 if(!priv->dblit) { |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1203 /* blit to the RGB surface */ |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1204 if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL)) |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1205 printf("SDL: Blit failed: %s\n", SDL_GetError()); |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1206 } |
1 | 1207 |
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
|
1208 /* update screen */ |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1209 //SDL_UpdateRect(priv->surface, 0, 0, priv->surface->clip_rect.w, priv->surface->clip_rect.h); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1210 SDL_UpdateRects(priv->surface, 1, &priv->surface->clip_rect); |
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
|
1211 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1212 /* 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
|
1213 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
|
1214 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
|
1215 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1216 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
|
1217 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
|
1218 /* 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
|
1219 SDL_DisplayYUVOverlay (priv->overlay, &priv->surface->clip_rect); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1220 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1221 /* 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
|
1222 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
|
1223 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
|
1224 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1225 //SDL_LockYUVOverlay (priv->overlay); // removed because unused!? |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1226 } |
1 | 1227 } |
1228 | |
1229 static uint32_t | |
1230 query_format(uint32_t format) | |
1231 { | |
1232 switch(format){ | |
1233 case IMGFMT_YV12: | |
408 | 1234 case IMGFMT_I420: |
1235 case IMGFMT_IYUV: | |
1 | 1236 case IMGFMT_YUY2: |
408 | 1237 case IMGFMT_UYVY: |
1238 case IMGFMT_YVYU: | |
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
|
1239 return 0x6; // hw supported & osd |
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_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
|
1241 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
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 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
|
1247 case IMGFMT_BGR32: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1248 return 0x5; // hw supported w/conversion & osd |
1 | 1249 } |
1250 return 0; | |
1251 } | |
1252 | |
1253 static const vo_info_t* | |
1254 get_info(void) | |
1255 { | |
1256 return &vo_info; | |
1257 } | |
1258 | |
1259 | |
1260 static void | |
1261 uninit(void) | |
1262 { | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1263 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1264 static Display *XDisplay; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1265 if(getenv("DISPLAY")) { |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1266 if(verbose) printf("SDL: activating XScreensaver/DPMS\n"); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1267 XDisplay = XOpenDisplay(getenv("DISPLAY")); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1268 saver_on(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1269 XCloseDisplay(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1270 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1271 #endif |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1272 sdl_close(); |
1 | 1273 } |
4352 | 1274 |
1275 static uint32_t preinit(const char *arg) | |
1276 { | |
1277 return 0; | |
1278 } | |
1279 | |
1280 static void query_vaa(vo_vaa_t *vaa) | |
1281 { | |
1282 memset(vaa,0,sizeof(vo_vaa_t)); | |
1283 } |