[MPlayer-dev-eng] [PATCH] mga panscan. Re: [BUG] xmga+panscan crops too much

Ivan Szanto szivan at duticai.TWI.TUDelft.NL
Tue Oct 29 00:54:24 CET 2002


Hi,


On Sat, 28 Sep 2002 gabucino at mplayerhq.hu wrote:

> BTW: when will panscan work on -vo mga? .so?



I would also find it very useful if it worked, so here is a patch.

It works fine for me (panscan with -vo mga), although I do not really
know the details, because I just copied some code from the xmga driver.

bye,

Ivan

ps. I tested it on the cvs as well, and it works there too.


diff -C 3 -r MPlayer-0.90pre9/libvo/mga_common.c MPlayer-0.90pre9-mga-panscan/libvo/mga_common.c
*** MPlayer-0.90pre9/libvo/mga_common.c	Thu Oct 17 09:49:25 2002
--- MPlayer-0.90pre9-mga-panscan/libvo/mga_common.c	Mon Oct 28 23:53:55 2002
***************
*** 297,302 ****
--- 297,311 ----
      else
  	printf("Screen width/height unknown!\n");
      return VO_TRUE;
+   case VOCTRL_GET_PANSCAN:
+       if ( !vo_fs ) return VO_FALSE;
+       return VO_TRUE;
+   case VOCTRL_SET_PANSCAN:
+       if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
+        {
+ 	panscan_calc();
+        }
+       return VO_TRUE;
  #endif

  #if defined( VO_XMGA ) && defined( HAVE_NEW_GUI )
diff -C 3 -r MPlayer-0.90pre9/libvo/vo_mga.c MPlayer-0.90pre9-mga-panscan/libvo/vo_mga.c
*** MPlayer-0.90pre9/libvo/vo_mga.c	Wed Oct  9 13:40:23 2002
--- MPlayer-0.90pre9-mga-panscan/libvo/vo_mga.c	Mon Oct 28 23:56:13 2002
***************
*** 9,14 ****
--- 9,15 ----
  #include "config.h"
  #include "video_out.h"
  #include "video_out_internal.h"
+ #include "mp_msg.h"

  LIBVO_EXTERN(mga)

***************
*** 22,27 ****
--- 23,31 ----
  #include "sub.h"
  #include "aspect.h"

+ static uint32_t               drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
+ static uint32_t               drwcX,drwcY,dwidth,dheight;
+
  static vo_info_t vo_info =
  {
  	"Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
***************
*** 99,106 ****
      vo_mga_flip_page();
  }


  static void check_events(void)
  {
  }
-
--- 103,149 ----
      vo_mga_flip_page();
  }

+ static void set_window( void ){
+
+ 	  { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; }
+
+          aspect(&dwidth,&dheight,A_NOZOOM);
+          if ( vo_fs )
+           {
+            aspect(&dwidth,&dheight,A_ZOOM);
+            drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
+            drwcX+=drwX;
+            drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
+            drwcY+=drwY;
+            drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
+            drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
+            mp_msg(MSGT_VO,MSGL_V,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+           }
+ 	 vo_dwidth=drwWidth; vo_dheight=drwHeight;
+
+          /* mDrawColorKey(); */
+
+          mga_vid_config.x_org=drwcX;
+          mga_vid_config.y_org=drwcY;
+          mga_vid_config.dest_width=drwWidth;
+          mga_vid_config.dest_height=drwHeight;
+ 	 if ( vo_panscan > 0.0f && vo_fs )
+ 	  {
+ 	   drwX-=vo_panscan_x>>1;
+ 	   drwY-=vo_panscan_y>>1;
+ 	   drwWidth+=vo_panscan_x;
+ 	   drwHeight+=vo_panscan_y;
+
+ 	   mga_vid_config.x_org-=vo_panscan_x>>1;
+ 	   mga_vid_config.y_org-=vo_panscan_y>>1;
+            mga_vid_config.dest_width=drwWidth;
+            mga_vid_config.dest_height=drwHeight;
+ 	   /* mDrawColorKey(); */
+ 	   if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
+ 	  }
+ }

  static void check_events(void)
  {
+  set_window();
  }





More information about the MPlayer-dev-eng mailing list