# HG changeset patch # User reimar # Date 1303475588 0 # Node ID c52a2600de153199e98055b8c037ed0525679b8a # Parent 77a9d13fa30eaa46114d6503f12fc7204c4ae089 Clip x/y offsets to avoid bad video placement. diff -r 77a9d13fa30e -r c52a2600de15 libvo/vo_fbdev2.c --- a/libvo/vo_fbdev2.c Fri Apr 22 12:25:09 2011 +0000 +++ b/libvo/vo_fbdev2.c Fri Apr 22 12:33:08 2011 +0000 @@ -37,6 +37,7 @@ #include "sub/sub.h" #include "mp_msg.h" #include "aspect.h" +#include "libavutil/common.h" static const vo_info_t info = { "Framebuffer Device", @@ -231,6 +232,10 @@ { struct fb_cmap *cmap; int fs = flags & VOFLAG_FULLSCREEN; + int x_offset = vo_dx + (d_width - width ) / 2; + int y_offset = vo_dy + (d_height - height) / 2; + x_offset = av_clip(x_offset, 0, fb_vinfo.xres - width); + y_offset = av_clip(y_offset, 0, fb_vinfo.yres - height); in_width = width; in_height = height; @@ -296,8 +301,8 @@ } center = frame_buffer + - vo_dx * fb_pixel_size + - vo_dy * fb_line_len; + x_offset * fb_pixel_size + + y_offset * fb_line_len; #ifndef USE_CONVERT2FB if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) {