summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2011-04-22 12:33:08 +0000
committerUoti Urpala <uau@mplayer2.org>2011-05-02 00:36:20 +0300
commit8c831a2e863f0c743be3377a6f5b2cfe7d35a614 (patch)
tree8e25dc4a4082595d314858539c515d651b0bddf8 /libvo
parent8924d2c27dc9901f54f590d7bd3161cc4a312533 (diff)
downloadmpv-8c831a2e863f0c743be3377a6f5b2cfe7d35a614.tar.bz2
mpv-8c831a2e863f0c743be3377a6f5b2cfe7d35a614.tar.xz
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
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_fbdev.c2
-rw-r--r--libvo/vo_fbdev2.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index 02f553db23..e2c4dd2bfd 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -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",
diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c
index 9da18551b2..74a03e9814 100644
--- a/libvo/vo_fbdev2.c
+++ b/libvo/vo_fbdev2.c
@@ -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))) {