[MPlayer-dev-eng] [PATCH] fbdev2 positioning

Balint Marton cus at fazekas.hu
Sun Feb 27 21:22:35 CET 2005


Hi,

I made a patch that adds positioning (-geometry +x+y) support to the
fbdev2 video output driver. It's quite simple, i don't think it would
break anything :)

Cus
-------------- next part --------------
--- libvo/vo_fbdev2.c.old	2004-12-03 21:55:00.000000000 +0100
+++ libvo/vo_fbdev2.c	2005-02-27 18:39:32.000000000 +0100
@@ -21,6 +21,7 @@
 #include "fastmemcpy.h"
 #include "sub.h"
 #include "mp_msg.h"
+#include "geometry.h"
 
 static vo_info_t info = {
 	"Framebuffer Device",
@@ -209,16 +210,23 @@
 {
 	struct fb_cmap *cmap;
 	int fs = flags & 0x01;
+	int x_pos = -1;
+	int y_pos = -1;
 
 	out_width = width;
 	out_height = height;
 	in_width = width;
 	in_height = height;
 
-	if (fs) {
-		out_width = fb_vinfo.xres;
-		out_height = fb_vinfo.yres;
-	}
+	out_width = fb_vinfo.xres;
+	out_height = fb_vinfo.yres;
+
+	geometry(&x_pos, &y_pos, &d_width, &d_height, out_width, out_height);
+
+	if (x_pos == -1) 
+		x_pos = (fs ? ((out_width - in_width) / 2) : 0);
+	if (y_pos == -1) 
+		y_pos = (fs ? ((out_height - in_height) / 2) : 0);
 
 	if (out_width < in_width || out_height < in_height) {
 		mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Screensize is smaller than video size (%dx%d < %dx%d)\n",
@@ -279,8 +287,7 @@
 		}
 	}
 
-	center = frame_buffer + (out_width - in_width) * fb_pixel_size /
-		2 + ( (out_height - in_height) / 2 ) * fb_line_len;
+	center = frame_buffer + x_pos * fb_pixel_size + y_pos * fb_line_len; 
 
 #ifndef USE_CONVERT2FB
 	if (!(next_frame = (uint8_t *) realloc(next_frame, in_width * in_height * fb_pixel_size))) {


More information about the MPlayer-dev-eng mailing list