[Mplayer-cvslog] CVS: main/libvo aspect.c,1.15,1.16 geometry.c,1.10,1.11 geometry.h,1.4,1.5

Attila Kinali CVS attila at mplayerhq.hu
Wed Oct 15 17:17:38 CEST 2003


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

Modified Files:
	aspect.c geometry.c geometry.h 
Log Message:
fix aspect hack
now geometry sets geometry_wh_changed when either width or height is changed.
aspect is still preserved in fullscreen



Index: aspect.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/aspect.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- aspect.c	4 Oct 2003 17:29:04 -0000	1.15
+++ aspect.c	15 Oct 2003 15:17:09 -0000	1.16
@@ -1,5 +1,6 @@
 /* Stuff for correct aspect scaling. */
 #include "aspect.h"
+#include "geometry.h"
 #ifndef ASPECT_TEST
 #include "../mp_msg.h"
 #endif
@@ -60,12 +61,13 @@
 void aspect(int *srcw, int *srch, int zoom){
   int tmpw;
 
-  if(!zoom && movie_aspect == 0) {
+  if( !zoom && geometry_wh_changed ) {
 #ifdef ASPECT_DEBUG
     printf("aspect(0) no aspect forced!\n");
 #endif
     return; // the user doesn't want to fix aspect
   }
+
 #ifdef ASPECT_DEBUG
   printf("aspect(0) fitin: %dx%d zoom: %d screenaspect: %.2f\n",aspdat.scrw,aspdat.scrh,
       zoom,monitor_aspect);

Index: geometry.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/geometry.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- geometry.c	31 Aug 2003 18:33:02 -0000	1.10
+++ geometry.c	15 Oct 2003 15:17:09 -0000	1.11
@@ -7,6 +7,8 @@
 
 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */
 char *vo_geometry = NULL;
+// set when either width or height is changed
+int geometry_wh_changed = 0;
 
 #define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1;
 
@@ -69,15 +71,20 @@
 		  " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh);
 		  
 		/* FIXME: better checking of bounds... */
-		if(width < 0 || width > scrw) width = (scrw < *widw) ? scrw : *widw;
-		if(height < 0 || height > scrh) height = (scrh < *widh) ? scrh : *widh;
-		if(xoff < 0 || xoff + width > scrw) xoff = 0;
-		if(yoff < 0 || yoff + height > scrh) yoff = 0;
-
-		if(xpos) *xpos = xoff;
-		if(ypos) *ypos = yoff;
-		if(widw) *widw = width;
-		if(widh) *widh = height;
+		if( width != -1 && (width < 0 || width > scrw))
+		    width = (scrw < *widw) ? scrw : *widw;
+		if( height != -1 && (height < 0 || height > scrh))
+		    height = (scrh < *widh) ? scrh : *widh;
+		if(xoff != -1 && (xoff < 0 || xoff + width > scrw)) xoff = 0;
+		if(yoff != -1 && (yoff < 0 || yoff + height > scrh)) yoff = 0;
+
+		if(xoff != -1 && xpos) *xpos = xoff;
+		if(yoff != -1 && ypos) *ypos = yoff;
+		if(width != -1 && widw) *widw = width;
+		if(height != -1 && widh) *widh = height;
+
+		if( width != -1 || height != -1)
+		    geometry_wh_changed = 1;
         }
 	return 1;
 }

Index: geometry.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/geometry.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- geometry.h	2 Mar 2003 21:09:15 -0000	1.4
+++ geometry.h	15 Oct 2003 15:17:09 -0000	1.5
@@ -3,5 +3,6 @@
 #define __GEOMETRY_H
 
 extern char *vo_geometry;
+extern int geometry_wh_changed;
 int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh);
 #endif /* !__GEOMETRY_H */



More information about the MPlayer-cvslog mailing list