Mercurial > mplayer.hg
annotate libvo/vo_sdl.c @ 674:10fc57f7e368
FAQ filename fixed
author | arpi_esp |
---|---|
date | Mon, 30 Apr 2001 02:38:41 +0000 |
parents | 799ef558618d |
children | fcc01494c0fe |
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 * | |
92 * KNOWN BUGS: | |
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
|
93 * - Crashes with aalib (fixed, but have to find cause!) |
1 | 94 */ |
95 | |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
96 /* 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
|
97 #undef SDL_NOHWSURFACE |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
98 |
1 | 99 #include <stdio.h> |
100 #include <stdlib.h> | |
101 #include <string.h> | |
102 #include <inttypes.h> | |
103 | |
104 #include "config.h" | |
105 #include "video_out.h" | |
106 #include "video_out_internal.h" | |
107 | |
354 | 108 #include "fastmemcpy.h" |
616 | 109 #include "sub.h" |
350 | 110 |
1 | 111 LIBVO_EXTERN(sdl) |
112 | |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
113 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
|
114 char *sdl_driver; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
115 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
|
116 int sdl_forcexv; |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
117 |
1 | 118 static vo_info_t vo_info = |
119 { | |
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
|
120 "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)", |
1 | 121 "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
|
122 "Ryan C. Gordon <icculus@lokigames.com>, Felix Buenemann <atmosfear@users.sourceforge.net>", |
1 | 123 "" |
124 }; | |
125 | |
126 #include <SDL/SDL.h> | |
127 | |
128 /** Private SDL Data structure **/ | |
129 | |
130 static struct sdl_priv_s { | |
131 | |
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
|
132 /* 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
|
133 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
|
134 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
135 /* SDL display surface */ |
1 | 136 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
|
137 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
138 /* 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
|
139 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
|
140 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
141 /* SDL YUV overlay */ |
1 | 142 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
|
143 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
144 /* x,y video position for centering */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
145 SDL_Rect vidpos; |
1 | 146 |
147 /* available fullscreen modes */ | |
148 SDL_Rect **fullmodes; | |
149 | |
150 /* surface attributes for fullscreen and windowed mode */ | |
151 Uint32 sdlflags, sdlfullflags; | |
152 | |
153 /* save the windowed output extents */ | |
154 SDL_Rect windowsize; | |
155 | |
156 /* Bits per Pixel */ | |
157 Uint8 bpp; | |
158 | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
159 /* RGB 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
|
160 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
|
161 #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
|
162 #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
|
163 #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
|
164 |
1 | 165 /* current fullscreen mode, 0 = highest available fullscreen mode */ |
166 int fullmode; | |
167 | |
168 /* YUV ints */ | |
169 int framePlaneY, framePlaneUV; | |
170 int stridePlaneY, stridePlaneUV; | |
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 /* 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
|
173 int framePlaneRGB; |
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 |
1 | 175 int width,height; |
176 int format; | |
177 } sdl_priv; | |
178 | |
179 | |
351 | 180 /** libvo Plugin functions **/ |
181 | |
182 /** | |
183 * draw_alpha is used for osd and subtitle display. | |
184 * | |
185 **/ | |
186 | |
187 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
408 | 188 struct sdl_priv_s *priv = &sdl_priv; |
351 | 189 |
408 | 190 switch(priv->format) { |
191 case IMGFMT_YV12: | |
192 case IMGFMT_I420: | |
193 case IMGFMT_IYUV: | |
194 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->width*y0+x0,priv->width); | |
195 break; | |
196 case IMGFMT_YUY2: | |
197 case IMGFMT_YVYU: | |
198 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0),2*priv->width); | |
199 break; | |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
200 case IMGFMT_UYVY: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 break; |
408 | 219 } |
351 | 220 } |
1 | 221 |
222 | |
223 /** | |
224 * Take a null-terminated array of pointers, and find the last element. | |
225 * | |
226 * params : array == array of which we want to find the last element. | |
227 * returns : index of last NON-NULL element. | |
228 **/ | |
229 | |
230 static inline int findArrayEnd (SDL_Rect **array) | |
231 { | |
232 int i = 0; | |
233 while ( array[i++] ); /* keep loopin' ... */ | |
234 | |
235 /* return the index of the last array element */ | |
236 return i - 1; | |
237 } | |
238 | |
239 | |
240 /** | |
241 * Open and prepare SDL output. | |
242 * | |
243 * params : *plugin == | |
244 * *name == | |
245 * returns : 0 on success, -1 on failure | |
246 **/ | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
247 |
1 | 248 static int sdl_open (void *plugin, void *name) |
249 { | |
250 struct sdl_priv_s *priv = &sdl_priv; | |
251 const SDL_VideoInfo *vidInfo = NULL; | |
252 static int opened = 0; | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
253 |
1 | 254 if (opened) |
255 return 0; | |
256 opened = 1; | |
257 | |
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
|
258 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
|
259 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
260 if(sdl_driver) setenv("SDL_VIDEODRIVER", sdl_driver, 1); |
351 | 261 |
262 /* 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
|
263 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
|
264 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
265 /* 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
|
266 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
|
267 |
1 | 268 |
84 | 269 /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */ |
1 | 270 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
|
271 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 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
|
276 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
|
277 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
278 /* initialize the SDL Video system */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
279 if (SDL_Init (SDL_INIT_VIDEO/*|SDL_INIT_NOPARACHUTE*/)) { |
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 if(verbose > 2) printf("SDL: Initializing of SDL failed: %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
|
281 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
|
282 } |
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 |
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 SDL_VideoDriverName(priv->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
|
285 if(verbose) printf("SDL: Using driver: %s\n", priv->driver); |
1 | 286 /* other default values */ |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
287 #ifdef SDL_NOHWSURFACE |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
288 if(verbose) printf("SDL: using software-surface\n"); |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
289 priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT; |
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
290 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT; |
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
291 #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
|
292 if((strcmp(priv->driver, "dga") == 0) && (priv->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
|
293 if(verbose) printf("SDL: using software-surface\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
|
294 priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL; |
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 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
296 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
297 else { |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
298 if(verbose) printf("SDL: using hardware-surface\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
|
299 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
300 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_HWACCEL; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
301 } |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
302 #endif |
1 | 303 |
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
|
304 /* Setup Keyrepeats */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
305 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
1 | 306 |
307 /* get information about the graphics adapter */ | |
308 vidInfo = SDL_GetVideoInfo (); | |
309 | |
310 /* collect all fullscreen & hardware modes available */ | |
311 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { | |
312 | |
313 /* non hardware accelerated fullscreen modes */ | |
314 priv->sdlfullflags &= ~SDL_HWSURFACE; | |
315 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); | |
316 } | |
317 | |
318 /* test for normal resizeable & windowed hardware accellerated surfaces */ | |
319 if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) { | |
320 | |
321 /* test for NON hardware accelerated resizeable surfaces - poor you. | |
322 * That's all we have. If this fails there's nothing left. | |
323 * Theoretically there could be Fullscreenmodes left - we ignore this for now. | |
324 */ | |
325 priv->sdlflags &= ~SDL_HWSURFACE; | |
326 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
|
327 printf("SDL: Couldn't get any acceptable SDL Mode for output.\n"); |
1 | 328 return -1; |
329 } | |
330 } | |
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
|
331 |
1 | 332 |
333 /* YUV overlays need at least 16-bit color depth, but the | |
334 * display might less. The SDL AAlib target says it can only do | |
335 * 8-bits, for example. So, if the display is less than 16-bits, | |
336 * 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
|
337 */ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
338 //commented out for RGB test reasons |
1 | 339 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
|
340 //FIXME: DO NOT ADD ANY CODE BELOW THIS OR SDL WILL CRASH WITH AALIB! |
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 (!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
|
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 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 | 344 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
|
345 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
|
346 |
1 | 347 priv->bpp = 16; |
348 } | |
349 | |
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
|
350 /* 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
|
351 * 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
|
352 * 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
|
353 */ |
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 /*SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
355 SDL_EventState(SDL_KEYDOWN, SDL_IGNORE); |
1 | 356 SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); |
357 SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE); | |
358 SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE); | |
359 SDL_EventState(SDL_QUIT, SDL_IGNORE); | |
360 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); | |
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
|
361 SDL_EventState(SDL_USEREVENT, SDL_IGNORE);*/ |
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 |
1 | 363 |
364 /* Success! */ | |
365 return 0; | |
366 } | |
367 | |
368 | |
369 /** | |
370 * Close SDL, Cleanups, Free Memory | |
371 * | |
372 * params : *plugin | |
373 * returns : non-zero on success, zero on error. | |
374 **/ | |
375 | |
376 static int sdl_close (void) | |
377 { | |
378 struct sdl_priv_s *priv = &sdl_priv; | |
379 | |
380 /* Cleanup YUV Overlay structure */ | |
381 if (priv->overlay) | |
382 SDL_FreeYUVOverlay(priv->overlay); | |
383 | |
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
|
384 /* 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
|
385 if (priv->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
|
386 SDL_FreeSurface(priv->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
|
387 |
1 | 388 /* Free our blitting surface */ |
389 if (priv->surface) | |
390 SDL_FreeSurface(priv->surface); | |
391 | |
351 | 392 /* DONT attempt to free the fullscreen modes array. SDL_Quit* does this for us */ |
1 | 393 |
394 /* Cleanup 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
|
395 SDL_Quit(); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
396 //SDL_QuitSubSystem(SDL_INIT_VIDEO); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
397 /* 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
|
398 * changeable on the fly */ |
351 | 399 |
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
|
400 if(verbose > 2) printf("SDL: Closed Plugin\n"); |
1 | 401 |
402 return 0; | |
403 } | |
404 | |
405 | |
406 /** | |
407 * Sets the specified fullscreen mode. | |
408 * | |
409 * params : mode == index of the desired fullscreen mode | |
410 * returns : doesn't return | |
411 **/ | |
412 | |
413 static void set_fullmode (int mode) | |
414 { | |
415 struct sdl_priv_s *priv = &sdl_priv; | |
416 SDL_Surface *newsurface = NULL; | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
417 int haspect, waspect = 0; |
1 | 418 |
419 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */ | |
420 if (mode < 0) | |
421 mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1; | |
422 | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
423 /* Calculate proper aspect ratio for fullscreen |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
424 * 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
|
425 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
|
426 /* 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
|
427 if (haspect < 0) { |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
428 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
|
429 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
|
430 } |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
431 // printf ("W-Aspect: %i H-Aspect: %i\n", waspect, haspect); |
84 | 432 |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
433 /* 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
|
434 newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w - waspect, priv->fullmodes[mode]->h - haspect, priv->bpp, priv->sdlfullflags); |
1 | 435 |
436 /* if we were successfull hide the mouse cursor and save the mode */ | |
437 if (newsurface) { | |
438 priv->surface = newsurface; | |
439 SDL_ShowCursor(0); | |
440 } | |
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
|
441 //TODO: check if this produces memhole! (no surface freeing) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
442 priv->vidpos.x = (priv->surface->w - priv->width) / 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
|
443 priv->vidpos.y = (priv->surface->h - priv->height) / 2; |
1 | 444 } |
445 | |
446 | |
447 /** | |
448 * Initialize an SDL surface and an SDL YUV overlay. | |
449 * | |
450 * params : width == width of video we'll be displaying. | |
451 * height == height of video we'll be displaying. | |
452 * fullscreen == want to be fullscreen? | |
453 * title == Title for window titlebar. | |
454 * returns : non-zero on success, zero on error. | |
455 **/ | |
456 | |
457 static uint32_t | |
458 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) | |
459 //static int sdl_setup (int width, int height) | |
460 { | |
461 struct sdl_priv_s *priv = &sdl_priv; | |
357 | 462 unsigned int sdl_format; |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
463 |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
464 sdl_format = format; |
1 | 465 switch(format){ |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
466 case IMGFMT_YV12: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
467 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
|
468 case IMGFMT_IYUV: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
469 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
|
470 case IMGFMT_YUY2: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
471 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
|
472 case IMGFMT_UYVY: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
473 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
|
474 case IMGFMT_YVYU: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
475 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
|
476 case IMGFMT_I420: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 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
|
510 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
|
511 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
|
512 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
513 default: |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
514 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
|
515 return -1; |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
516 } |
1 | 517 |
518 sdl_open (NULL, NULL); | |
519 | |
351 | 520 /* Set output window title */ |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
521 SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", "SDL Video Out"); |
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
|
522 //SDL_WM_SetCaption (title, title); |
351 | 523 |
1 | 524 /* Save the original Image size */ |
84 | 525 |
648
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
526 //priv->width = d_width ? d_width : width; |
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
527 //priv->height = d_height ? d_height : height; |
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
528 priv->width = width; |
157cb66e1a43
-x -y quickfix for release, code will be changed completely later.
atmosfear
parents:
637
diff
changeset
|
529 priv->height = height; |
1 | 530 priv->format = 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
|
531 priv->windowsize.w = d_width ? d_width : 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
|
532 priv->windowsize.h = d_height ? d_height : height; |
1 | 533 |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
534 /* bit 0 (0x01) means fullscreen (-fs) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
535 * bit 1 (0x02) means mode switching (-vm) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
536 * bit 2 (0x04) enables software scaling (-zoom) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
537 */ |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
538 // printf("SDL: fullscreenflag is set to: %i\n", fullscreen); |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
539 // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
540 switch(fullscreen){ |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
541 case 0x01: |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
542 case 0x05: |
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
|
543 priv->width = 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
|
544 priv->height = height; |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
545 if(verbose) printf("SDL: setting zoomed fullscreen without modeswitching\n"); |
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
|
546 printf("SDL: Info - please use -vm (unscaled) or -zoom (scaled) for best fullscreen experience\n"); |
612 | 547 if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags))) |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
548 SDL_ShowCursor(0); |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
549 break; |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
550 case 0x02: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
551 if(verbose) printf("SDL: setting nonzoomed fullscreen with modeswitching\n"); |
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
|
552 printf("SDL: Info - please use -zoom switch to scale video\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
|
553 if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags))) |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
554 SDL_ShowCursor(0); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
555 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
|
556 case 0x04: |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
557 case 0x06: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
558 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
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
|
559 printf("SDL: Info - please use -vm switch instead if you don't want scaled video\n"); |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
560 priv->surface=NULL; |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
561 set_fullmode(priv->fullmode); |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
562 break; |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
563 default: |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
564 if(verbose) printf("SDL: setting windowed mode\n"); |
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
|
565 if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlflags)) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
566 && (strcmp(priv->driver, "dga") == 0)) SDL_ShowCursor(0); //TODO: other sdl drivers that are fullscreen only? |
1 | 567 } |
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
|
568 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
|
569 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
|
570 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
|
571 } |
1 | 572 |
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
|
573 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
|
574 /* 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
|
575 //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
|
576 // 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
|
577 // 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
|
578 // 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
|
579 // 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
|
580 // 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
|
581 // 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
593 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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
617 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
|
618 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
|
619 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000))) { |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
620 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
|
621 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
|
622 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
623 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
|
624 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
|
625 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000))) { |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
626 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
|
627 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
|
628 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
629 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
|
630 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
|
631 /* 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
|
632 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
|
633 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
|
634 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
|
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
|
636 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
|
637 priv->framePlaneUV = (width * height) >> 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
|
638 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
|
639 priv->stridePlaneUV = width/2; |
1 | 640 } |
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
|
641 |
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(priv->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
|
643 priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel; |
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 } |
1 | 645 return 0; |
646 } | |
647 | |
648 | |
649 /** | |
650 * Draw a frame to the SDL YUV overlay. | |
651 * | |
652 * params : *src[] == the Y, U, and V planes that make up the frame. | |
653 * returns : non-zero on success, zero on error. | |
654 **/ | |
655 | |
656 //static int sdl_draw_frame (frame_t *frame) | |
657 static uint32_t draw_frame(uint8_t *src[]) | |
658 { | |
659 struct sdl_priv_s *priv = &sdl_priv; | |
660 uint8_t *dst; | |
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
|
661 |
1 | 662 switch(priv->format){ |
663 case IMGFMT_YV12: | |
408 | 664 case IMGFMT_I420: |
665 case IMGFMT_IYUV: | |
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
|
666 /*if (SDL_LockYUVOverlay (priv->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
|
667 if(verbose) printf("SDL: Couldn't lock YUV overlay\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
|
668 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
|
669 }*/ |
1 | 670 dst = (uint8_t *) *(priv->overlay->pixels); |
671 memcpy (dst, src[0], priv->framePlaneY); | |
672 dst += priv->framePlaneY; | |
673 memcpy (dst, src[2], priv->framePlaneUV); | |
674 dst += priv->framePlaneUV; | |
675 memcpy (dst, src[1], priv->framePlaneUV); | |
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
|
676 /*SDL_UnlockYUVOverlay (priv->overlay);*/ |
1 | 677 break; |
408 | 678 |
1 | 679 case IMGFMT_YUY2: |
408 | 680 case IMGFMT_UYVY: |
681 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
|
682 /*if (SDL_LockYUVOverlay (priv->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
|
683 if(verbose) printf("SDL: Couldn't lock YUV overlay\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
|
684 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
|
685 }*/ |
1 | 686 dst = (uint8_t *) *(priv->overlay->pixels); |
687 memcpy (dst, src[0], priv->width*priv->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
|
688 /*SDL_UnlockYUVOverlay (priv->overlay);*/ |
1 | 689 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
|
690 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 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
|
698 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
|
699 /*if(SDL_MUSTLOCK(priv->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
|
700 if (SDL_LockSurface (priv->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
|
701 if(verbose) printf("SDL: Couldn't lock RGB surface\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
|
702 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
|
703 } |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
704 }*/ |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
705 dst = (uint8_t *) priv->rgbsurface->pixels; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
706 memcpy (dst, src[0], priv->framePlaneRGB); |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
707 /*if(SDL_MUSTLOCK(priv->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
|
708 SDL_UnlockSurface (priv->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
|
709 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
|
710 |
1 | 711 } |
712 | |
713 return 0; | |
714 } | |
715 | |
716 | |
717 /** | |
718 * Draw a slice (16 rows of image) to the SDL YUV overlay. | |
719 * | |
720 * params : *src[] == the Y, U, and V planes that make up the slice. | |
721 * returns : non-zero on error, zero on success. | |
722 **/ | |
723 | |
724 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num) | |
725 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
726 { | |
727 struct sdl_priv_s *priv = &sdl_priv; | |
728 uint8_t *dst; | |
729 uint8_t *src; | |
730 int i; | |
731 | |
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
|
732 /*if (SDL_LockYUVOverlay (priv->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
|
733 if(verbose) printf("SDL: Couldn't lock YUV overlay"); |
1 | 734 return -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
|
735 }*/ |
1 | 736 |
737 dst = (uint8_t *) *(priv->overlay->pixels) | |
738 + (priv->stridePlaneY * y + x); | |
739 src = image[0]; | |
740 for(i=0;i<h;i++){ | |
741 memcpy(dst,src,w); | |
742 src+=stride[0]; | |
743 dst+=priv->stridePlaneY; | |
744 } | |
745 | |
746 x/=2;y/=2;w/=2;h/=2; | |
747 | |
748 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY | |
749 + (priv->stridePlaneUV * y + x); | |
750 src = image[2]; | |
751 for(i=0;i<h;i++){ | |
752 memcpy(dst,src,w); | |
753 src+=stride[2]; | |
754 dst+=priv->stridePlaneUV; | |
755 } | |
756 | |
757 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY | |
758 + priv->framePlaneUV + (priv->stridePlaneUV * y + x); | |
759 src = image[1]; | |
760 for(i=0;i<h;i++){ | |
761 memcpy(dst,src,w); | |
762 src+=stride[1]; | |
763 dst+=priv->stridePlaneUV; | |
764 } | |
765 | |
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
|
766 /*SDL_UnlockYUVOverlay (priv->overlay);*/ |
1 | 767 |
768 return 0; | |
769 } | |
770 | |
771 | |
772 | |
773 /** | |
774 * Checks for SDL keypress and window resize events | |
775 * | |
776 * params : none | |
777 * returns : doesn't return | |
778 **/ | |
779 | |
780 #include "../linux/keycodes.h" | |
781 extern void mplayer_put_key(int code); | |
782 | |
783 static void check_events (void) | |
784 { | |
785 struct sdl_priv_s *priv = &sdl_priv; | |
786 SDL_Event event; | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
787 SDLKey keypressed = 0; |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
788 static int firstcheck = 0; |
1 | 789 |
790 /* Poll the waiting SDL Events */ | |
791 while ( SDL_PollEvent(&event) ) { | |
792 switch (event.type) { | |
793 | |
794 /* capture window resize events */ | |
795 case SDL_VIDEORESIZE: | |
796 priv->surface = SDL_SetVideoMode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags); | |
797 | |
798 /* save video extents, to restore them after going fullscreen */ | |
799 //if(!(priv->surface->flags & SDL_FULLSCREEN)) { | |
800 priv->windowsize.w = priv->surface->w; | |
801 priv->windowsize.h = priv->surface->h; | |
802 //} | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
803 if(verbose > 2) printf("SDL: Window resize\n"); |
1 | 804 break; |
805 | |
806 | |
807 /* graphics mode selection shortcuts */ | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
808 case SDL_KEYDOWN: |
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 switch(event.key.keysym.sym) { |
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 case SDLK_UP: mplayer_put_key(KEY_UP);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
|
811 case SDLK_DOWN: mplayer_put_key(KEY_DOWN);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 SDLK_LEFT: mplayer_put_key(KEY_LEFT);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
|
813 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
637
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
814 case SDLK_ASTERISK: |
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
815 case SDLK_KP_MULTIPLY: |
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
816 case SDLK_w: mplayer_put_key('*');break; |
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
817 case SDLK_SLASH: |
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
818 case SDLK_KP_DIVIDE: |
19d941a8b46f
Added support for osd menue and kexrepeats for mixer keys.
atmosfear
parents:
635
diff
changeset
|
819 case SDLK_s: mplayer_put_key('/');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
|
820 } |
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 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
|
822 case SDL_KEYUP: |
1 | 823 keypressed = event.key.keysym.sym; |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
824 |
357 | 825 /* 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
|
826 if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) { |
1 | 827 /* select next fullscreen mode */ |
828 priv->fullmode++; | |
829 if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0; | |
830 set_fullmode(priv->fullmode); | |
831 | |
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
|
832 if(verbose > 1) printf("SDL: Set next available fullscreen mode.\n"); |
1 | 833 } |
834 | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
835 /* f key pressed toggles/exits fullscreenmode */ |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
836 else if ( keypressed == SDLK_f ) { |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
837 if (priv->surface->flags & SDL_FULLSCREEN) { |
1 | 838 priv->surface = SDL_SetVideoMode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); |
839 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
|
840 if(verbose > 1) printf("SDL: Windowed mode\n"); |
1 | 841 } |
842 else if (priv->fullmodes){ | |
843 set_fullmode(priv->fullmode); | |
844 | |
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
|
845 if(verbose > 1) printf("SDL: Set fullscreen mode\n"); |
1 | 846 } |
847 } | |
848 | |
849 else switch(keypressed){ | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
850 case SDLK_RETURN: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
851 if (!firstcheck) { firstcheck = 1; break; } |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
852 case SDLK_ESCAPE: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
853 case SDLK_q: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
854 SDL_ShowCursor(1); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
855 mplayer_put_key('q'); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
856 break; |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
857 /*case SDLK_o: mplayer_put_key('o');break; |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
858 case SDLK_SPACE: mplayer_put_key(' ');break; |
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
859 case SDLK_p: mplayer_put_key('p');break;*/ |
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
860 case SDLK_PLUS: |
1 | 861 case SDLK_KP_PLUS: mplayer_put_key('+');break; |
862 case SDLK_MINUS: | |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
863 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
|
864 case SDLK_TAB: mplayer_put_key('\t');break; |
653 | 865 case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; |
866 case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
867 default: |
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
868 mplayer_put_key(keypressed); |
1 | 869 } |
870 | |
871 break; | |
872 } | |
873 } | |
874 } | |
875 | |
876 | |
877 /** | |
878 * Display the surface we have written our data to and check for events. | |
879 * | |
880 * params : mode == index of the desired fullscreen mode | |
881 * returns : doesn't return | |
882 **/ | |
883 | |
884 static void flip_page (void) | |
885 { | |
886 struct sdl_priv_s *priv = &sdl_priv; | |
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
|
887 SDL_Surface *blitconv; // temporary conversion surface |
1 | 888 |
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
|
889 /* update osd/subtitles */ |
351 | 890 vo_draw_text(priv->width,priv->height,draw_alpha); |
891 | |
1 | 892 /* check and react on keypresses and window resizes */ |
893 check_events(); | |
894 | |
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
|
895 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
|
896 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
|
897 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
|
898 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
|
899 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
|
900 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
|
901 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
|
902 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
|
903 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
|
904 /* blit to the 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
|
905 blitconv = SDL_DisplayFormat(priv->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
|
906 if(SDL_BlitSurface (blitconv, NULL, priv->surface, &priv->vidpos)) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
907 printf("SDL: Blit failed: %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
|
908 SDL_FreeSurface(blitconv); |
1 | 909 |
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
|
910 /*if(SDL_MUSTLOCK(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
|
911 if (SDL_LockSurface (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
|
912 if(verbose) printf("SDL: Couldn't lock RGB surface\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
|
913 return; |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
914 } |
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 /* update screen */ |
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 SDL_UpdateRect(priv->surface, priv->vidpos.x, priv->vidpos.y, priv->width, priv->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
|
918 /*if(SDL_MUSTLOCK(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
|
919 SDL_UnlockSurface (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
|
920 |
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 /* 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
|
922 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
|
923 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
|
924 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
925 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
|
926 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
|
927 /* 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
|
928 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
|
929 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
930 /* 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
|
931 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
|
932 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
|
933 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
934 //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
|
935 } |
1 | 936 } |
937 | |
938 static uint32_t | |
939 query_format(uint32_t format) | |
940 { | |
941 switch(format){ | |
942 case IMGFMT_YV12: | |
408 | 943 case IMGFMT_I420: |
944 case IMGFMT_IYUV: | |
1 | 945 case IMGFMT_YUY2: |
408 | 946 case IMGFMT_UYVY: |
947 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
|
948 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
|
949 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
|
950 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
|
951 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
|
952 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
|
953 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
|
954 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
|
955 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
|
956 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
|
957 return 0x5; // hw supported w/conversion & osd |
1 | 958 } |
959 return 0; | |
960 } | |
961 | |
962 static const vo_info_t* | |
963 get_info(void) | |
964 { | |
965 return &vo_info; | |
966 } | |
967 | |
968 | |
969 static void | |
970 uninit(void) | |
971 { | |
972 sdl_close(); | |
973 } | |
974 |