Mercurial > mplayer.hg
changeset 5945:f9fe22a52e80
fix aspect ratio handling
author | pontscho |
---|---|
date | Fri, 03 May 2002 13:12:46 +0000 |
parents | 1faf2566907b |
children | 9243f7464324 |
files | Gui/interface.c libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c |
diffstat | 4 files changed, 34 insertions(+), 99 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/interface.c Fri May 03 12:56:29 2002 +0000 +++ b/Gui/interface.c Fri May 03 13:12:46 2002 +0000 @@ -99,7 +99,7 @@ if ( arg ) { tmp_sh_video_t * sh_video = (tmp_sh_video_t *)arg; - mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h ); + mplResizeToMovieSize( vo_dwidth,vo_dheight ); guiIntfStruct.MovieWidth=sh_video->disp_w; guiIntfStruct.MovieHeight=sh_video->disp_h; }
--- a/libvo/vo_x11.c Fri May 03 12:56:29 2002 +0000 +++ b/libvo/vo_x11.c Fri May 03 13:12:46 2002 +0000 @@ -250,6 +250,7 @@ if(in_format==IMGFMT_I420 || in_format==IMGFMT_IYUV) in_format=IMGFMT_YV12; srcW= width; srcH= height; + vo_dwidth=width; vo_dheight=height; if( flags&0x03 ) fullscreen = 1; if( flags&0x02 ) vm = 1; @@ -622,14 +623,6 @@ return 0; } -#if 0 -/* for runtime fullscreen switching */ -static int vo_fs_oldx = -1; -static int vo_fs_oldy = -1; -static int vo_fs_oldwidth = -1; -static int vo_fs_oldheight = -1; -#endif - static uint32_t control(uint32_t request, void *data, ...) { switch (request) { @@ -641,55 +634,6 @@ return get_image(data); case VOCTRL_FULLSCREEN: vo_x11_fullscreen(); -/* - if ((vo_fs_oldwidth == -1) && (vo_fs_oldheight == -1)) - { - int foo; - Window root; - -#ifdef LOCAL_LOOKUP - XGetGeometry(mDisplay, vo_window, &root, &foo, &foo, - &vo_fs_oldwidth, &vo_fs_oldheight, &foo, &foo); - - XTranslateCoordinates(mDisplay, vo_window, root, 0, 0, - &vo_fs_oldx, &vo_fs_oldy,(Window *) &foo); -#else - vo_fs_oldwidth = vo_dwidth; - vo_fs_oldheight = vo_dheight; - vo_fs_oldx = vo_dx; - vo_fs_oldy = vo_dy; -#endif - - mp_msg(MSGT_VO,MSGL_V,"X11 Fullscreen: saved old place: %dx%d-%dx%d\n", - vo_fs_oldx, vo_fs_oldy, vo_fs_oldwidth, vo_fs_oldheight); - - // resize - vo_dwidth = vo_screenwidth; - vo_dheight = vo_screenheight; - vo_x11_decoration( mDisplay,vo_window,0 ); - XMoveResizeWindow(mDisplay, vo_window, 0, 0, - vo_screenwidth, vo_screenheight); - XSync(mDisplay, False); - } - else - { - vo_x11_decoration( mDisplay,vo_window,1 ); - XMoveResizeWindow(mDisplay, vo_window, vo_fs_oldx, vo_fs_oldy, - vo_fs_oldwidth, vo_fs_oldheight); - - -#ifdef LOCAL_LOOKUP - // restore - vo_dwidth = vo_fs_oldwidth; - vo_dheight = vo_fs_oldheight; -#endif - - // clean - vo_fs_oldwidth = -1; - vo_fs_oldheight = -1; - XSync(mDisplay, False); - } -*/ return VO_TRUE; } return VO_NOTIMPL;
--- a/libvo/vo_xmga.c Fri May 03 12:56:29 2002 +0000 +++ b/libvo/vo_xmga.c Fri May 03 13:12:46 2002 +0000 @@ -76,8 +76,6 @@ static XWindowAttributes attribs; static uint32_t X_already_started=0; -static uint32_t wndHeight; -static uint32_t wndWidth; static uint32_t wndX; static uint32_t wndY; @@ -109,7 +107,7 @@ XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); fprintf( stderr,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight ); - drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; + drwX=0; drwY=0; XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); @@ -164,8 +162,8 @@ { int e=vo_x11_check_events(mDisplay); if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return; + set_window(); if(e&VO_EVENT_EXPOSE) mDrawColorKey(); - set_window(); if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) printf( "Error in mga_vid_config ioctl (wrong mga_vid.o version?)" ); } @@ -239,7 +237,6 @@ mvWidth=width; mvHeight=height; wndX=0; wndY=0; - wndWidth=d_width; wndHeight=d_height; vo_fs=fullscreen&1; vo_dwidth=d_width; vo_dheight=d_height; if ( vo_fs ) @@ -256,20 +253,20 @@ inited=1; - aspect(&d_width,&d_height,A_NOZOOM); + aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); #ifdef HAVE_NEW_GUI if ( vo_window == None ) { #endif if ( vo_fs ) { - wndWidth=vo_screenwidth; - wndHeight=vo_screenheight; + vo_dwidth=vo_screenwidth; + vo_dheight=vo_screenheight; #ifdef X11_FULLSCREEN - aspect(&d_width,&d_height,A_ZOOM); + aspect(&vo_dwidth,&vo_dheight,A_ZOOM); #endif } - dwidth=d_width; dheight=d_height; + dwidth=vo_dwidth; dheight=vo_dheight; XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs ); mDepth=attribs.depth; @@ -289,7 +286,7 @@ } else vo_window=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ), wndX,wndY, - wndWidth,wndHeight, + vo_dwidth,vo_dheight, xWAttribs.border_pixel, mDepth, InputOutput,
--- a/libvo/vo_xv.c Fri May 03 12:56:29 2002 +0000 +++ b/libvo/vo_xv.c Fri May 03 13:12:46 2002 +0000 @@ -91,8 +91,8 @@ static int flip_flag; static Window mRoot; -static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; -static uint32_t drwcX,drwcY,dwidth,dheight; +static uint32_t drwX,drwY,drwBorderWidth,drwDepth; +static uint32_t dwidth,dheight; static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); @@ -331,6 +331,7 @@ image_width = width; image_format=format; + vo_dwidth=d_width; vo_dheight=d_height; vo_fs=flags&1; if ( vo_fs ) { vo_old_width=d_width; vo_old_height=d_height; } @@ -393,7 +394,8 @@ #endif } - dwidth=d_width; dheight=d_height; //XXX: what are the copy vars used for? +// dwidth=d_width; dheight=d_height; //XXX: what are the copy vars used for? + vo_dwidth=d_width; vo_dheight=d_height; hint.flags = PPosition | PSize; XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); depth=attribs.depth; @@ -466,23 +468,19 @@ set_gamma_correction(); - XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); - drwX=0; drwY=0; - XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - mp_msg(MSGT_VO,MSGL_V, "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); - - aspect(&dwidth,&dheight,A_NOZOOM); + aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); if ( vo_fs ) { - aspect(&dwidth,&dheight,A_ZOOM); - drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; - drwcX+=drwX; - drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; - drwcY+=drwY; - drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); - drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); - mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + aspect(&vo_dwidth,&vo_dheight,A_ZOOM); + drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2; + drwY=( vo_screenheight - (vo_dheight > vo_screenheight?vo_screenheight:vo_dheight) ) / 2; + vo_dwidth=(vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth); + vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight); + mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); } + + mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); + saver_off(mDisplay); // turning off screen saver return 0; } @@ -548,22 +546,18 @@ int e=vo_x11_check_events(mDisplay); if(e&VO_EVENT_RESIZE) { - XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); - drwX=0; drwY=0; - XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - mp_msg(MSGT_VO,MSGL_V, "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&vo_dwidth,&vo_dheight,&drwBorderWidth,&drwDepth ); + mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); aspect(&dwidth,&dheight,A_NOZOOM); if ( vo_fs ) { aspect(&dwidth,&dheight,A_ZOOM); drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; - drwcX+=drwX; drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; - drwcY+=drwY; - drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); - drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); - mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + vo_dwidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); + vo_dheight=(dheight > vo_screenheight?vo_screenheight:dheight); + mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); } } if ( e & VO_EVENT_EXPOSE ) @@ -571,12 +565,12 @@ if ( Shmem_Flag ) { XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX, drwY, 1, 1, False); - XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight), False); + XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX,drwY,vo_dwidth,(vo_fs?vo_dheight - 1:vo_dheight), False); } else { XvPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX, drwY, 1, 1); - XvPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight)); + XvPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, drwX,drwY,vo_dwidth,(vo_fs?vo_dheight - 1:vo_dheight)); } } } @@ -590,14 +584,14 @@ { XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, - drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight), + drwX,drwY,vo_dwidth,(vo_fs?vo_dheight - 1:vo_dheight), False); } else { XvPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf], 0, 0, image_width, image_height, - drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight)); + drwX,drwY,vo_dwidth,(vo_fs?vo_dheight - 1:vo_dheight)); } if (num_buffers>1){ current_buf=(current_buf+1)%num_buffers;