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