[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.96,1.97 vo_xmga.c,1.59,1.60 vo_xv.c,1.77,1.78
Zoltan Ponekker
pontscho at mplayerhq.hu
Fri May 3 15:12:49 CEST 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv7359/libvo
Modified Files:
vo_x11.c vo_xmga.c vo_xv.c
Log Message:
fix aspect ratio handling
Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- vo_x11.c 2 May 2002 10:49:55 -0000 1.96
+++ vo_x11.c 3 May 2002 13:12:46 -0000 1.97
@@ -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;
Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- vo_xmga.c 25 Apr 2002 21:52:47 -0000 1.59
+++ vo_xmga.c 3 May 2002 13:12:46 -0000 1.60
@@ -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;
- if(e&VO_EVENT_EXPOSE) mDrawColorKey();
set_window();
+ if(e&VO_EVENT_EXPOSE) mDrawColorKey();
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,
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- vo_xv.c 2 May 2002 10:48:22 -0000 1.77
+++ vo_xv.c 3 May 2002 13:12:46 -0000 1.78
@@ -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);
@@ -330,6 +330,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; }
@@ -392,7 +393,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;
@@ -465,23 +467,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;
}
@@ -547,22 +545,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 )
@@ -570,12 +564,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));
}
}
}
@@ -589,14 +583,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;
More information about the MPlayer-cvslog
mailing list