Mercurial > mplayer.hg
comparison libvo/vo_wii.c @ 27963:55a3f6cf9784
Use static variable instead of #define to lessen differences to vo_fbdev.c.
author | diego |
---|---|
date | Sun, 23 Nov 2008 14:15:54 +0000 |
parents | c9204a95ead1 |
children | f559fdc6fb96 |
comparison
equal
deleted
inserted
replaced
27962:c9204a95ead1 | 27963:55a3f6cf9784 |
---|---|
53 #include "video_out_internal.h" | 53 #include "video_out_internal.h" |
54 #include "sub.h" | 54 #include "sub.h" |
55 #include "mp_msg.h" | 55 #include "mp_msg.h" |
56 | 56 |
57 #define WII_DEV_NAME "/dev/fb0" | 57 #define WII_DEV_NAME "/dev/fb0" |
58 #define FB_PIXEL_SIZE 2 | |
59 | 58 |
60 static const vo_info_t info = { | 59 static const vo_info_t info = { |
61 "Nintendo Wii/GameCube Framebuffer Device", | 60 "Nintendo Wii/GameCube Framebuffer Device", |
62 "wii", | 61 "wii", |
63 "Jing Liu <fartersh-1@yahoo.com>", | 62 "Jing Liu <fartersh-1@yahoo.com>", |
76 static uint8_t *frame_buffer; | 75 static uint8_t *frame_buffer; |
77 static uint8_t *center; | 76 static uint8_t *center; |
78 | 77 |
79 static struct fb_var_screeninfo fb_orig_vinfo; | 78 static struct fb_var_screeninfo fb_orig_vinfo; |
80 static struct fb_var_screeninfo fb_vinfo; | 79 static struct fb_var_screeninfo fb_vinfo; |
80 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2 | |
81 static int fb_line_len; | 81 static int fb_line_len; |
82 static int in_width; | 82 static int in_width; |
83 static int in_height; | 83 static int in_height; |
84 static int out_width; | 84 static int out_width; |
85 static int out_height; | 85 static int out_height; |
183 mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno)); | 183 mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno)); |
184 } | 184 } |
185 return 1; | 185 return 1; |
186 } | 186 } |
187 | 187 |
188 fb_pixel_size = 2; | |
189 | |
188 if (fs) { | 190 if (fs) { |
189 out_width = fb_vinfo.xres; | 191 out_width = fb_vinfo.xres; |
190 out_height = fb_vinfo.yres; | 192 out_height = fb_vinfo.yres; |
191 } | 193 } |
192 | 194 |
215 mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", WII_DEV_NAME, strerror(errno)); | 217 mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", WII_DEV_NAME, strerror(errno)); |
216 return 1; | 218 return 1; |
217 } | 219 } |
218 | 220 |
219 center = frame_buffer + | 221 center = frame_buffer + |
220 ((out_width - in_width) / 2) * FB_PIXEL_SIZE + | 222 ((out_width - in_width) / 2) * fb_pixel_size + |
221 ((out_height - in_height) / 2) * fb_line_len; | 223 ((out_height - in_height) / 2) * fb_line_len; |
222 | 224 |
223 mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer); | 225 mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer); |
224 mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center); | 226 mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center); |
225 mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / FB_PIXEL_SIZE); | 227 mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size); |
226 | 228 |
227 /* blanking screen */ | 229 /* blanking screen */ |
228 for (temp = 0; temp < fb_size; temp += 4) | 230 for (temp = 0; temp < fb_size; temp += 4) |
229 memcpy(frame_buffer + temp, (void *) &black, 4); | 231 memcpy(frame_buffer + temp, (void *) &black, 4); |
230 | 232 |
257 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | 259 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, |
258 unsigned char *srca, int stride) | 260 unsigned char *srca, int stride) |
259 { | 261 { |
260 unsigned char *dst; | 262 unsigned char *dst; |
261 | 263 |
262 dst = center + fb_line_len * y0 + FB_PIXEL_SIZE * x0; | 264 dst = center + fb_line_len * y0 + fb_pixel_size * x0; |
265 | |
263 vo_draw_alpha_yuy2(w, h, src, srca, stride, dst, fb_line_len); | 266 vo_draw_alpha_yuy2(w, h, src, srca, stride, dst, fb_line_len); |
264 } | 267 } |
265 | 268 |
266 static int draw_frame(uint8_t *src[]) | 269 static int draw_frame(uint8_t *src[]) |
267 { | 270 { |
270 | 273 |
271 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) | 274 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) |
272 { | 275 { |
273 uint8_t *d, *s; | 276 uint8_t *d, *s; |
274 | 277 |
275 d = center + fb_line_len * y + FB_PIXEL_SIZE * x; | 278 d = center + fb_line_len * y + fb_pixel_size * x; |
279 | |
276 s = src[0]; | 280 s = src[0]; |
277 while (h) { | 281 while (h) { |
278 memcpy(d, s, w * FB_PIXEL_SIZE); | 282 memcpy(d, s, w * fb_pixel_size); |
279 d += fb_line_len; | 283 d += fb_line_len; |
280 s += stride[0]; | 284 s += stride[0]; |
281 h--; | 285 h--; |
282 } | 286 } |
283 | 287 |