[Mplayer-cvslog] CVS: main/libvo geometry.c,1.7,1.8 geometry.h,1.3,1.4 vo_fbdev.c,1.77,1.78 vo_tdfxfb.c,1.23,1.24 vo_xv.c,1.137,1.138

Attila Kinali CVS attila at mplayerhq.hu
Sun Mar 2 22:09:24 CET 2003


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv2592/libvo

Modified Files:
	geometry.c geometry.h vo_fbdev.c vo_tdfxfb.c vo_xv.c 
Log Message:
clean up of -geometry code.
disabled -geometry for all but -vo xv (will be fixed later)


Index: geometry.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/geometry.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- geometry.c	2 Feb 2003 02:42:59 -0000	1.7
+++ geometry.c	2 Mar 2003 21:09:14 -0000	1.8
@@ -16,47 +16,68 @@
 	return 0;
 }
 
-// A little kludge as to not to have to update all drivers
-// Only the vo_xv driver supports now the full [WxH][+X+Y] option
-int geometryFull(int *pwidth, int *pheight, int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh)
+#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1;
+
+// xpos,ypos: position of the left upper corner
+// widw,widh: width and height of the window
+// scrw,scrh: width and height of the current screen 
+int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
 {
         int width, height, xoff, yoff, xper, yper;
 
 	width = height = xoff = yoff = xper = yper = -1;
 
-	/* no need to save a few extra cpu cycles here ;) */
-	/* PUKE i will rewrite this code sometime maybe - euck but it works */
         if(vo_geometry != NULL) {
-		if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 &&
-		   sscanf(vo_geometry, "%ix%i", &width, &height) != 2 &&
-		   sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2 &&
-		   sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2 &&
-		   sscanf(vo_geometry, "%i:%i%%", &xper, &yper) != 2 &&
-		   sscanf(vo_geometry, "%i%%:%i", &xper, &yper) != 2 &&
-		   sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) != 2 &&
-		   sscanf(vo_geometry, "%i%%", &xper) != 1)
+		if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 )
+		{
+		 RESET_GEOMETRY
+		 if(sscanf(vo_geometry, "%ix%i", &width, &height) != 2)
+		 {
+		  RESET_GEOMETRY
+		  if(sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2)
+		  {
+		   RESET_GEOMETRY
+		   if(sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2)
+		   {
+		    RESET_GEOMETRY
+		    if(sscanf(vo_geometry, "%i:%i%%", &xper, &yper) != 2)
+		    {
+		     RESET_GEOMETRY
+		     if(sscanf(vo_geometry, "%i%%:%i", &xper, &yper) != 2)
+		     {
+		     RESET_GEOMETRY
+		     if(sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) != 2)
+		     {
+		      RESET_GEOMETRY
+		      if(sscanf(vo_geometry, "%i%%", &xper) != 1)
 			return geometry_error();
-
-		if(xper >= 0 && xper <= 100) xoff = (scrw - vidw) * ((float)xper / 100.0);
-		if(yper >= 0 && yper <= 100) yoff = (scrh - vidh) * ((float)yper / 100.0);
+		     }
+		    }
+		   }
+		  }
+		 }
+		}
+	       }
+
+		mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i,"
+		  "height: %i, xoff: %i, yoff: %i, xper: %1, yper: %i\n",
+		  width, height, xoff, yoff, xper, yper);
+		  
+		if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0);
+		if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0);
 
 		/* FIXME: better checking of bounds... */
-		if(width < 0 || width > scrw) width = vidw;
-		if(height < 0 || height > scrh) height = vidh;
-		if(xoff < 0 || xoff + vidw > scrw) xoff = 0;
-		if(yoff < 0 || yoff + vidh > scrh) yoff = 0;
+		if(width < 0 || width > scrw) width = *widw;
+		if(height < 0 || height > scrh) height = *widh;
+		if(xoff < 0 || xoff + *widw > scrw) xoff = 0;
+		if(yoff < 0 || yoff + *widh > scrh) yoff = 0;
 
 		if(xpos) *xpos = xoff;
 		if(ypos) *ypos = yoff;
-		if(pwidth) *pwidth = width;
-		if(pheight) *pheight = height;
+		if(widw) *widw = width;
+		if(widh) *widh = height;
         }
 	return 1;
 }
 
-// compatibility function
-// only libvo working with full geometry options.
-int geometry(int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh)
-{
-  return geometryFull(NULL, NULL, xpos, ypos, scrw, scrh, vidw, vidh);
-}
+#undef RESET_GEOMETRY

Index: geometry.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/geometry.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- geometry.h	3 Jan 2003 20:46:44 -0000	1.3
+++ geometry.h	2 Mar 2003 21:09:15 -0000	1.4
@@ -3,7 +3,5 @@
 #define __GEOMETRY_H
 
 extern char *vo_geometry;
-int geometryFull(int *pwidth, int *pheight, int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh);
-int geometry(int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh);
-
+int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh);
 #endif /* !__GEOMETRY_H */

Index: vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- vo_fbdev.c	12 Jan 2003 17:59:47 -0000	1.77
+++ vo_fbdev.c	2 Mar 2003 21:09:15 -0000	1.78
@@ -1046,7 +1046,9 @@
 		if(fb_yres > image_height)
 		    y_offset = (fb_yres - image_height) / 2;
 		else y_offset = 0;
-		geometry(&x_offset,&y_offset,fb_xres,fb_yres,image_width,image_height);
+
+		//FIXME: update geometry code
+		//geometry(&x_offset,&y_offset,fb_xres,fb_yres,image_width,image_height);
 
 		if(vidix_init(width,height,x_offset,y_offset,image_width,
 			    image_height,format,fb_bpp,
@@ -1070,7 +1072,8 @@
 		return 1;
 	    }
 
-	    geometry(&x_offset,&y_offset,fb_xres,fb_yres,out_width,out_height);
+	    //FIXME: update geometry code
+	    //geometry(&x_offset,&y_offset,fb_xres,fb_yres,out_width,out_height);
 
 	    L123123875 = frame_buffer + (out_width - in_width) * fb_pixel_size /
 		    2 + ( (out_height - in_height) / 2 ) * fb_line_len +

Index: vo_tdfxfb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_tdfxfb.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- vo_tdfxfb.c	3 Jan 2003 20:46:44 -0000	1.23
+++ vo_tdfxfb.c	2 Mar 2003 21:09:15 -0000	1.24
@@ -204,7 +204,9 @@
 static void setup_screen(uint32_t full)
 {
 	aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);
-	geometry(&vidx, &vidy, screenwidth, screenheight, vidwidth, vidheight);
+
+	//FIXME: update geometry code
+	//geometry(&vidx, &vidy, screenwidth, screenheight, vidwidth, vidheight);
 	vo_fs = full;
 	clear_screen();
 }

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- vo_xv.c	9 Feb 2003 21:35:27 -0000	1.137
+++ vo_xv.c	2 Mar 2003 21:09:15 -0000	1.138
@@ -282,7 +282,7 @@
  vo_mouse_autohide=1;
 
  vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
- geometry(&vo_dx, &vo_dy, vo_screenwidth, vo_screenheight, d_width, d_height);
+ geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
  vo_dwidth=d_width; vo_dheight=d_height;
      
 #ifdef HAVE_XF86VM



More information about the MPlayer-cvslog mailing list