vo_fbdev: clip x/y offsets to avoid bad video placement

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33299 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2011-04-22 12:33:08 +00:00 committed by Uoti Urpala
parent 8924d2c27d
commit 8c831a2e86
2 changed files with 8 additions and 3 deletions

View File

@ -34,6 +34,7 @@
#include <sys/ioctl.h>
#include <sys/kd.h>
#include <linux/fb.h>
#include <libavutil/common.h>
#include "config.h"
#include "video_out.h"
@ -43,7 +44,6 @@
#include "geometry.h"
#include "aspect.h"
#include "mp_msg.h"
#include "libavutil/common.h"
static const vo_info_t info = {
"Framebuffer Device",

View File

@ -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 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
{
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 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
}
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))) {