[MPlayer-cvslog] r32453 - in trunk/libvo: mga_template.c vo_xmga.c

reimar subversion at mplayerhq.hu
Sat Oct 9 13:12:54 CEST 2010


Author: reimar
Date: Sat Oct  9 13:12:53 2010
New Revision: 32453

Log:
Switch (x)mga vo to new libvo API to reduce code duplication and improve
consistency between vos.
Also fixes using it with the GUI, the vo_window would not be set before.

Modified:
   trunk/libvo/mga_template.c
   trunk/libvo/vo_xmga.c

Modified: trunk/libvo/mga_template.c
==============================================================================
--- trunk/libvo/mga_template.c	Sat Oct  9 03:31:52 2010	(r32452)
+++ trunk/libvo/mga_template.c	Sat Oct  9 13:12:53 2010	(r32453)
@@ -37,10 +37,7 @@ static uint8_t *vid_data, *frames[4];
 static int f = -1;
 
 static uint32_t               drwX,drwY,drwWidth,drwHeight;
-#ifdef VO_XMGA
-static uint32_t               drwBorderWidth,drwDepth;
-#endif
-static uint32_t               drwcX,drwcY,dwidth,dheight;
+static uint32_t               drwcX,drwcY;
 
 static struct SwsContext *sws_ctx;
 
@@ -352,6 +349,13 @@ static int control(uint32_t request, voi
 	set_window();
        }
       return VO_TRUE;
+  case VOCTRL_UPDATE_SCREENINFO:
+#ifdef VO_XMGA
+      update_xinerama_info();
+#else
+      aspect_save_screenres(vo_screenwidth, vo_screenheight);
+#endif
+      return VO_TRUE;
   }
   return VO_NOTIMPL;
 }
@@ -506,33 +510,21 @@ static int preinit(const char *vo_subdev
 
 static void set_window( void ){
 
-#ifdef VO_XMGA
-	 if ( WinID )
-	  {
-           XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
-           mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
-           drwX=0; drwY=0;
-           XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
-           mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
-
-	  }
-	  else
-#endif
-	  { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; }
+         drwcX = vo_dx;
+         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;
+         aspect(&drwWidth, &drwHeight, A_WINZOOM);
+         panscan_calc_windowed();
+         drwWidth  += vo_panscan_x;
+         drwHeight += vo_panscan_y;
+         drwWidth  = FFMIN(drwWidth, vo_screenwidth);
+         drwHeight = FFMIN(drwHeight, vo_screenheight);
+         drwX = (vo_dwidth  - drwWidth ) / 2;
+         drwY = (vo_dheight - drwHeight) / 2;
+         drwcX += drwX;
+         drwcY += drwY;
 
 #ifdef VO_XMGA
 #ifdef CONFIG_XINERAMA
@@ -592,20 +584,5 @@ static void set_window( void ){
          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;
-#ifdef VO_XMGA
-	   mDrawColorKey();
-#endif
-	  }
 	 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?)" );
 }

Modified: trunk/libvo/vo_xmga.c
==============================================================================
--- trunk/libvo/vo_xmga.c	Sat Oct  9 03:31:52 2010	(r32452)
+++ trunk/libvo/vo_xmga.c	Sat Oct  9 13:12:53 2010	(r32453)
@@ -55,10 +55,6 @@ static unsigned int timer = 0;
 static unsigned int timerd = 0;
 #endif
 
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
-
 static const vo_info_t info = {
     "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
     "xmga",
@@ -75,8 +71,6 @@ static int colorkey;
 static uint32_t mvHeight;
 static uint32_t mvWidth;
 
-static Window mRoot;
-
 static XSetWindowAttributes xWAttribs;
 
 static int initialized = 0;
@@ -135,25 +129,9 @@ static int config(uint32_t width, uint32
     if (mga_init(width, height, format))
         return -1;              // ioctl errors?
 
-    aspect_save_orig(width, height);
-    aspect_save_prescale(d_width, d_height);
-    update_xinerama_info();
-
     mvWidth = width;
     mvHeight = height;
 
-    vo_panscan_x = vo_panscan_y = vo_panscan_amount = 0;
-
-    aspect(&d_width, &d_height, A_NOZOOM);
-    vo_dx = (vo_screenwidth - d_width) / 2;
-    vo_dy = (vo_screenheight - d_height) / 2;
-    geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth,
-             vo_screenheight);
-    vo_dx += xinerama_x;
-    vo_dy += xinerama_y;
-    vo_dwidth = d_width;
-    vo_dheight = d_height;
-
     r = (vo_colorkey & 0x00ff0000) >> 16;
     g = (vo_colorkey & 0x0000ff00) >> 8;
     b = vo_colorkey & 0x000000ff;
@@ -181,15 +159,6 @@ static int config(uint32_t width, uint32
 
     initialized = 1;
 
-#ifdef CONFIG_GUI
-    if (use_gui)
-        guiGetEvent(guiSetShVideo, 0);  // the GUI will set up / resize the window
-    else
-#endif
-    {
-        if (flags & VOFLAG_FULLSCREEN)
-            aspect(&dwidth, &dheight, A_ZOOM);
-
         XGetWindowAttributes(mDisplay, mRootWin, &attribs);
         mDepth = attribs.depth;
         if (mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32)
@@ -205,17 +174,6 @@ static int config(uint32_t width, uint32
                     flags, xWAttribs.colormap, "xmga", title);
             XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xWAttribs);
 
-    }                           // !GUI
-
-    if ((flags & VOFLAG_FULLSCREEN) && (!WinID))
-    {
-        vo_dx = 0;
-        vo_dy = 0;
-        vo_dwidth = vo_screenwidth;
-        vo_dheight = vo_screenheight;
-        vo_fs = 1;
-    }
-
     panscan_calc();
 
     mga_vid_config.colkey_on = 1;


More information about the MPlayer-cvslog mailing list