diff libvo/vo_xvidix.c @ 6307:72c87b2ec779

added panscan support for xmga/xvidix
author pontscho
date Wed, 05 Jun 2002 19:35:54 +0000
parents 4446af3c1a75
children da2dda48b7ec
line wrap: on
line diff
--- a/libvo/vo_xvidix.c	Wed Jun 05 02:24:35 2002 +0000
+++ b/libvo/vo_xvidix.c	Wed Jun 05 19:35:54 2002 +0000
@@ -74,7 +74,7 @@
 static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
     drwDepth, drwcX, drwcY, dwidth, dheight;
 
-static void set_window(int force_update,const vo_tune_info_t *info)
+static void set_window(int force_update,const vo_tune_info_t *info, int ps)
 {
     Window mRoot;
     if ( WinID )
@@ -82,9 +82,9 @@
       XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
 	  &drwHeight, &drwBorderWidth, &drwDepth);
       drwX = drwY = 0;
+
       XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
 	  &drwcX, &drwcY, &mRoot);
-
       aspect(&dwidth,&dheight,A_NOZOOM);
       if (!vo_fs)
 	  mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
@@ -113,6 +113,8 @@
     }
 #endif
 
+    vo_dwidth=drwWidth; vo_dheight=drwHeight;
+
 #ifdef HAVE_XINERAMA
     if (XineramaIsActive(mDisplay))
     {
@@ -135,6 +137,16 @@
     }
 #endif
 
+    if ( ps )
+     {
+      drwcX-=vo_panscan_x >> 1;
+      drwcY-=vo_panscan_y >> 1;
+      drwX-=vo_panscan_x >> 1;
+      drwY-=vo_panscan_y >> 1;
+      drwWidth+=vo_panscan_x;
+      drwHeight+=vo_panscan_y;
+     }
+
     /* set new values in VIDIX */
     if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
 	(window_width != drwWidth) || (window_height != drwHeight))
@@ -196,6 +208,8 @@
 //	free(title);
     title = "MPlayer VIDIX X11 Overlay";
 
+    panscan_init();
+
     image_height = height;
     image_width = width;
     image_format = format;
@@ -349,7 +363,7 @@
 	vidix_grkey_set(&gr_key);
     }
 
-    set_window(1,info);
+    set_window(1,info,0);
     if(info) memcpy(&vtune,info,sizeof(vo_tune_info_t));
     else     memset(&vtune,0,sizeof(vo_tune_info_t));
     XFlush(mDisplay);
@@ -370,7 +384,7 @@
     const int event = vo_x11_check_events(mDisplay);
 
     if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
-	set_window(0,&vtune);
+	set_window(0,&vtune,0);
 
     return;
 }
@@ -449,6 +463,15 @@
   case VOCTRL_FULLSCREEN:
     vo_x11_fullscreen();
     return VO_TRUE;
+  case VOCTRL_GET_PANSCAN:
+      return VO_TRUE;
+  case VOCTRL_SET_PANSCAN:
+      if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
+        {
+         panscan_calc();
+	 set_window( 0,&vtune,1 );
+        }
+      return VO_TRUE;
   }
   return VO_NOTIMPL;
 }