Mercurial > mplayer.hg
comparison libvo/vo_fbdev2.c @ 33212:c52a2600de15
Clip x/y offsets to avoid bad video placement.
author | reimar |
---|---|
date | Fri, 22 Apr 2011 12:33:08 +0000 |
parents | 77a9d13fa30e |
children | d7b577e7e644 |
comparison
equal
deleted
inserted
replaced
33211:77a9d13fa30e | 33212:c52a2600de15 |
---|---|
35 #include "video_out_internal.h" | 35 #include "video_out_internal.h" |
36 #include "fastmemcpy.h" | 36 #include "fastmemcpy.h" |
37 #include "sub/sub.h" | 37 #include "sub/sub.h" |
38 #include "mp_msg.h" | 38 #include "mp_msg.h" |
39 #include "aspect.h" | 39 #include "aspect.h" |
40 #include "libavutil/common.h" | |
40 | 41 |
41 static const vo_info_t info = { | 42 static const vo_info_t info = { |
42 "Framebuffer Device", | 43 "Framebuffer Device", |
43 "fbdev2", | 44 "fbdev2", |
44 "Joey Parrish <joey@nicewarrior.org>", | 45 "Joey Parrish <joey@nicewarrior.org>", |
229 uint32_t d_height, uint32_t flags, char *title, | 230 uint32_t d_height, uint32_t flags, char *title, |
230 uint32_t format) | 231 uint32_t format) |
231 { | 232 { |
232 struct fb_cmap *cmap; | 233 struct fb_cmap *cmap; |
233 int fs = flags & VOFLAG_FULLSCREEN; | 234 int fs = flags & VOFLAG_FULLSCREEN; |
235 int x_offset = vo_dx + (d_width - width ) / 2; | |
236 int y_offset = vo_dy + (d_height - height) / 2; | |
237 x_offset = av_clip(x_offset, 0, fb_vinfo.xres - width); | |
238 y_offset = av_clip(y_offset, 0, fb_vinfo.yres - height); | |
234 | 239 |
235 in_width = width; | 240 in_width = width; |
236 in_height = height; | 241 in_height = height; |
237 | 242 |
238 if (fb_vinfo.xres < in_width || fb_vinfo.yres < in_height) { | 243 if (fb_vinfo.xres < in_width || fb_vinfo.yres < in_height) { |
294 return 1; | 299 return 1; |
295 } | 300 } |
296 } | 301 } |
297 | 302 |
298 center = frame_buffer + | 303 center = frame_buffer + |
299 vo_dx * fb_pixel_size + | 304 x_offset * fb_pixel_size + |
300 vo_dy * fb_line_len; | 305 y_offset * fb_line_len; |
301 | 306 |
302 #ifndef USE_CONVERT2FB | 307 #ifndef USE_CONVERT2FB |
303 if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) { | 308 if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) { |
304 mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno)); | 309 mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno)); |
305 return 1; | 310 return 1; |