[Mplayer-users] All non 4:3 movies in -vo sdl starts ungly resized

Ivan Kalvatchev iive at yahoo.com
Fri Sep 7 17:22:02 CEST 2001


This is based on MPlayer-2001 09 05 source.
I have played a little with source to fix this bug on
my own. The problem is located in vo_sdl.c::init().
This function is called with equal src and dst. Then
16:9 patch makes some calculations and change dst
height. Then aspect() messes the things completely.
That i do. Remove 16:9 calculation from init() and
set_fullmode().
Remove all 16:9 Monitor calculations from aspect(). At
the bottom is modified version of aspect() that i test
today. For me it works perfectly.
Now in 16:9 video mode and 4:3 monitor won't be
resized correctly. To fix that a command line switch
is needed. And new function with name like
change_aspect(). You can extend it and with custom
values.
By the way a function to keep aspect when resizing
window, was wanted from users. The answer was "if you
know X11 do it your self". With SDL and aspect() it is
possible.

//This function keeps srcw/srch aspect and tries to
put src image in dst window. The x,y are calculated in
order to put src image in center of dst.
//I have not found x,y to be used in vo_sdl.c, but
maybe i am wrong.
//---------------------------------------------------------------
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);
	if(srcw*dsth<srch*dstw) //true if dest is wider
	{
	    newres.w = dsth*srcw/srch;
	    newres.h = dsth;
	    newres.x= (dstw - newres.w) / 2;
	    newres.y= 0;
	}
	else//false if dest is narrow
	{ 
	    newres.w = dstw;
	    newres.h = dstw*srch/srcw;
	    newres.x = 0;
	    newres.y = (dsth - newres.h) / 2;
	}
	
	if(verbose) printf("SDL Aspect-Destinationres: %ix%i
(x: %i, y: %i)\n", newres.w, newres.h, newres.x,
newres.y);

	return newres;
}


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

_______________________________________________
Mplayer-users mailing list
Mplayer-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mplayer-users



More information about the MPlayer-users mailing list