[Mplayer-cvslog] CVS: main/libvo aspect.c,1.3,1.4 vo_sdl.c,1.54,1.55

Atmosfear atmos4 at mplayer.dev.hu
Thu Oct 4 13:42:37 CEST 2001


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

Modified Files:
	aspect.c vo_sdl.c 
Log Message:
Add debug printfs to aspect(), add aspect() usage to vo_sdl.


Index: aspect.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/aspect.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- aspect.c	3 Oct 2001 17:40:56 -0000	1.3
+++ aspect.c	4 Oct 2001 11:42:21 -0000	1.4
@@ -1,4 +1,9 @@
 /* Stuff for correct aspect scaling. */
+#undef ASPECT_DEBUG
+
+#ifdef ASPECT_DEBUG
+#include <stdio.h>
+#endif
 
 float monitor_aspect=4.0/3.0;
 
@@ -10,17 +15,28 @@
   int srcwcp, srchcp;
   srcwcp=*srcw; srchcp=*srch;
   srcwcp=fitinw;
+#ifdef ASPECT_DEBUG
+  printf("aspect(0) fitin: %dx%d \n",fitinw,fitinh);
+  printf("aspect(1) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#endif
   srchcp=(int)(((float)fitinw / (float)*srcw * (float)*srch)
-            * ((float)fitinh/((float)fitinw/monitor_aspect)));
+            * ((float)fitinh / ((float)fitinw / monitor_aspect)));
   srchcp+=srchcp%2; // round
-  //printf("aspect rez wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#ifdef ASPECT_DEBUG
+  printf("aspect(2) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#endif
   if(srchcp>fitinh || srchcp<*srch){
     srchcp=fitinh;
     srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw)
-              * ((float)fitinw/((float)fitinh/(1/monitor_aspect))));
+              * ((float)fitinw / ((float)fitinh / (1/monitor_aspect))));
     srcwcp+=srcwcp%2; // round
   }
-  //printf("aspect ret wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#ifdef ASPECT_DEBUG
+  printf("aspect(3) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#endif
   *srcw=srcwcp; *srch=srchcp;
+#ifdef ASPECT_DEBUG
+  printf("aspect(4) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
+#endif
 }
 

Index: vo_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- vo_sdl.c	27 Aug 2001 11:49:10 -0000	1.54
+++ vo_sdl.c	4 Oct 2001 11:42:21 -0000	1.55
@@ -113,6 +113,7 @@
 
 #include "fastmemcpy.h"
 #include "sub.h"
+#include "aspect.h"
 
 #ifdef HAVE_X11
 #include <X11/Xlib.h>
@@ -487,6 +488,7 @@
  *  returns : SDL_Rect structure with new x and y, w and h
  **/
 
+#if 0
 static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) {
 	SDL_Rect newres;
 	if(verbose > 1) printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth);
@@ -507,6 +509,7 @@
 
 	return newres;
 }
+#endif
 
 /**
  * Sets the specified fullscreen mode.
@@ -552,25 +555,27 @@
 static void set_fullmode (int mode) {
 	struct sdl_priv_s *priv = &sdl_priv;
 	SDL_Surface *newsurface = NULL;
-	SDL_Rect newsize;
+	int newwidth = priv->dstwidth,
+	    newheight= priv->dstheight;
 	
 	/* if we haven't set a fullmode yet, default to the lowest res fullmode first */
 	if(mode < 0) 
 		mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1;
 	
 	/* calculate new video size/aspect */
+	if(!priv->mode) {
 	if(priv->fulltype&FS) {
-		newsize = aspect(priv->width, priv->height, priv->XWidth ? priv->XWidth : priv->dstwidth, priv->XHeight ? priv->XHeight : priv->dstheight);
+		aspect(&newwidth, &newheight, priv->XWidth ? priv->XWidth : priv->dstwidth, priv->XHeight ? priv->XHeight : priv->dstheight);
 	} else
 	if(priv->fulltype&VM) {	
-		newsize = aspect(priv->dstwidth, priv->dstheight, priv->dstwidth, priv->dstwidth*((float)priv->XHeight / (float)priv->XWidth));
-	}	
-	else {
-		newsize = aspect(priv->dstwidth, priv->dstheight, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h);
+		aspect(&newwidth, &newheight, priv->dstwidth, (int)((float)priv->dstwidth*((float)priv->XHeight / (float)priv->XWidth)));
+	} else {
+		aspect(&newwidth, &newheight, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h);
+	}
 	}
 
 	/* try to change to given fullscreenmode */
-	newsurface = SDL_SetVideoMode(newsize.w, newsize.h, priv->bpp, priv->sdlfullflags);
+	newsurface = SDL_SetVideoMode(newwidth, newheight, priv->bpp, priv->sdlfullflags);
 	
 	/* if creation of new surface was successfull, save it and hide mouse cursor */
 	if(newsurface) {
@@ -598,11 +603,11 @@
 {
 	struct sdl_priv_s *priv = &sdl_priv;
         unsigned int sdl_format;
-	SDL_Rect res;
 #ifdef HAVE_X11	
 	static Display *XDisplay;
 	static int XScreen;
 #endif
+	int newwidth, newheight;
 
 	sdl_format = format;
         switch(format){
@@ -679,7 +684,7 @@
 	    return -1;
 
 	/* Set output window title */
-	SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", "MPlayer's SDL Video Out");
+	SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title);
 	//SDL_WM_SetCaption (title, title);
 
 	/* Save the original Image size */
@@ -688,18 +693,17 @@
 	priv->height = height;
 	priv->dstwidth  = d_width ? d_width : width;
 	priv->dstheight = d_height ? d_height : height;
+	newwidth  = priv->dstwidth;
+	newheight = priv->dstheight;
 
 	/*priv->width  = res.w;
 	priv->height = res.h;*/
         priv->format = format;
 #ifdef HAVE_X11
-	res = aspect(priv->dstwidth, priv->dstheight, priv->dstwidth, priv->dstwidth*((float)priv->XHeight / (float)priv->XWidth));
-	priv->windowsize.w = res.w;
-  	priv->windowsize.h = res.h;
-#else		
-	priv->windowsize.w = priv->dstwidth;
-  	priv->windowsize.h = priv->dstheight;
+	aspect(&newwidth, &newheight, priv->dstwidth, (int)((float)priv->dstwidth*((float)priv->XHeight / (float)priv->XWidth)));
 #endif
+	priv->windowsize.w = newwidth;
+  	priv->windowsize.h = newheight;
         
 	/* bit 0 (0x01) means fullscreen (-fs)
 	 * bit 1 (0x02) means mode switching (-vm)
@@ -737,11 +741,7 @@
         else {
 		if((strcmp(priv->driver, "x11") == 0) || ((strcmp(priv->driver, "aalib") == 0) && priv->X)) {
 			if(verbose) printf("SDL: setting windowed mode\n");
-#ifdef HAVE_X11		
-          	priv->surface = SDL_SetVideoMode (res.w, res.h, priv->bpp, priv->sdlflags);
-#else			
-          	priv->surface = SDL_SetVideoMode (priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
-#endif
+          	priv->surface = SDL_SetVideoMode (newwidth, newheight, priv->bpp, priv->sdlflags);
 		}
 		else {
 			if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n");
@@ -873,7 +873,7 @@
 	uint8_t *dst;
 	int i;
 	uint8_t *mysrc = src[0];
-	
+
         switch(priv->format){
         case IMGFMT_YV12:
         case IMGFMT_I420:
@@ -1024,7 +1024,7 @@
 
 			/* capture window resize events */
 			case SDL_VIDEORESIZE:
-				priv->surface = SDL_SetVideoMode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags);
+				if(!priv->dblit) priv->surface = SDL_SetVideoMode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags);
 
 				/* save video extents, to restore them after going fullscreen */
 			 	//if(!(priv->surface->flags & SDL_FULLSCREEN)) {




More information about the MPlayer-cvslog mailing list