annotate libvo/vo_sdl.c @ 259:3ad72b5ee016

fbdev dependency fix
author szabii
date Fri, 30 Mar 2001 10:16:54 +0000
parents cab74dfde6dd
children 1d02e6f7c63a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * video_out_sdl.c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * Copyright (C) Ryan C. Gordon <icculus@lokigames.com> - April 22, 2000.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 * A mpeg2dec display driver that does output through the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Simple DirectMedia Layer (SDL) library. This effectively gives us all
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * sorts of output options: X11, SVGAlib, fbcon, AAlib, GGI. Win32, MacOS
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * and BeOS support, too. Yay. SDL info, source, and binaries can be found
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * at http://slouken.devolution.com/SDL/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * the Free Software Foundation; either version 2, or (at your option)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 * along with GNU Make; see the file COPYING. If not, write to
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 * the Free Software Foundation,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 * Changes:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 * Dominik Schnitzer <dominik@schnitzer.at> - November 08, 2000.
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
30 * - Added resizing support, fullscreen: changed the sdlmodes selection
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 * routine.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 * - SDL bugfixes: removed the atexit(SLD_Quit), SDL_Quit now resides in
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 * the plugin_exit routine.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 * - Commented the source :)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 * - Shortcuts: for switching between Fullscreen/Windowed mode and for
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 * cycling between the different Fullscreen modes.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 * - Small bugfixes: proper width/height of movie
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 * Dominik Schnitzer <dominik@schnitzer.at> - November 11, 2000.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 * - Cleanup code, more comments
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 * - Better error handling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 * Bruno Barreyra <barreyra@ufl.edu> - December 10, 2000.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 * - Eliminated memcpy's for entire frames
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
43 * Felix Buenemann <Felix.Buenemann@ePost.de> - March 11, 2001
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
44 * - Added aspect-ratio awareness for fullscreen
97
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
45 * Felix Buenemann <Felix.Buenemann@gmx.de> - March 11, 2001
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
46 * - Fixed aspect-ratio awareness, did only vertical scaling (black bars above
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
47 * and below), now also does horizontal scaling (black bars left and right),
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
48 * so you get the biggest possible picture with correct aspect-ratio.
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
49 * Felix Buenemann <Atmosfear@users.sourceforge.net> - March 12, 2001
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
50 * - Minor bugfix to aspect-ratio vor non-4:3-resolutions (like 1280x1024)
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
51 * - Bugfix to check_events() to reveal mouse cursor after 'q'-quit in
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
52 * fullscreen-mode
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 #include <inttypes.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 LIBVO_EXTERN(sdl)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 //#include "log.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 //#define LOG if(0)printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 {
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
71 "SDL YUV overlay (SDL v1.1.7+ only!)",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 "sdl",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 "Ryan C. Gordon <icculus@lokigames.com>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 #include <SDL/SDL.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 /** Private SDL Data structure **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 static struct sdl_priv_s {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 /* SDL YUV surface & overlay */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 SDL_Surface *surface;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 SDL_Overlay *overlay;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 // SDL_Overlay *current_frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 /* available fullscreen modes */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 SDL_Rect **fullmodes;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 /* surface attributes for fullscreen and windowed mode */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 Uint32 sdlflags, sdlfullflags;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 /* save the windowed output extents */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 SDL_Rect windowsize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 /* Bits per Pixel */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 Uint8 bpp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 /* current fullscreen mode, 0 = highest available fullscreen mode */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 int fullmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 /* YUV ints */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 int framePlaneY, framePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 int stridePlaneY, stridePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 int width,height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 int format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 } sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 /** OMS Plugin functions **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 * Take a null-terminated array of pointers, and find the last element.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 * params : array == array of which we want to find the last element.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 * returns : index of last NON-NULL element.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 static inline int findArrayEnd (SDL_Rect **array)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 int i = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 while ( array[i++] ); /* keep loopin' ... */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 /* return the index of the last array element */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 return i - 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 * Open and prepare SDL output.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 * params : *plugin ==
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 * *name ==
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 * returns : 0 on success, -1 on failure
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 static int sdl_open (void *plugin, void *name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 const SDL_VideoInfo *vidInfo = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 static int opened = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 if (opened)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 opened = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 // LOG (LOG_DEBUG, "SDL video out: Opened Plugin");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
151 /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 priv->fullmode = -2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 /* other default values */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 priv->surface = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 priv->overlay = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 priv->fullmodes = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 /* initialize the SDL Video system */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 if (SDL_Init (SDL_INIT_VIDEO)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 // LOG (LOG_ERROR, "SDL video out: Initializing of SDL failed (SDL_Init). Please use the latest version of SDL.");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 /* No Keyrepeats! */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 SDL_EnableKeyRepeat(0,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 /* get information about the graphics adapter */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 vidInfo = SDL_GetVideoInfo ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 /* collect all fullscreen & hardware modes available */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 /* non hardware accelerated fullscreen modes */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 priv->sdlfullflags &= ~SDL_HWSURFACE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 /* test for normal resizeable & windowed hardware accellerated surfaces */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 /* test for NON hardware accelerated resizeable surfaces - poor you.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 * That's all we have. If this fails there's nothing left.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 * Theoretically there could be Fullscreenmodes left - we ignore this for now.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 priv->sdlflags &= ~SDL_HWSURFACE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 if ((!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) && (!priv->fullmodes)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 // LOG (LOG_ERROR, "SDL video out: Couldn't get any acceptable SDL Mode for output. (SDL_ListModes failed)");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 /* YUV overlays need at least 16-bit color depth, but the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 * display might less. The SDL AAlib target says it can only do
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 * 8-bits, for example. So, if the display is less than 16-bits,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 * we'll force the BPP to 16, and pray that SDL can emulate for us.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 priv->bpp = vidInfo->vfmt->BitsPerPixel;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 if (priv->bpp < 16) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 LOG (LOG_WARNING, "SDL video out: Your SDL display target wants to be at a color depth of (%d), but we need it to be at\
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 least 16 bits, so we need to emulate 16-bit color. This is going to slow things down; you might want to\
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 increase your display's color depth, if possible", priv->bpp);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 priv->bpp = 16;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 /* We dont want those in out event queue */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 SDL_EventState(SDL_KEYUP, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 SDL_EventState(SDL_QUIT, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 /* Success! */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 * Close SDL, Cleanups, Free Memory
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 * params : *plugin
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 * returns : non-zero on success, zero on error.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 static int sdl_close (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 // LOG (LOG_DEBUG, "SDL video out: Closed Plugin");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 // LOG (LOG_INFO, "SDL video out: Closed Plugin");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 /* Cleanup YUV Overlay structure */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 if (priv->overlay)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 SDL_FreeYUVOverlay(priv->overlay);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 /* Free our blitting surface */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 if (priv->surface)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 SDL_FreeSurface(priv->surface);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 /* TODO: cleanup the full_modes array */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 /* Cleanup SDL */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 SDL_Quit();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 * Sets the specified fullscreen mode.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 * params : mode == index of the desired fullscreen mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 * returns : doesn't return
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 static void set_fullmode (int mode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 SDL_Surface *newsurface = NULL;
97
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
267 int haspect, waspect = 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 /* if we haven't set a fullmode yet, default to the lowest res fullmode first */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 if (mode < 0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272
97
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
273 /* Calculate proper aspect ratio for fullscreen
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
274 * 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
275 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
276 /* 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
277 if (haspect < 0) {
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
278 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
279 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
280 }
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
281 // printf ("W-Aspect: %i H-Aspect: %i\n", waspect, haspect);
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
282
97
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
283 /* 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
284 newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w - waspect, priv->fullmodes[mode]->h - haspect, priv->bpp, priv->sdlfullflags);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 /* if we were successfull hide the mouse cursor and save the mode */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 if (newsurface) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 priv->surface = newsurface;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 SDL_ShowCursor(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 * Initialize an SDL surface and an SDL YUV overlay.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 * params : width == width of video we'll be displaying.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 * height == height of video we'll be displaying.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 * fullscreen == want to be fullscreen?
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 * title == Title for window titlebar.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 * returns : non-zero on success, zero on error.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 //static int sdl_setup (int width, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 struct sdl_priv_s *priv = &sdl_priv;
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
309 unsigned int sdl_format, aspectheight;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 case IMGFMT_YV12: sdl_format=SDL_YV12_OVERLAY;break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 case IMGFMT_YUY2: sdl_format=SDL_YUY2_OVERLAY;break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 printf("SDL: Unsupported image format (0x%X)\n",format);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 sdl_open (NULL, NULL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 /* Save the original Image size */
84
802fbd1760ae aspect ratio patch by Felix B¸«änemann
arpi_esp
parents: 31
diff changeset
322
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 priv->width = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 priv->height = height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 priv->format = format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 if(fullscreen){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 priv->windowsize.w = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 priv->windowsize.h = height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 priv->surface=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 set_fullmode(priv->fullmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 priv->windowsize.w = d_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 priv->windowsize.h = d_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlflags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 if(!priv->surface) return -1; // cannot SetVideoMode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 /* Initialize and create the YUV Overlay used for video out */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 if (!(priv->overlay = SDL_CreateYUVOverlay (width, height, sdl_format, priv->surface))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 printf ("SDL video out: Couldn't create an SDL-based YUV overlay\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 priv->framePlaneY = width * height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 priv->framePlaneUV = (width * height) >> 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 priv->stridePlaneY = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 priv->stridePlaneUV = width/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 * Draw a frame to the SDL YUV overlay.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 * params : *src[] == the Y, U, and V planes that make up the frame.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 * returns : non-zero on success, zero on error.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 //static int sdl_draw_frame (frame_t *frame)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 static uint32_t draw_frame(uint8_t *src[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 uint8_t *dst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 // priv->current_frame = (SDL_Overlay*) frame->private;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 // SDL_UnlockYUVOverlay (priv->current_frame);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 if (SDL_LockYUVOverlay (priv->overlay)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 // LOG (LOG_ERROR, "SDL video out: Couldn't lock SDL-based YUV overlay");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 switch(priv->format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 case IMGFMT_YV12:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 dst = (uint8_t *) *(priv->overlay->pixels);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 memcpy (dst, src[0], priv->framePlaneY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 dst += priv->framePlaneY;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 memcpy (dst, src[2], priv->framePlaneUV);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 dst += priv->framePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 memcpy (dst, src[1], priv->framePlaneUV);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 case IMGFMT_YUY2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 dst = (uint8_t *) *(priv->overlay->pixels);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 memcpy (dst, src[0], priv->width*priv->height*2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 SDL_UnlockYUVOverlay (priv->overlay);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 * Draw a slice (16 rows of image) to the SDL YUV overlay.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 * params : *src[] == the Y, U, and V planes that make up the slice.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 * returns : non-zero on error, zero on success.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 uint8_t *dst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 uint8_t *src;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 //priv->current_frame = priv->overlay;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 if (SDL_LockYUVOverlay (priv->overlay)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 // LOG (LOG_ERROR, "SDL video out: Couldn't lock SDL-based YUV overlay");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 dst = (uint8_t *) *(priv->overlay->pixels)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 + (priv->stridePlaneY * y + x);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 src = image[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 memcpy(dst,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 src+=stride[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 dst+=priv->stridePlaneY;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 x/=2;y/=2;w/=2;h/=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 + (priv->stridePlaneUV * y + x);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 src = image[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 memcpy(dst,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 src+=stride[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 dst+=priv->stridePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 + priv->framePlaneUV + (priv->stridePlaneUV * y + x);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439 src = image[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 for(i=0;i<h;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 memcpy(dst,src,w);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 src+=stride[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 dst+=priv->stridePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 dst = (uint8_t *) *(priv->overlay->pixels) + (priv->slicePlaneY * slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 memcpy (dst, src[0], priv->slicePlaneY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 dst = (uint8_t *) *(priv->overlay->pixels) + priv->framePlaneY + (priv->slicePlaneUV * slice_num);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 memcpy (dst, src[2], priv->slicePlaneUV);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 dst += priv->framePlaneUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 memcpy (dst, src[1], priv->slicePlaneUV);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 SDL_UnlockYUVOverlay (priv->overlay);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 * Checks for SDL keypress and window resize events
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 * params : none
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 * returns : doesn't return
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 #include "../linux/keycodes.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 extern void mplayer_put_key(int code);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 static void check_events (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 SDL_Event event;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 SDLKey keypressed;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 /* Poll the waiting SDL Events */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 while ( SDL_PollEvent(&event) ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 switch (event.type) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 /* capture window resize events */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 case SDL_VIDEORESIZE:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 priv->surface = SDL_SetVideoMode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 /* save video extents, to restore them after going fullscreen */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487 //if(!(priv->surface->flags & SDL_FULLSCREEN)) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488 priv->windowsize.w = priv->surface->w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 priv->windowsize.h = priv->surface->h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490 //}
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 // LOG (LOG_DEBUG, "SDL video out: Window resize");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 /* graphics mode selection shortcuts */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 case SDL_KEYDOWN:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 keypressed = event.key.keysym.sym;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499 /* plus key pressed. plus cycles through available fullscreenmodes, if we have some */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 if ( ((keypressed == SDLK_PLUS) || (keypressed == SDLK_KP_PLUS)) && (priv->fullmodes) ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501 /* select next fullscreen mode */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 priv->fullmode++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 set_fullmode(priv->fullmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 // LOG (LOG_DEBUG, "SDL video out: Set next available fullscreen mode.");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509 /* return or escape key pressed toggles/exits fullscreenmode */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 else if ( (keypressed == SDLK_RETURN) || (keypressed == SDLK_ESCAPE) ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511 if (priv->surface->flags & SDL_FULLSCREEN) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512 priv->surface = SDL_SetVideoMode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513 SDL_ShowCursor(1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514 // LOG (LOG_DEBUG, "SDL video out: Windowed mode");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 else if (priv->fullmodes){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517 set_fullmode(priv->fullmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519 // LOG (LOG_DEBUG, "SDL video out: Set fullscreen mode.");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 else switch(keypressed){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 // case SDLK_q: if(!(priv->surface->flags & SDL_FULLSCREEN))mplayer_put_key('q');break;
97
cab74dfde6dd Felix B¸«änemann added support for horizontal scaling for aspect-ratio in
atmosfear
parents: 84
diff changeset
525 case SDLK_q: SDL_ShowCursor(1); mplayer_put_key('q');break; //F.B.: added ShowCursor
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 // case SDLK_p: mplayer_put_key('p');break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 // case SDLK_SPACE: mplayer_put_key(' ');break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 case SDLK_UP: mplayer_put_key(KEY_UP);break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529 case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530 case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 case SDLK_PLUS:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533 case SDLK_KP_PLUS: mplayer_put_key('+');break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 case SDLK_MINUS:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 case SDLK_KP_MINUS: mplayer_put_key('-');break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
537
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
540 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
544 /**
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 * Display the surface we have written our data to and check for events.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
547 * params : mode == index of the desired fullscreen mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
548 * returns : doesn't return
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 **/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 static void flip_page (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
553 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
554
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 /* check and react on keypresses and window resizes */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 check_events();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 /* blit to the YUV overlay */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
559 SDL_DisplayYUVOverlay (priv->overlay, &priv->surface->clip_rect);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
560
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
561 /* check if we have a double buffered surface and flip() if we do. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
562 if ( priv->surface->flags & SDL_DOUBLEBUF )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
563 SDL_Flip(priv->surface);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 SDL_LockYUVOverlay (priv->overlay);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 static frame_t* sdl_allocate_image_buffer(int width, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 struct sdl_priv_s *priv = &sdl_priv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
572 frame_t *frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
573
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 if (!(frame = malloc (sizeof (frame_t))))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
575 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577 if (!(frame->private = (void*) SDL_CreateYUVOverlay (width, height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578 SDL_IYUV_OVERLAY, priv->surface)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 // LOG (LOG_ERROR, "SDL video out: Couldn't create an SDL-based YUV overlay");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
583
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584 frame->base[0] = (uint8_t*) ((SDL_Overlay*) (frame->private))->pixels[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 frame->base[1] = (uint8_t*) ((SDL_Overlay*) (frame->private))->pixels[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
586 frame->base[2] = (uint8_t*) ((SDL_Overlay*) (frame->private))->pixels[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
587
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 SDL_LockYUVOverlay ((SDL_Overlay*) frame->private);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 return frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
591
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 static void sdl_free_image_buffer(frame_t* frame)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 SDL_FreeYUVOverlay((SDL_Overlay*) frame->private);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595 free(frame);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
603 case IMGFMT_YV12:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 case IMGFMT_YUY2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
605 // case IMGFMT_RGB|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606 // case IMGFMT_BGR|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
607 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
608 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
609 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
610 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
611
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
612 static const vo_info_t*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
613 get_info(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
614 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
615 return &vo_info;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
616 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
617
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
618
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
619 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
620 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 sdl_close();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624