[MPlayer-dev-eng] [PATCH] -geometry support in vo_fbdev2

Benson Mitchell benson.mitchell at gmail.com
Mon Jun 29 07:07:53 CEST 2009


Oops, forgot the patch.
-------------- next part --------------
diff -ru mplayer-export-2009-06-26/DOCS/man/en/mplayer.1 mplayer/DOCS/man/en/mplayer.1
--- mplayer-export-2009-06-26/DOCS/man/en/mplayer.1	2009-05-12 22:58:57.000000000 -0400
+++ mplayer/DOCS/man/en/mplayer.1	2009-06-26 18:34:15.568994490 -0400
@@ -3125,7 +3125,7 @@
 .br
 .I NOTE:
 This option is only supported by the x11, xmga, xv, xvmc, xvidix,
-gl, gl2, directx, fbdev and tdfxfb video output drivers.
+gl, gl2, directx, fbdev, fbdev2 and tdfxfb video output drivers.
 .sp 1
 .I EXAMPLE:
 .PD 0
diff -ru mplayer-export-2009-06-26/libvo/vo_fbdev2.c mplayer/libvo/vo_fbdev2.c
--- mplayer-export-2009-06-26/libvo/vo_fbdev2.c	2009-05-12 22:58:57.000000000 -0400
+++ mplayer/libvo/vo_fbdev2.c	2009-06-28 18:55:43.273398285 -0400
@@ -30,6 +30,7 @@
 #include <sys/ioctl.h>
 #include <linux/fb.h>
 
+#include "libavutil/common.h"
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
@@ -226,16 +227,11 @@
 	struct fb_cmap *cmap;
 	int fs = flags & VOFLAG_FULLSCREEN;
 
-	out_width = width;
-	out_height = height;
+	out_width = vo_dwidth;
+	out_height = vo_dheight;
 	in_width = width;
 	in_height = height;
 
-	if (fs) {
-		out_width = fb_vinfo.xres;
-		out_height = fb_vinfo.yres;
-	}
-
 	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",
 		    out_width, out_height, in_width, in_height);
@@ -295,9 +291,15 @@
 		}
 	}
 
+
+	//clamp values to prevent mangling off-screen data:
+	vo_dx = av_clip(vo_dx, 0, fb_vinfo.xres - out_width );
+	vo_dy = av_clip(vo_dy, 0, fb_vinfo.yres - out_height);
+		
 	center = frame_buffer +
 	         ( (out_width - in_width) / 2 ) * fb_pixel_size +
-		 ( (out_height - in_height) / 2 ) * fb_line_len;
+		 ( (out_height - in_height) / 2 ) * fb_line_len +
+		 vo_dx * fb_pixel_size + vo_dy * fb_line_len;
 
 #ifndef USE_CONVERT2FB
 	if (!(next_frame = (uint8_t *) realloc(next_frame, in_width * in_height * fb_pixel_size))) {
@@ -418,6 +420,12 @@
   switch (request) {
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_UPDATE_SCREENINFO:
+    vo_screenwidth = fb_vinfo.xres;
+    vo_screenheight = fb_vinfo.yres;
+    xinerama_x = xinerama_y = 0;
+    aspect_save_screenres(vo_screenwidth, vo_screenheight);
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }


More information about the MPlayer-dev-eng mailing list