Mercurial > mplayer.hg
annotate libvo/vo_sdl.c @ 5914:808e7bda84fc
some vfw codecs supports I420 and YV12 too
author | alex |
---|---|
date | Tue, 30 Apr 2002 14:37:41 +0000 |
parents | af9efcb80244 |
children | 2997a3faf381 |
rev | line source |
---|---|
1 | 1 /* |
351 | 2 * vo_sdl.c |
3 * | |
579 | 4 * (was video_out_sdl.c from OMS project/mpeg2dec -> http://linuxvideo.org) |
1 | 5 * |
6 * Copyright (C) Ryan C. Gordon <icculus@lokigames.com> - April 22, 2000. | |
7 * | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
8 * Copyright (C) Felix Buenemann <atmosfear@users.sourceforge.net> - 2001 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
9 * |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
10 * (for extensive code enhancements) |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
11 * |
579 | 12 * Current maintainer for MPlayer project (report bugs to that address): |
13 * Felix Buenemann <atmosfear@users.sourceforge.net> | |
14 * | |
15 * This file is a video out driver using the SDL library (http://libsdl.org/), | |
580 | 16 * to be used with MPlayer [The Movie Player for Linux] project, further info |
579 | 17 * from http://mplayer.sourceforge.net. |
18 * | |
19 * Current license is not decided yet, but we're heading for GPL. | |
20 * | |
21 * -- old disclaimer -- | |
22 * | |
1 | 23 * A mpeg2dec display driver that does output through the |
24 * Simple DirectMedia Layer (SDL) library. This effectively gives us all | |
25 * sorts of output options: X11, SVGAlib, fbcon, AAlib, GGI. Win32, MacOS | |
26 * and BeOS support, too. Yay. SDL info, source, and binaries can be found | |
27 * at http://slouken.devolution.com/SDL/ | |
28 * | |
29 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
30 * | |
31 * mpeg2dec is free software; you can redistribute it and/or modify | |
32 * it under the terms of the GNU General Public License as published by | |
33 * the Free Software Foundation; either version 2, or (at your option) | |
34 * any later version. | |
35 * | |
36 * mpeg2dec is distributed in the hope that it will be useful, | |
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
39 * GNU General Public License for more details. | |
40 * | |
41 * You should have received a copy of the GNU General Public License | |
42 * along with GNU Make; see the file COPYING. If not, write to | |
579 | 43 * the Free Software Foundation. |
44 * | |
45 * -- end old disclaimer -- | |
1 | 46 * |
47 * Changes: | |
48 * Dominik Schnitzer <dominik@schnitzer.at> - November 08, 2000. | |
84 | 49 * - Added resizing support, fullscreen: changed the sdlmodes selection |
1 | 50 * routine. |
51 * - SDL bugfixes: removed the atexit(SLD_Quit), SDL_Quit now resides in | |
52 * the plugin_exit routine. | |
53 * - Commented the source :) | |
54 * - Shortcuts: for switching between Fullscreen/Windowed mode and for | |
55 * cycling between the different Fullscreen modes. | |
56 * - Small bugfixes: proper width/height of movie | |
57 * Dominik Schnitzer <dominik@schnitzer.at> - November 11, 2000. | |
58 * - Cleanup code, more comments | |
59 * - Better error handling | |
60 * Bruno Barreyra <barreyra@ufl.edu> - December 10, 2000. | |
61 * - Eliminated memcpy's for entire frames | |
579 | 62 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 11, 2001 |
84 | 63 * - Added aspect-ratio awareness for fullscreen |
579 | 64 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 11, 2001 |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
65 * - Fixed aspect-ratio awareness, did only vertical scaling (black bars above |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
66 * and below), now also does horizontal scaling (black bars left and right), |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
67 * so you get the biggest possible picture with correct aspect-ratio. |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
68 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 12, 2001 |
579 | 69 * - Minor bugfix to aspect-ratio for non-4:3-resolutions (like 1280x1024) |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
70 * - Bugfix to check_events() to reveal mouse cursor after 'q'-quit in |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
71 * fullscreen-mode |
351 | 72 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 10, 2001 |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
73 * - Changed keypress-detection from keydown to keyup, seems to fix keyrepeat |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
74 * bug (key had to be pressed twice to be detected) |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
75 * - Changed key-handling: 'f' cycles fullscreen/windowed, ESC/RETURN/'q' quits |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
76 * - Bugfix which avoids exit, because return is passed to sdl-output on startup, |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
77 * which caused the player to exit (keyboard-buffer problem? better solution |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
78 * recommed) |
351 | 79 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 11, 2001 |
80 * - OSD and subtitle support added | |
81 * - some minor code-changes | |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
82 * - added code to comply with new fullscreen meaning |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
83 * - changed fullscreen-mode-cycling from '+' to 'c' (interferred with audiosync |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
84 * adjustment) |
386 | 85 * Felix Buenemann <Atmosfear@users.sourceforge.net> - April 13, 2001 |
86 * - added keymapping to toggle OSD ('o' key) | |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
87 * - added some defines to modify some sdl-out internas (see comments) |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
88 * |
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
89 * Felix Buenemann: further changes will be visible through cvs log, don't want |
579 | 90 * to update this all the time (CVS info on http://mplayer.sourceforge.net) |
91 * | |
1 | 92 */ |
93 | |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
94 /* define to force software-surface (video surface stored in system memory)*/ |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
95 #undef SDL_NOHWSURFACE |
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
96 |
1197 | 97 /* define to enable surface locks, this might be needed on SMP machines */ |
98 #undef SDL_ENABLE_LOCKS | |
99 | |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
100 //#define BUGGY_SDL //defined by configure |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
101 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
102 /* MONITOR_ASPECT MUST BE FLOAT */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
103 #define MONITOR_ASPECT 4.0/3.0 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
104 |
1 | 105 #include <stdio.h> |
106 #include <stdlib.h> | |
107 #include <string.h> | |
108 #include <inttypes.h> | |
109 | |
1100
7829676dc4ef
Ooops, wrong path to config.h - now you may enjoy code that was never before used =)
atmosfear
parents:
1080
diff
changeset
|
110 #include "../config.h" |
1 | 111 #include "video_out.h" |
112 #include "video_out_internal.h" | |
113 | |
354 | 114 #include "fastmemcpy.h" |
616 | 115 #include "sub.h" |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
116 #include "aspect.h" |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
117 #include "libmpcodecs/vfcap.h" |
350 | 118 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
119 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
120 #include <X11/Xlib.h> |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
121 #include "x11_common.h" |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
122 #endif |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
123 |
4590
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
124 #ifdef HAVE_NEW_INPUT |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
125 #include "../input/input.h" |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
126 #include "../input/mouse.h" |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
127 #endif |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
128 |
1 | 129 LIBVO_EXTERN(sdl) |
130 | |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
131 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
|
132 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
|
133 int sdl_forcexv; |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
134 |
1 | 135 static vo_info_t vo_info = |
136 { | |
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 "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)", |
1 | 138 "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
|
139 "Ryan C. Gordon <icculus@lokigames.com>, Felix Buenemann <atmosfear@users.sourceforge.net>", |
1 | 140 "" |
141 }; | |
142 | |
1238 | 143 #include <SDL.h> |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
144 //#include <SDL/SDL_syswm.h> |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
145 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
146 #if defined(sun) && defined(__svr4__) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
147 /* setenv is missing on solaris */ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
148 static void setenv(const char *name, const char *val, int _xx) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
149 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
150 int len = strlen(name) + strlen(val) + 2; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
151 char *env = malloc(len); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
152 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
153 if (env != NULL) { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
154 strcpy(env, name); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
155 strcat(env, "="); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
156 strcat(env, val); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
157 putenv(env); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
158 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
159 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
160 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
161 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
973
diff
changeset
|
162 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
163 #define FS 0x01 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
164 #define VM 0x02 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
165 #define ZOOM 0x04 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
166 #define FLIP 0x08 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
167 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
168 #ifdef SDL_ENABLE_LOCKS |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
169 #define SDL_OVR_LOCK(x) if (SDL_LockYUVOverlay (priv->overlay)) { \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
170 if(verbose) printf("SDL: Couldn't lock YUV overlay\n"); \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
171 return x; \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
172 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
173 #define SDL_OVR_UNLOCK SDL_UnlockYUVOverlay (priv->overlay); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
174 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
175 #define SDL_SRF_LOCK(srf, x) if(SDL_MUSTLOCK(srf)) { \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
176 if(SDL_LockSurface (srf)) { \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
177 if(verbose) printf("SDL: Couldn't lock RGB surface\n"); \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
178 return x; \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
179 } \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
180 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
181 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
182 #define SDL_SRF_UNLOCK(srf) if(SDL_MUSTLOCK(srf)) \ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
183 SDL_UnlockSurface (srf); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
184 #else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
185 #define SDL_OVR_LOCK(x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
186 #define SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
187 #define SDL_SRF_LOCK(srf, x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
188 #define SDL_SRF_UNLOCK(srf) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
189 #endif |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
190 |
1 | 191 /** Private SDL Data structure **/ |
192 | |
193 static struct sdl_priv_s { | |
194 | |
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
|
195 /* 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
|
196 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
|
197 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
198 /* SDL display surface */ |
1 | 199 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
|
200 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
201 /* 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
|
202 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
|
203 |
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 /* SDL YUV overlay */ |
1 | 205 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
|
206 |
1 | 207 /* available fullscreen modes */ |
208 SDL_Rect **fullmodes; | |
209 | |
210 /* surface attributes for fullscreen and windowed mode */ | |
211 Uint32 sdlflags, sdlfullflags; | |
212 | |
213 /* save the windowed output extents */ | |
214 SDL_Rect windowsize; | |
215 | |
216 /* Bits per Pixel */ | |
217 Uint8 bpp; | |
218 | |
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
|
219 /* 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
|
220 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
|
221 #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
|
222 #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
|
223 #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
|
224 |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
225 /* use direct blitting to surface */ |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
226 int dblit; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
227 |
1 | 228 /* current fullscreen mode, 0 = highest available fullscreen mode */ |
229 int fullmode; | |
230 | |
231 /* YUV ints */ | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
232 int framePlaneY, framePlaneUV, framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
233 int stridePlaneY, stridePlaneUV, stridePlaneYUY; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
234 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
235 /* 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
|
236 int framePlaneRGB; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
237 int stridePlaneRGB; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
238 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
239 /* Flip image */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
240 int flip; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
241 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
242 /* fullscreen behaviour; see init */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
243 int fulltype; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
244 |
951 | 245 /* is X running (0/1) */ |
246 int X; | |
247 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
248 /* X11 Resolution */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
249 int XWidth, XHeight; |
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
|
250 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
251 /* original image dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
252 int width, height; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
253 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
254 /* destination dimensions */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
255 int dstwidth, dstheight; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
256 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
257 /* Draw image at coordinate y on the SDL surfaces */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
258 int y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
259 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
260 /* The image is displayed between those y coordinates in priv->surface */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
261 int y_screen_top, y_screen_bottom; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
262 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
263 /* 1 if the OSD has changed otherwise 0 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
264 int osd_has_changed; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
265 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
266 /* source image format (YUV/RGB/...) */ |
5058 | 267 uint32_t format; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
268 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
269 /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
270 dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
271 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
272 SDL_Rect dirty_off_frame[2]; |
1 | 273 } sdl_priv; |
274 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
275 static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
276 static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
277 static int setup_surfaces(void); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
278 static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
279 static void erase_rectangle(int x, int y, int w, int h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
280 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
281 /* Expand 'rect' to contain the rectangle specified by x, y, w and h */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
282 static void expand_rect(SDL_Rect* rect, int x, int y, int w, int h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
283 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
284 if(rect->x < 0 || rect->y < 0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
285 rect->x = x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
286 rect->y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
287 rect->w = w; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
288 rect->h = h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
289 return; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
290 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
291 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
292 if(rect->x > x) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
293 rect->x = x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
294 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
295 if(rect->y > y) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
296 rect->y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
297 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
298 if(rect->x + rect->w < x + w) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
299 rect->w = x + w - rect->x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
300 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
301 if(rect->y + rect->h < y + h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
302 rect->h = y + h - rect->y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
303 } |
1 | 304 |
351 | 305 /** libvo Plugin functions **/ |
306 | |
307 /** | |
308 * draw_alpha is used for osd and subtitle display. | |
309 * | |
310 **/ | |
311 | |
312 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
408 | 313 struct sdl_priv_s *priv = &sdl_priv; |
351 | 314 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
315 if(priv->osd_has_changed) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
316 /* OSD did change. Store a bounding box of everything drawn into the OSD */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
317 if(priv->y >= y0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
318 /* Make sure we don't mark part of the frame area dirty */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
319 if(h + y0 > priv->y) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
320 expand_rect(&priv->dirty_off_frame[0], x0, y0, w, priv->y - y0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
321 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
322 expand_rect(&priv->dirty_off_frame[0], x0, y0, w, h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
323 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
324 else if(priv->y + priv->height <= y0 + h) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
325 /* Make sure we don't mark part of the frame area dirty */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
326 if(y0 < priv->y + priv->height) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
327 expand_rect(&priv->dirty_off_frame[1], x0, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
328 priv->y + priv->height, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
329 w, h - ((priv->y + priv->height) - y0)); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
330 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
331 expand_rect(&priv->dirty_off_frame[1], x0, y0, w, h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
332 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
333 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
334 else { /* OSD contents didn't change only draw parts that was erased by the frame */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
335 if(priv->y >= y0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
336 src = src + (priv->y - y0) * stride; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
337 srca = srca + (priv->y - y0) * stride; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
338 h -= priv->y - y0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
339 y0 = priv->y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
340 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
341 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
342 if(priv->y + priv->height <= y0 + h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
343 h = priv->y + priv->height - y0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
344 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
345 if(h <= 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
346 return; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
347 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
348 |
408 | 349 switch(priv->format) { |
350 case IMGFMT_YV12: | |
351 case IMGFMT_I420: | |
352 case IMGFMT_IYUV: | |
5260 | 353 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); |
408 | 354 break; |
355 case IMGFMT_YUY2: | |
5260 | 356 case IMGFMT_YVYU: |
357 x0 *= 2; | |
358 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); | |
408 | 359 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
360 case IMGFMT_UYVY: |
5260 | 361 x0 *= 2; |
362 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
363 break; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
364 |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
365 default: |
5260 | 366 if(priv->dblit) { |
367 x0 *= priv->surface->format->BytesPerPixel; | |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
368 switch(priv->format) { |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
369 case IMGFMT_RGB15: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
370 case IMGFMT_BGR15: |
5260 | 371 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
372 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
373 case IMGFMT_RGB16: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
374 case IMGFMT_BGR16: |
5260 | 375 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
376 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
377 case IMGFMT_RGB24: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
378 case IMGFMT_BGR24: |
5260 | 379 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
380 break; |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
381 case IMGFMT_RGB32: |
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
382 case IMGFMT_BGR32: |
5260 | 383 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
384 break; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
385 } |
5260 | 386 } |
387 else { | |
388 x0 *= priv->rgbsurface->format->BytesPerPixel; | |
389 switch(priv->format) { | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
390 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
|
391 case IMGFMT_BGR15: |
5260 | 392 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
393 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
|
394 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
|
395 case IMGFMT_BGR16: |
5260 | 396 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
397 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
|
398 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
|
399 case IMGFMT_BGR24: |
5260 | 400 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
401 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
|
402 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
|
403 case IMGFMT_BGR32: |
5260 | 404 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
405 break; |
5260 | 406 } |
407 } | |
408 | |
408 | 409 } |
351 | 410 } |
1 | 411 |
412 | |
413 /** | |
414 * Take a null-terminated array of pointers, and find the last element. | |
415 * | |
416 * params : array == array of which we want to find the last element. | |
417 * returns : index of last NON-NULL element. | |
418 **/ | |
419 | |
420 static inline int findArrayEnd (SDL_Rect **array) | |
421 { | |
422 int i = 0; | |
423 while ( array[i++] ); /* keep loopin' ... */ | |
424 | |
425 /* return the index of the last array element */ | |
426 return i - 1; | |
427 } | |
428 | |
429 | |
430 /** | |
431 * Open and prepare SDL output. | |
432 * | |
433 * params : *plugin == | |
434 * *name == | |
435 * returns : 0 on success, -1 on failure | |
436 **/ | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
437 |
1 | 438 static int sdl_open (void *plugin, void *name) |
439 { | |
440 struct sdl_priv_s *priv = &sdl_priv; | |
441 const SDL_VideoInfo *vidInfo = NULL; | |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
442 /*static int opened = 0; |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
443 |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
444 if (opened) |
1 | 445 return 0; |
4528
bd2324553533
Fix multifile playback (sdl was not fully reinitialized).
atmos4
parents:
4433
diff
changeset
|
446 opened = 1;*/ |
1 | 447 |
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
|
448 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
|
449 |
1188 | 450 if(vo_subdevice) setenv("SDL_VIDEODRIVER", vo_subdevice, 1); |
351 | 451 |
452 /* 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
|
453 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
|
454 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
455 /* 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
|
456 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
|
457 |
1 | 458 |
84 | 459 /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */ |
5240 | 460 priv->fullmode = -2; |
461 | |
462 priv->fullmodes = NULL; | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
463 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
|
464 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
465 /* initialize the SDL Video system */ |
5240 | 466 if (!SDL_WasInit(SDL_INIT_VIDEO)) { |
467 if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) { | |
468 printf("SDL: Initializing of SDL failed: %s.\n", SDL_GetError()); | |
469 return -1; | |
470 } | |
471 } | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
472 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
473 SDL_VideoDriverName(priv->driver, 8); |
1080 | 474 printf("SDL: Using driver: %s\n", priv->driver); |
1 | 475 /* other default values */ |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
476 #ifdef SDL_NOHWSURFACE |
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 software-surface\n"); |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
478 priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_ANYFORMAT; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
479 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_ANYFORMAT; |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
480 #else |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
481 /*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
482 if(verbose) printf("SDL: using software-surface\n"); |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
483 priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
484 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
485 } |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
486 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
|
487 if(verbose) printf("SDL: using hardware-surface\n"); |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
488 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
489 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
490 //} |
394
f4fb35ef4c06
- added some defines to modify some sdl-out internas (see comments)
atmosfear
parents:
386
diff
changeset
|
491 #endif |
1 | 492 |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
493 /* Setup Keyrepeats (500/30 are defaults) */ |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
494 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); |
1 | 495 |
496 /* get information about the graphics adapter */ | |
497 vidInfo = SDL_GetVideoInfo (); | |
498 | |
499 /* collect all fullscreen & hardware modes available */ | |
500 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { | |
501 | |
502 /* non hardware accelerated fullscreen modes */ | |
503 priv->sdlfullflags &= ~SDL_HWSURFACE; | |
504 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); | |
505 } | |
506 | |
507 /* test for normal resizeable & windowed hardware accellerated surfaces */ | |
508 if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) { | |
509 | |
510 /* test for NON hardware accelerated resizeable surfaces - poor you. | |
511 * That's all we have. If this fails there's nothing left. | |
512 * Theoretically there could be Fullscreenmodes left - we ignore this for now. | |
513 */ | |
514 priv->sdlflags &= ~SDL_HWSURFACE; | |
515 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
|
516 printf("SDL: Couldn't get any acceptable SDL Mode for output.\n"); |
1 | 517 return -1; |
518 } | |
519 } | |
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
|
520 |
1 | 521 |
522 /* YUV overlays need at least 16-bit color depth, but the | |
523 * display might less. The SDL AAlib target says it can only do | |
524 * 8-bits, for example. So, if the display is less than 16-bits, | |
525 * 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
|
526 */ |
1 | 527 priv->bpp = vidInfo->vfmt->BitsPerPixel; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
528 if (priv->mode == YUV && priv->bpp < 16) { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
529 |
5240 | 530 if(verbose) printf("SDL: Your SDL display target wants to be at a color " |
531 "depth of (%d), but we need it to be at least 16 " | |
532 "bits, so we need to emulate 16-bit color. This is " | |
533 "going to slow things down; you might want to " | |
534 "increase your display's color depth, if possible.\n", | |
535 priv->bpp); | |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
536 |
1 | 537 priv->bpp = 16; |
538 } | |
539 | |
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
|
540 /* 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
|
541 * 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
|
542 * 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
|
543 */ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
544 #ifndef BUGGY_SDL |
770
0e549c933515
Got rid of aalib crashing workaround with SDL1.2.1+
atmosfear
parents:
705
diff
changeset
|
545 SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); |
1 | 546 SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); |
1710 | 547 // SDL_EventState(SDL_QUIT, SDL_IGNORE); |
1 | 548 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); |
770
0e549c933515
Got rid of aalib crashing workaround with SDL1.2.1+
atmosfear
parents:
705
diff
changeset
|
549 SDL_EventState(SDL_USEREVENT, SDL_IGNORE); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
550 #endif |
1 | 551 |
552 /* Success! */ | |
553 return 0; | |
554 } | |
555 | |
556 | |
557 /** | |
558 * Close SDL, Cleanups, Free Memory | |
559 * | |
560 * params : *plugin | |
561 * returns : non-zero on success, zero on error. | |
562 **/ | |
563 | |
564 static int sdl_close (void) | |
565 { | |
566 struct sdl_priv_s *priv = &sdl_priv; | |
567 | |
568 /* Cleanup YUV Overlay structure */ | |
569 if (priv->overlay) | |
570 SDL_FreeYUVOverlay(priv->overlay); | |
571 | |
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
|
572 /* 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
|
573 if (priv->rgbsurface) |
1126 | 574 SDL_FreeSurface(priv->rgbsurface); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
575 |
1 | 576 /* Free our blitting surface */ |
577 if (priv->surface) | |
578 SDL_FreeSurface(priv->surface); | |
579 | |
351 | 580 /* DONT attempt to free the fullscreen modes array. SDL_Quit* does this for us */ |
1 | 581 |
582 /* Cleanup SDL */ | |
5240 | 583 if(SDL_WasInit(SDL_INIT_VIDEO)) |
584 SDL_QuitSubSystem(SDL_INIT_VIDEO); | |
351 | 585 |
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
|
586 if(verbose > 2) printf("SDL: Closed Plugin\n"); |
1 | 587 |
588 return 0; | |
589 } | |
590 | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
591 /** |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
592 * Do aspect ratio calculations |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
593 * |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
594 * params : srcw == sourcewidth |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
595 * srch == sourceheight |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
596 * dstw == destinationwidth |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
597 * dsth == destinationheight |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
598 * |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
599 * returns : SDL_Rect structure with new x and y, w and h |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
600 **/ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
601 |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
602 #if 0 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
603 static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
604 SDL_Rect newres; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
605 if(verbose > 1) printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
606 newres.h = ((float)dstw / (float)srcw * (float)srch) * ((float)dsth/((float)dstw/(MONITOR_ASPECT))); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
607 if(newres.h > dsth) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
608 newres.w = ((float)dsth / (float)newres.h) * dstw; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
609 newres.h = dsth; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
610 newres.x = (dstw - newres.w) / 2; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
611 newres.y = 0; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
612 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
613 else { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
614 newres.w = dstw; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
615 newres.x = 0; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
616 newres.y = (dsth - newres.h) / 2; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
617 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
618 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
619 if(verbose) printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
620 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
621 return newres; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
622 } |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
623 #endif |
1 | 624 |
625 /** | |
626 * Sets the specified fullscreen mode. | |
627 * | |
628 * params : mode == index of the desired fullscreen mode | |
629 * returns : doesn't return | |
630 **/ | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
631 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
632 #if 0 |
1 | 633 static void set_fullmode (int mode) |
634 { | |
635 struct sdl_priv_s *priv = &sdl_priv; | |
636 SDL_Surface *newsurface = NULL; | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
637 int haspect, waspect = 0; |
1 | 638 |
639 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */ | |
640 if (mode < 0) | |
641 mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1; | |
642 | |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
643 /* Calculate proper aspect ratio for fullscreen |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
644 * 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
|
645 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
|
646 /* 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
|
647 if (haspect < 0) { |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
648 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
|
649 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
|
650 } |
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
651 // printf ("W-Aspect: %i H-Aspect: %i\n", waspect, haspect); |
84 | 652 |
97
cab74dfde6dd
Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents:
84
diff
changeset
|
653 /* 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
|
654 newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w - waspect, priv->fullmodes[mode]->h - haspect, priv->bpp, priv->sdlfullflags); |
1 | 655 |
656 /* if we were successfull hide the mouse cursor and save the mode */ | |
657 if (newsurface) { | |
1126 | 658 if (priv->surface) |
659 SDL_FreeSurface(priv->surface); | |
1 | 660 priv->surface = newsurface; |
661 SDL_ShowCursor(0); | |
662 } | |
663 } | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
664 #endif |
1 | 665 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
666 /* Set video mode. Not fullscreen */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
667 static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
668 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
669 struct sdl_priv_s *priv = &sdl_priv; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
670 SDL_Surface* newsurface; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
671 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
672 newsurface = SDL_SetVideoMode(width, height, bpp, sdlflags); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
673 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
674 if(newsurface) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
675 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
676 /* priv->surface will be NULL the first time this function is called. */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
677 if(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
678 SDL_FreeSurface(priv->surface); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
679 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
680 priv->surface = newsurface; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
681 priv->dstwidth = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
682 priv->dstheight = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
683 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
684 setup_surfaces(); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
685 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
686 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
687 printf("set_video_mode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
688 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
689 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
690 static void set_fullmode (int mode) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
691 struct sdl_priv_s *priv = &sdl_priv; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
692 SDL_Surface *newsurface = NULL; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
693 int screen_surface_w, screen_surface_h; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
694 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
695 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */ |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
696 /* But select a mode where the full video enter */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
697 if(priv->X && priv->fulltype & FS) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
698 screen_surface_w = priv->XWidth; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
699 screen_surface_h = priv->XHeight; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
700 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
701 else if (mode < 0) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
702 int i; |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
703 mode = 0; // Default to the biggest mode avaible |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
704 for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
705 if( (priv->fullmodes[i]->w >= priv->dstwidth) && |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
706 (priv->fullmodes[i]->h >= priv->dstheight) ) { |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
707 mode = i; |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
708 break; |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
709 } |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
710 } |
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
711 priv->fullmode = mode; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
712 screen_surface_h = priv->fullmodes[mode]->h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
713 screen_surface_w = priv->fullmodes[mode]->w; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
714 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
715 else { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
716 screen_surface_h = priv->fullmodes[mode]->h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
717 screen_surface_w = priv->fullmodes[mode]->w; |
3609
c9876f5f4ac5
better fullscreen-mode selection, patch by dunno :)
atmos4
parents:
2249
diff
changeset
|
718 } |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
719 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
720 aspect_save_screenres(screen_surface_w, screen_surface_h); |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
721 |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
722 /* calculate new video size/aspect */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
723 if(priv->mode == YUV) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
724 if(priv->fulltype&FS) |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
725 aspect_save_screenres(priv->XWidth, priv->XHeight); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
726 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
727 aspect(&priv->dstwidth, &priv->dstheight, A_ZOOM); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
728 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
729 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
730 /* try to change to given fullscreenmode */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
731 newsurface = SDL_SetVideoMode(priv->dstwidth, screen_surface_h, priv->bpp, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
732 priv->sdlfullflags); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
733 |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
734 /* if creation of new surface was successfull, save it and hide mouse cursor */ |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
735 if(newsurface) { |
1126 | 736 if (priv->surface) |
737 SDL_FreeSurface(priv->surface); | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
738 priv->surface = newsurface; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
739 SDL_ShowCursor(0); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
740 SDL_SRF_LOCK(priv->surface, -1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
741 SDL_FillRect(priv->surface, NULL, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
742 SDL_SRF_UNLOCK(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
743 setup_surfaces(); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
744 } |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
745 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
746 printf("set_fullmode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
747 } |
1126 | 748 |
1 | 749 |
750 /** | |
751 * Initialize an SDL surface and an SDL YUV overlay. | |
752 * | |
753 * params : width == width of video we'll be displaying. | |
754 * height == height of video we'll be displaying. | |
755 * fullscreen == want to be fullscreen? | |
756 * title == Title for window titlebar. | |
757 * returns : non-zero on success, zero on error. | |
758 **/ | |
759 | |
760 static uint32_t | |
4433 | 761 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) |
1 | 762 //static int sdl_setup (int width, int height) |
763 { | |
764 struct sdl_priv_s *priv = &sdl_priv; | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
765 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
766 static Display *XDisplay; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
767 static int XScreen; |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
768 #endif |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
769 |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
770 switch(format){ |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
771 case IMGFMT_I420: |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
772 printf("SDL: Mapping I420 to IYUV\n"); |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
773 format = SDL_IYUV_OVERLAY; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
774 case IMGFMT_YV12: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
775 case IMGFMT_IYUV: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
776 case IMGFMT_YUY2: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
777 case IMGFMT_UYVY: |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
778 case IMGFMT_YVYU: |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
779 priv->mode = YUV; |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
780 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
|
781 case IMGFMT_BGR15: |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
782 case IMGFMT_BGR16: |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
783 case IMGFMT_BGR24: |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
784 case IMGFMT_BGR32: |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
785 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
|
786 break; |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
787 case IMGFMT_RGB15: |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
788 case IMGFMT_RGB16: |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
789 case IMGFMT_RGB24: |
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
|
790 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
|
791 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
|
792 break; |
451
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
793 default: |
542
7eaec864e3d2
doesn't include fastmemcpy.h when SDL_NOXV is defined.
atmosfear
parents:
475
diff
changeset
|
794 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
|
795 return -1; |
e27a365b0303
fixes osd/subtitle for UYVY image format and steps back to 1.15 changes
atmosfear
parents:
448
diff
changeset
|
796 } |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
797 |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
798 if(verbose) printf("SDL: Using 0x%X (%s) image format\n", format, |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
799 vo_format_name(format)); |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
800 |
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
801 if(priv->mode != YUV) { |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
802 priv->sdlflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
803 priv->sdlfullflags |= SDL_ANYFORMAT; |
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
804 } |
1 | 805 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
806 /* SDL can only scale YUV data */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
807 if(priv->mode == RGB || priv->mode == BGR) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
808 d_width = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
809 d_height = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
810 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
811 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
812 aspect_save_orig(width,height); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
813 aspect_save_prescale(d_width ? d_width : width, d_height ? d_height : height); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
814 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
815 /* Save the original Image size */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
816 priv->X = 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
817 priv->width = width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
818 priv->height = height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
819 priv->dstwidth = d_width ? d_width : width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
820 priv->dstheight = d_height ? d_height : height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
821 |
5239
fe6b890f68f2
Fix crash when playing multiple files. The bug was triggered when the first file
ksorim
parents:
5238
diff
changeset
|
822 priv->format = format; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
823 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
824 #ifdef HAVE_X11 |
5267
e5f57c576c48
Fixes crash which occured when it wasn't possible to connect to the display
ksorim
parents:
5260
diff
changeset
|
825 XDisplay = XOpenDisplay(NULL); |
e5f57c576c48
Fixes crash which occured when it wasn't possible to connect to the display
ksorim
parents:
5260
diff
changeset
|
826 if(XDisplay) { |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
827 if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
828 XScreen = DefaultScreen(XDisplay); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
829 priv->XWidth = DisplayWidth(XDisplay, XScreen); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
830 priv->XHeight = DisplayHeight(XDisplay, XScreen); |
951 | 831 priv->X = 1; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
832 if(verbose) printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
833 saver_off(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
834 XCloseDisplay(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
835 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
836 #endif |
1080 | 837 if (sdl_open(NULL, NULL) != 0) |
838 return -1; | |
1 | 839 |
351 | 840 /* Set output window title */ |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
841 SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
842 //SDL_WM_SetCaption (title, title); |
351 | 843 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
844 if(priv->X) { |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
845 aspect_save_screenres(priv->XWidth,priv->XHeight); |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
846 aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
847 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
848 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
849 priv->windowsize.w = priv->dstwidth; |
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
850 priv->windowsize.h = priv->dstheight; |
1 | 851 |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
852 /* bit 0 (0x01) means fullscreen (-fs) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
853 * bit 1 (0x02) means mode switching (-vm) |
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
854 * bit 2 (0x04) enables software scaling (-zoom) |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
855 * bit 3 (0x08) enables flipping (-flip) |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
856 */ |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
857 // printf("SDL: flags are set to: %i\n", flags); |
355
70833462dee9
- added code to comply with new fullscreen meaning
atmosfear
parents:
354
diff
changeset
|
858 // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
859 if(flags&FLIP) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
860 if(verbose) printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
861 priv->flip = 1; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
862 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
863 if(flags&FS) { |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
864 if(verbose) printf("SDL: setting zoomed fullscreen without modeswitching\n"); |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
865 printf("SDL: Info - please use -vm or -zoom to switch to best resolution.\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
866 priv->fulltype = FS; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
867 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
868 /*if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags))) |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
869 SDL_ShowCursor(0);*/ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
870 } else |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
871 if(flags&VM) { |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
872 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
873 priv->fulltype = VM; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
874 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
875 /*if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags))) |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
876 SDL_ShowCursor(0);*/ |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
877 } else |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
878 if(flags&ZOOM) { |
543
ee0010d0ca81
Changed some code so it only kicks in when XV is disable.
atmosfear
parents:
542
diff
changeset
|
879 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
880 priv->fulltype = ZOOM; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
881 set_fullmode(priv->fullmode); |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
882 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
883 else { |
4925 | 884 if((strcmp(priv->driver, "x11") == 0) |
885 ||(strcmp(priv->driver, "windib") == 0) | |
886 ||(strcmp(priv->driver, "directx") == 0) | |
887 ||((strcmp(priv->driver, "aalib") == 0) | |
888 && priv->X)) { | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
889 if(verbose) printf("SDL: setting windowed mode\n"); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
890 set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
891 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
892 else { |
951 | 893 if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); |
894 priv->fulltype = ZOOM; | |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
895 set_fullmode(priv->fullmode); |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
896 } |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
897 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
898 |
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
|
899 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
|
900 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
|
901 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
|
902 } |
1 | 903 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
904 return 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
905 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
906 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
907 /* Free priv->rgbsurface or priv->overlay if they are != NULL. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
908 * Setup priv->rgbsurface or priv->overlay depending on source format. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
909 * The size of the created surface or overlay depends on the size of |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
910 * priv->surface, priv->width, priv->height, priv->dstwidth and priv->dstheight. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
911 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
912 static int setup_surfaces(void) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
913 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
914 struct sdl_priv_s *priv = &sdl_priv; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
915 float v_scale = ((float) priv->dstheight) / priv->height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
916 int surfwidth, surfheight; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
917 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
918 surfwidth = priv->width; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
919 surfheight = priv->height + (priv->surface->h - priv->dstheight) / v_scale; |
5358 | 920 surfheight&= ~1; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
921 /* Place the image in the middle of the screen */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
922 priv->y = (surfheight - priv->height) / 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
923 priv->y_screen_top = priv->y * v_scale; |
5313 | 924 priv->y_screen_bottom = priv->y_screen_top + priv->dstheight; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
925 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
926 priv->dirty_off_frame[0].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
927 priv->dirty_off_frame[0].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
928 priv->dirty_off_frame[1].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
929 priv->dirty_off_frame[1].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
930 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
931 /* Make sure the entire screen is updated */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
932 vo_osd_changed(1); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
933 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
934 if(priv->rgbsurface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
935 SDL_FreeSurface(priv->rgbsurface); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
936 else if(priv->overlay) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
937 SDL_FreeYUVOverlay(priv->overlay); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
938 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
939 priv->rgbsurface = NULL; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
940 priv->overlay = NULL; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
941 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
942 if(priv->mode != YUV && (priv->format&0xFF) == priv->bpp) { |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
943 if(strcmp(priv->driver, "x11") == 0) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
944 priv->dblit = 1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
945 priv->framePlaneRGB = priv->width * priv->height * priv->surface->format->BytesPerPixel; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
946 priv->stridePlaneRGB = priv->width * priv->surface->format->BytesPerPixel; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
947 erase_rectangle(0, 0, priv->surface->w, priv->surface->h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
948 return 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
949 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
950 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
951 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
952 switch(priv->format) { |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
953 /* 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
|
954 //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
|
955 // 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
|
956 // 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
|
957 // 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
|
958 // 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
|
959 // 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
|
960 // 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
|
961 case IMGFMT_RGB15: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
962 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31, 992, 31744, 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
|
963 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
|
964 case IMGFMT_BGR15: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
965 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31744, 992, 31, 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
|
966 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
|
967 case IMGFMT_RGB16: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
968 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 31, 2016, 63488, 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
|
969 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
|
970 case IMGFMT_BGR16: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
971 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 63488, 2016, 31, 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
|
972 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
|
973 case IMGFMT_RGB24: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
974 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0x0000FF, 0x00FF00, 0xFF0000, 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
|
975 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
|
976 case IMGFMT_BGR24: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
977 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0xFF0000, 0x00FF00, 0x0000FF, 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
|
978 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
|
979 case IMGFMT_RGB32: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
980 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0/*0xFF000000*/); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
981 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
|
982 case IMGFMT_BGR32: |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
983 priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/); |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
984 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
|
985 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
|
986 /* Initialize and create the YUV Overlay used for video out */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
987 if (!(priv->overlay = SDL_CreateYUVOverlay (surfwidth, surfheight, priv->format, priv->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
|
988 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
|
989 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
|
990 } |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
991 priv->framePlaneY = priv->width * priv->height; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
992 priv->framePlaneUV = (priv->width * priv->height) >> 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
993 priv->framePlaneYUY = priv->width * priv->height * 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
994 priv->stridePlaneY = priv->width; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
995 priv->stridePlaneUV = priv->width/2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
996 priv->stridePlaneYUY = priv->width * 2; |
1 | 997 } |
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
|
998 |
5238
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
999 if(priv->mode != YUV) { |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1000 if(!priv->rgbsurface) { |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1001 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1002 return -1; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1003 } |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1004 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1005 priv->dblit = 0; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1006 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1007 if((priv->format&0xFF) != priv->bpp) |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1008 printf("SDL: using depth/colorspace conversion, this will slow things" |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1009 "down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp); |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1010 |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1011 priv->framePlaneRGB = priv->width * priv->height * priv->rgbsurface->format->BytesPerPixel; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1012 priv->stridePlaneRGB = priv->width * priv->rgbsurface->format->BytesPerPixel; |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1013 } |
182fc3f585e8
Fix crash when SDL had to do rgb -> rgb conversion. Removed some code
ksorim
parents:
5058
diff
changeset
|
1014 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1015 erase_rectangle(0, 0, surfwidth, surfheight); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1016 |
1 | 1017 return 0; |
1018 } | |
1019 | |
1020 | |
1021 /** | |
1022 * Draw a frame to the SDL YUV overlay. | |
1023 * | |
1024 * params : *src[] == the Y, U, and V planes that make up the frame. | |
1025 * returns : non-zero on success, zero on error. | |
1026 **/ | |
1027 | |
1028 //static int sdl_draw_frame (frame_t *frame) | |
1029 static uint32_t draw_frame(uint8_t *src[]) | |
1030 { | |
1031 struct sdl_priv_s *priv = &sdl_priv; | |
1032 uint8_t *dst; | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1033 int i; |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1034 uint8_t *mysrc = src[0]; |
2071
7f27b212e07b
Add debug printfs to aspect(), add aspect() usage to vo_sdl.
atmos4
parents:
1710
diff
changeset
|
1035 |
5313 | 1036 switch(priv->format){ |
1 | 1037 case IMGFMT_YUY2: |
408 | 1038 case IMGFMT_UYVY: |
1039 case IMGFMT_YVYU: | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1040 SDL_OVR_LOCK(-1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1041 dst = (uint8_t *) *(priv->overlay->pixels) + priv->overlay->pitches[0]*priv->y; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1042 if(priv->flip) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1043 mysrc+=priv->framePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1044 for(i = 0; i < priv->height; i++) { |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1045 mysrc-=priv->stridePlaneYUY; |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1046 memcpy (dst, mysrc, priv->stridePlaneYUY); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1047 dst+=priv->overlay->pitches[0]; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1048 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1049 } |
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1050 else memcpy (dst, src[0], priv->framePlaneYUY); |
1197 | 1051 SDL_OVR_UNLOCK |
1 | 1052 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
|
1053 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1054 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
|
1055 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
|
1056 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
|
1057 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
|
1058 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
|
1059 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
|
1060 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
|
1061 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
1062 if(priv->dblit) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1063 SDL_SRF_LOCK(priv->surface, -1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1064 dst = (uint8_t *) priv->surface->pixels + priv->y*priv->surface->pitch; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1065 |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1066 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1067 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1068 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1069 mysrc-=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1070 memcpy (dst, mysrc, priv->stridePlaneRGB); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1071 dst += priv->surface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1072 } |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
1073 } |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1074 else memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 1075 SDL_SRF_UNLOCK(priv->surface) |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1076 } else { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1077 SDL_SRF_LOCK(priv->rgbsurface, -1) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1078 dst = (uint8_t *) priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1079 if(priv->flip) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1080 mysrc+=priv->framePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1081 for(i = 0; i < priv->height; i++) { |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1082 mysrc-=priv->stridePlaneRGB; |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1083 memcpy (dst, mysrc, priv->stridePlaneRGB); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1084 dst += priv->rgbsurface->pitch; |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1085 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1086 } |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1087 else memcpy (dst, src[0], priv->framePlaneRGB); |
1197 | 1088 SDL_SRF_UNLOCK(priv->rgbsurface) |
823
e09c92ca4c45
Added ability to use direct surface blitting for BGR modes.
atmosfear
parents:
784
diff
changeset
|
1089 } |
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
|
1090 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
|
1091 |
1 | 1092 } |
1093 | |
1094 return 0; | |
1095 } | |
1096 | |
1097 | |
1098 /** | |
1099 * Draw a slice (16 rows of image) to the SDL YUV overlay. | |
1100 * | |
1101 * params : *src[] == the Y, U, and V planes that make up the slice. | |
1102 * returns : non-zero on error, zero on success. | |
1103 **/ | |
1104 | |
1105 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num) | |
1106 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
1107 { | |
1108 struct sdl_priv_s *priv = &sdl_priv; | |
1109 uint8_t *dst; | |
1110 uint8_t *src; | |
1111 int i; | |
1112 | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1113 SDL_OVR_LOCK(-1) |
1 | 1114 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1115 y += priv->y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1116 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1117 dst = priv->overlay->pixels[0] + priv->overlay->pitches[0]*y + x; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1118 |
1 | 1119 src = image[0]; |
1120 for(i=0;i<h;i++){ | |
1121 memcpy(dst,src,w); | |
1122 src+=stride[0]; | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1123 dst += priv->overlay->pitches[0]; |
1 | 1124 } |
1125 | |
1126 x/=2;y/=2;w/=2;h/=2; | |
1127 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1128 switch(priv->format) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1129 case IMGFMT_YV12: |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1130 dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1131 src = image[1]; |
1 | 1132 for(i=0;i<h;i++){ |
1133 memcpy(dst,src,w); | |
1134 src+=stride[2]; | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1135 dst += priv->overlay->pitches[2]; |
1 | 1136 } |
1137 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1138 dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1139 src = image[2]; |
1 | 1140 for(i=0;i<h;i++){ |
1141 memcpy(dst,src,w); | |
1142 src+=stride[1]; | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1143 dst += priv->overlay->pitches[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1144 } |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1145 break; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1146 case IMGFMT_IYUV: |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1147 dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1148 src = image[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1149 for(i=0;i<h;i++){ |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1150 memcpy(dst,src,w); |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1151 src+=stride[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1152 dst += priv->overlay->pitches[1]; |
1 | 1153 } |
1154 | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1155 dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1156 src = image[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1157 for(i=0;i<h;i++){ |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1158 memcpy(dst,src,w); |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1159 src+=stride[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1160 dst += priv->overlay->pitches[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1161 } |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1162 |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1163 break; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1164 default: |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1165 printf("SDL: unsupported image format in draw_slice, contact MPlayer developers!\n"); |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1166 } |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1167 |
1197 | 1168 SDL_OVR_UNLOCK |
1 | 1169 |
1170 return 0; | |
1171 } | |
1172 | |
1173 | |
1174 | |
1175 /** | |
1176 * Checks for SDL keypress and window resize events | |
1177 * | |
1178 * params : none | |
1179 * returns : doesn't return | |
1180 **/ | |
1181 | |
1182 #include "../linux/keycodes.h" | |
1183 extern void mplayer_put_key(int code); | |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1184 |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1185 #define shift_key (event.key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) |
1 | 1186 static void check_events (void) |
1187 { | |
1188 struct sdl_priv_s *priv = &sdl_priv; | |
1189 SDL_Event event; | |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1190 SDLKey keypressed = 0; |
4590
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1191 static int firstcheck = 0, modifiers = 0; |
1 | 1192 |
1193 /* Poll the waiting SDL Events */ | |
1194 while ( SDL_PollEvent(&event) ) { | |
1195 switch (event.type) { | |
1196 | |
1197 /* capture window resize events */ | |
1198 case SDL_VIDEORESIZE: | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1199 if(!priv->dblit) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1200 set_video_mode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags); |
1 | 1201 |
1202 /* save video extents, to restore them after going fullscreen */ | |
1203 //if(!(priv->surface->flags & SDL_FULLSCREEN)) { | |
1204 priv->windowsize.w = priv->surface->w; | |
1205 priv->windowsize.h = priv->surface->h; | |
1206 //} | |
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
|
1207 if(verbose > 2) printf("SDL: Window resize\n"); |
1 | 1208 break; |
1209 | |
4590
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1210 case SDL_MOUSEBUTTONDOWN: |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1211 #ifdef HAVE_NEW_INPUT |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1212 if(event.button.button == 4 || event.button.button == 5) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1213 mplayer_put_key(MOUSE_BASE+event.button.button-1); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1214 else |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1215 mplayer_put_key((MOUSE_BASE+event.button.button-1) | MP_KEY_DOWN); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1216 #else |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1217 switch(event.button.button) { |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1218 case 1: modifiers |= 1; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1219 case 2: modifiers |= 2; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1220 case 3: modifiers |= 4; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1221 case 4: /* wheel up */ |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1222 if ((modifiers & 1)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1223 mplayer_put_key(KEY_LEFT); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1224 else if ((modifiers & 2)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1225 mplayer_put_key('/'); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1226 else if ((modifiers & 4)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1227 mplayer_put_key(KEY_PAGE_DOWN); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1228 else |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1229 mplayer_put_key(KEY_DOWN); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1230 break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1231 case 5: /* wheel down */ |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1232 if ((modifiers & 1)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1233 mplayer_put_key(KEY_RIGHT); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1234 else if ((modifiers & 2)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1235 mplayer_put_key('*'); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1236 else if ((modifiers & 4)) |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1237 mplayer_put_key(KEY_PAGE_UP); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1238 else |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1239 mplayer_put_key(KEY_UP); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1240 break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1241 } |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1242 #endif |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1243 break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1244 |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1245 case SDL_MOUSEBUTTONUP: |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1246 #ifdef HAVE_NEW_INPUT |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1247 mplayer_put_key(MOUSE_BASE+event.button.button-1); |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1248 #else |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1249 switch(event.button.button) { |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1250 case 1: modifiers &= ~1; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1251 case 2: modifiers &= ~2; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1252 case 3: modifiers &= ~4; break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1253 } |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1254 #endif |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1255 break; |
3a76a4dcde2c
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
albeu
parents:
4530
diff
changeset
|
1256 |
1 | 1257 /* graphics mode selection shortcuts */ |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1258 #ifdef BUGGY_SDL |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1259 case SDL_KEYDOWN: |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1260 switch(event.key.keysym.sym) { |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1261 case SDLK_UP: mplayer_put_key(KEY_UP); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1262 case SDLK_DOWN: mplayer_put_key(KEY_DOWN); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1263 case SDLK_LEFT: mplayer_put_key(KEY_LEFT); break; |
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1264 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT); break; |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1265 case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1266 case SDLK_GREATER: mplayer_put_key('>'); break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1267 case SDLK_ASTERISK: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1268 case SDLK_KP_MULTIPLY: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1269 case SDLK_SLASH: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1270 case SDLK_KP_DIVIDE: |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1271 default: break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1272 } |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1273 break; |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1274 case SDL_KEYUP: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1275 #else |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1276 case SDL_KEYDOWN: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1277 #endif |
1 | 1278 keypressed = event.key.keysym.sym; |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1279 if(verbose > 1) printf("SDL: Key pressed: '%i'\n", keypressed); |
265
1d02e6f7c63a
Only small change to allow pausing of movie (p or SPACE).
atmosfear
parents:
97
diff
changeset
|
1280 |
357 | 1281 /* 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
|
1282 if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) { |
1 | 1283 /* select next fullscreen mode */ |
1284 priv->fullmode++; | |
1285 if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0; | |
1286 set_fullmode(priv->fullmode); | |
1287 | |
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
|
1288 if(verbose > 1) printf("SDL: Set next available fullscreen mode.\n"); |
1 | 1289 } |
1290 | |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1291 else if ( keypressed == SDLK_n ) { |
2182 | 1292 #ifdef HAVE_X11 |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1293 aspect(&priv->dstwidth, &priv->dstheight,A_NOZOOM); |
2182 | 1294 #endif |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1295 if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1296 set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1297 priv->windowsize.w = priv->surface->w; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1298 priv->windowsize.h = priv->surface->h; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1299 if(verbose > 1) printf("SDL: Normal size\n"); |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1300 } else |
2249
48f0ac1e9d13
Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents:
2182
diff
changeset
|
1301 if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) { |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1302 set_video_mode(priv->dstwidth * 2, priv->dstheight * 2, priv->bpp, priv->sdlflags); |
1396
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1303 priv->windowsize.w = priv->surface->w; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1304 priv->windowsize.h = priv->surface->h; |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1305 if(verbose > 1) printf("SDL: Double size\n"); |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1306 } |
3c7f13cb0a8a
Added double/normal resize patch by Wojtek Kaniewski <wojtekka at bydg.pdi.net>
atmos4
parents:
1238
diff
changeset
|
1307 } |
1509
f9beae70c5c2
Removed D key for doublesize, already clobbered by framedrop.
atmos4
parents:
1501
diff
changeset
|
1308 |
1 | 1309 else switch(keypressed){ |
331
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1310 case SDLK_RETURN: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1311 if (!firstcheck) { firstcheck = 1; break; } |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1312 case SDLK_ESCAPE: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1313 case SDLK_q: |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1314 SDL_ShowCursor(1); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1315 mplayer_put_key('q'); |
0f1737e626fa
- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat
atmosfear
parents:
265
diff
changeset
|
1316 break; |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1317 /*case SDLK_o: mplayer_put_key('o');break; |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1318 case SDLK_SPACE: mplayer_put_key(' ');break; |
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1319 case SDLK_p: mplayer_put_key('p');break;*/ |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1320 case SDLK_7: mplayer_put_key(shift_key?'/':'7'); |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1321 case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+'); |
1 | 1322 case SDLK_KP_PLUS: mplayer_put_key('+');break; |
1323 case SDLK_MINUS: | |
575
3fde7340afd5
Reincluded fastmemcpy.h and added some keybindings for mixer.
atmosfear
parents:
543
diff
changeset
|
1324 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
|
1325 case SDLK_TAB: mplayer_put_key('\t');break; |
653 | 1326 case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; |
1327 case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1328 #ifdef BUGGY_SDL |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1329 case SDLK_UP: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1330 case SDLK_DOWN: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1331 case SDLK_LEFT: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1332 case SDLK_RIGHT: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1333 case SDLK_ASTERISK: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1334 case SDLK_KP_MULTIPLY: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1335 case SDLK_SLASH: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1336 case SDLK_KP_DIVIDE: |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1337 break; |
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1338 #else |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1339 case SDLK_UP: mplayer_put_key(KEY_UP);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1340 case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1341 case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; |
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1342 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1343 case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; |
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1344 case SDLK_GREATER: mplayer_put_key('>'); break; |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1345 case SDLK_ASTERISK: |
5834 | 1346 case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; |
703
fcc01494c0fe
Fixed keyboard input handling and slowed down keyrepeat interval.
atmosfear
parents:
653
diff
changeset
|
1347 case SDLK_SLASH: |
5834 | 1348 case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; |
705
27d351f251eb
Added workaround for buggy SDL versions (before 1.2.1).
atmosfear
parents:
703
diff
changeset
|
1349 #endif |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1350 default: |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1351 //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); |
475
904d1cfda2dd
changed keyboard input handling to pass key through to mplayer if not special to sdl
atmosfear
parents:
451
diff
changeset
|
1352 mplayer_put_key(keypressed); |
1 | 1353 } |
1354 | |
1355 break; | |
1710 | 1356 case SDL_QUIT: |
1357 SDL_ShowCursor(1); | |
1358 mplayer_put_key('q'); | |
1359 break; | |
1 | 1360 } |
1361 } | |
1362 } | |
4530
22a4c7957f03
Add playlist keys (some missing?!) and add some shift handlers to allow keys to work with german keyboards.
atmos4
parents:
4528
diff
changeset
|
1363 #undef shift_key |
1 | 1364 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1365 /* Erase (paint it black) the rectangle specified by x, y, w and h in the surface |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1366 or overlay which is used for OSD |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1367 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1368 static void erase_rectangle(int x, int y, int w, int h) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1369 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1370 struct sdl_priv_s *priv = &sdl_priv; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1371 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1372 switch(priv->format) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1373 case IMGFMT_YV12: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1374 case IMGFMT_I420: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1375 case IMGFMT_IYUV: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1376 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1377 SDL_OVR_LOCK((void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1378 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1379 /* Erase Y plane */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1380 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1381 priv->overlay->pitches[0], 0, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1382 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1383 priv->overlay->pitches[0]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1384 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1385 /* Erase U and V planes */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1386 w /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1387 x /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1388 h /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1389 y /= 2; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1390 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1391 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1392 priv->overlay->pitches[1], 128, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1393 priv->overlay->pixels[1] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1394 priv->overlay->pitches[1]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1395 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1396 erase_area_1(x, w, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1397 priv->overlay->pitches[2], 128, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1398 priv->overlay->pixels[2] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1399 priv->overlay->pitches[2]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1400 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1401 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1402 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1403 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1404 case IMGFMT_YUY2: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1405 case IMGFMT_YVYU: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1406 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1407 /* yuy2 and yvyu represent black the same way */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1408 uint8_t yuy2_black[] = {0, 128, 0, 128}; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1409 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1410 SDL_OVR_LOCK((void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1411 erase_area_4(x*2, w*2, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1412 priv->overlay->pitches[0], |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1413 *((uint32_t*) yuy2_black), |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1414 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1415 priv->overlay->pitches[0]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1416 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1417 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1418 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1419 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1420 case IMGFMT_UYVY: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1421 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1422 uint8_t uyvy_black[] = {128, 0, 128, 0}; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1423 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1424 SDL_OVR_LOCK((void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1425 erase_area_4(x*2, w*2, h, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1426 priv->overlay->pitches[0], |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1427 *((uint32_t*) uyvy_black), |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1428 priv->overlay->pixels[0] + |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1429 priv->overlay->pitches[0]*y); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1430 SDL_OVR_UNLOCK |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1431 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1432 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1433 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1434 case IMGFMT_RGB15: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1435 case IMGFMT_BGR15: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1436 case IMGFMT_RGB16: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1437 case IMGFMT_BGR16: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1438 case IMGFMT_RGB24: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1439 case IMGFMT_BGR24: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1440 case IMGFMT_RGB32: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1441 case IMGFMT_BGR32: |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1442 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1443 SDL_Rect rect; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1444 rect.w = w; rect.h = h; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1445 rect.x = x; rect.y = y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1446 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1447 if(priv->dblit) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1448 SDL_SRF_LOCK(priv->surface, (void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1449 SDL_FillRect(priv->surface, &rect, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1450 SDL_SRF_UNLOCK(priv->surface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1451 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1452 else { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1453 SDL_SRF_LOCK(priv->rgbsurface, (void) 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1454 SDL_FillRect(priv->rgbsurface, &rect, 0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1455 SDL_SRF_UNLOCK(priv->rgbsurface) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1456 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1457 break; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1458 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1459 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1460 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1461 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1462 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1463 { struct sdl_priv_s *priv = &sdl_priv; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1464 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1465 priv->osd_has_changed = vo_osd_changed(0); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1466 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1467 if(priv->osd_has_changed) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1468 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1469 int i; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1470 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1471 for(i = 0; i < 2; i++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1472 if(priv->dirty_off_frame[i].x < 0 || priv->dirty_off_frame[i].y < 0) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1473 continue; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1474 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1475 erase_rectangle(priv->dirty_off_frame[i].x, priv->dirty_off_frame[i].y, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1476 priv->dirty_off_frame[i].w, priv->dirty_off_frame[i].h); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1477 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1478 priv->dirty_off_frame[i].x = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1479 priv->dirty_off_frame[i].y = -1; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1480 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1481 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1482 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1483 /* update osd/subtitles */ |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1484 if(priv->mode == YUV) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1485 vo_draw_text(priv->overlay->w, priv->overlay->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1486 else { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1487 if(priv->dblit) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1488 vo_draw_text(priv->surface->w, priv->surface->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1489 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1490 vo_draw_text(priv->rgbsurface->w, priv->rgbsurface->h, draw_alpha); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1491 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1492 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1493 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1494 /* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch' |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1495 * are given in bytes. 4 bytes at a time. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1496 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1497 static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1498 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1499 int x_end = x_start/4 + width/4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1500 int x, y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1501 uint32_t* data = (uint32_t*) pixels; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1502 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1503 x_start /= 4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1504 pitch /= 4; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1505 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1506 for(y = 0; y < height; y++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1507 for(x = x_start; x < x_end; x++) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1508 data[y*pitch + x] = color; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1509 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1510 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1511 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1512 /* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch' |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1513 * are given in bytes. 1 byte at a time. |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1514 */ |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1515 static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1516 { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1517 int y; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1518 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1519 for(y = 0; y < height; y++) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1520 memset(&pixels[y*pitch + x_start], color, width); |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1521 } |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1522 } |
1 | 1523 |
1524 /** | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1396
diff
changeset
|
1525 * Display the surface we have written our data to |
1 | 1526 * |
1527 * params : mode == index of the desired fullscreen mode | |
1528 * returns : doesn't return | |
1529 **/ | |
1530 | |
1531 static void flip_page (void) | |
1532 { | |
1533 struct sdl_priv_s *priv = &sdl_priv; | |
1534 | |
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
|
1535 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
|
1536 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
|
1537 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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 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
|
1543 case IMGFMT_BGR32: |
1219
e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
atmos4
parents:
1197
diff
changeset
|
1544 if(!priv->dblit) { |
1194
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1545 /* blit to the RGB surface */ |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1546 if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL)) |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1547 printf("SDL: Blit failed: %s\n", SDL_GetError()); |
40550e1458e8
Drastic! speedup of rgb code. Removed nonsens memhole fixes.
atmosfear
parents:
1188
diff
changeset
|
1548 } |
1 | 1549 |
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
|
1550 /* update screen */ |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1551 //SDL_UpdateRect(priv->surface, 0, 0, priv->surface->clip_rect.w, priv->surface->clip_rect.h); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1552 if(priv->osd_has_changed) { |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1553 priv->osd_has_changed = 0; |
784
dee122f9cdb9
Added full aspect awareness, rewrote fullscreen handling.
atmosfear
parents:
772
diff
changeset
|
1554 SDL_UpdateRects(priv->surface, 1, &priv->surface->clip_rect); |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1555 } |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1556 else |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1557 SDL_UpdateRect(priv->surface, 0, priv->y_screen_top, |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1558 priv->surface->clip_rect.w, priv->y_screen_bottom); |
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
|
1559 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1560 /* 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
|
1561 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
|
1562 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
|
1563 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1564 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
|
1565 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
|
1566 /* 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
|
1567 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
|
1568 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1569 /* 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
|
1570 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
|
1571 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
|
1572 |
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1573 //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
|
1574 } |
1 | 1575 } |
1576 | |
1577 static uint32_t | |
1578 query_format(uint32_t format) | |
1579 { | |
1580 switch(format){ | |
1581 case IMGFMT_YV12: | |
408 | 1582 case IMGFMT_I420: |
1583 case IMGFMT_IYUV: | |
1 | 1584 case IMGFMT_YUY2: |
408 | 1585 case IMGFMT_UYVY: |
1586 case IMGFMT_YVYU: | |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1587 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | |
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1588 VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
635
b9735f811d7d
15,16,24,32Bit rgb/bgr support added, aalib fixed, performance optimizations, code cleanup and so much more...
atmosfear
parents:
616
diff
changeset
|
1589 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
|
1590 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
|
1591 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
|
1592 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
|
1593 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
|
1594 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
|
1595 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
|
1596 case IMGFMT_BGR32: |
5894
af9efcb80244
Use new style query_formats flags. Fixes bug with flip.
ksorim
parents:
5834
diff
changeset
|
1597 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_FLIP; |
1 | 1598 } |
1599 return 0; | |
1600 } | |
1601 | |
1602 static const vo_info_t* | |
1603 get_info(void) | |
1604 { | |
1605 return &vo_info; | |
1606 } | |
1607 | |
1608 | |
1609 static void | |
1610 uninit(void) | |
1611 { | |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1612 #ifdef HAVE_X11 |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1613 static Display *XDisplay; |
5267
e5f57c576c48
Fixes crash which occured when it wasn't possible to connect to the display
ksorim
parents:
5260
diff
changeset
|
1614 XDisplay = XOpenDisplay(NULL); |
e5f57c576c48
Fixes crash which occured when it wasn't possible to connect to the display
ksorim
parents:
5260
diff
changeset
|
1615 if(XDisplay) { |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1616 if(verbose) printf("SDL: activating XScreensaver/DPMS\n"); |
5267
e5f57c576c48
Fixes crash which occured when it wasn't possible to connect to the display
ksorim
parents:
5260
diff
changeset
|
1617 |
772
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1618 saver_on(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1619 XCloseDisplay(XDisplay); |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1620 } |
e70a52f17f92
Added flipped video support and activate/deactivate screensaver under X.
atmosfear
parents:
770
diff
changeset
|
1621 #endif |
1122
fe9ef743be91
fixed my previousily added bug: ifdef buggy_sdl: keypressed: default case
al3x
parents:
1110
diff
changeset
|
1622 sdl_close(); |
1 | 1623 } |
4352 | 1624 |
1625 static uint32_t preinit(const char *arg) | |
1626 { | |
5240 | 1627 struct sdl_priv_s *priv = &sdl_priv; |
1628 | |
1629 priv->rgbsurface = NULL; | |
1630 priv->overlay = NULL; | |
1631 priv->surface = NULL; | |
1632 | |
1633 return 0; | |
4352 | 1634 } |
1635 | |
5058 | 1636 static uint32_t get_image(mp_image_t *mpi) |
1637 { | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1638 struct sdl_priv_s *priv = &sdl_priv; |
5058 | 1639 |
1640 if(priv->format != mpi->imgfmt) return VO_FALSE; | |
1641 if(mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) { | |
5460
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1642 if(mpi->flags&MP_IMGFLAG_PLANAR) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1643 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1644 mpi->stride[0] = priv->overlay->pitches[0]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1645 if(mpi->flags&MP_IMGFLAG_SWAPPED) { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1646 mpi->planes[1] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1647 mpi->stride[1] = priv->overlay->pitches[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1648 mpi->planes[2] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1649 mpi->stride[2] = priv->overlay->pitches[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1650 } else { |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1651 mpi->planes[2] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1652 mpi->stride[2] = priv->overlay->pitches[1]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1653 mpi->planes[1] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1654 mpi->stride[1] = priv->overlay->pitches[2]; |
acf7acfa7acc
Fix I420 handling, though still don't know why divx4 codec queries for I420 not YUY2!
atmos4
parents:
5385
diff
changeset
|
1655 } |
5058 | 1656 } |
1657 else if(IMGFMT_IS_RGB(priv->format) || IMGFMT_IS_BGR(priv->format)) { | |
1658 if(priv->dblit) { | |
1659 if(mpi->type == MP_IMGTYPE_STATIC && (priv->surface->flags & SDL_DOUBLEBUF)) | |
1660 return VO_FALSE; | |
1661 | |
1662 mpi->planes[0] = priv->surface->pixels + priv->y*priv->surface->pitch; | |
1663 mpi->stride[0] = priv->surface->pitch; | |
1664 } | |
1665 else { | |
1666 mpi->planes[0] = priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch; | |
1667 mpi->stride[0] = priv->rgbsurface->pitch; | |
1668 } | |
1669 } | |
1670 else { | |
1671 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; | |
1672 mpi->stride[0] = priv->overlay->pitches[0]; | |
1673 } | |
1674 | |
1675 mpi->flags|=MP_IMGFLAG_DIRECT; | |
1676 return VO_TRUE; | |
1677 } | |
1678 | |
1679 return VO_FALSE; | |
1680 } | |
1681 | |
4596 | 1682 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 1683 { |
4772 | 1684 struct sdl_priv_s *priv = &sdl_priv; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1685 switch (request) { |
5058 | 1686 case VOCTRL_GET_IMAGE: |
1687 return get_image(data); | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1688 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1689 return query_format(*((uint32_t*)data)); |
4772 | 1690 case VOCTRL_FULLSCREEN: |
1691 if (priv->surface->flags & SDL_FULLSCREEN) { | |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4790
diff
changeset
|
1692 set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); |
4772 | 1693 SDL_ShowCursor(1); |
1694 if(verbose > 1) printf("SDL: Windowed mode\n"); | |
1695 } else if (priv->fullmodes) { | |
1696 set_fullmode(priv->fullmode); | |
1697 if(verbose > 1) printf("SDL: Set fullscreen mode\n"); | |
1698 } | |
4790 | 1699 return VO_TRUE; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1700 } |
4772 | 1701 |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4590
diff
changeset
|
1702 return VO_NOTIMPL; |
4352 | 1703 } |