annotate libvo/vo_sdl.c @ 4601:8cda24d7f074

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