[Mplayer-cvslog] CVS: main/libvo mga_common.c,1.47,1.48 vo_xmga.c,1.80,1.81
Arpi of Ize
arpi at mplayerhq.hu
Fri Nov 1 01:21:49 CET 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv15149
Modified Files:
mga_common.c vo_xmga.c
Log Message:
panscan support in -vo mga (actually moved common code to mga_common.c)
Ivan Szanto <szivan at duticai.TWI.TUDelft.NL>
Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- mga_common.c 17 Oct 2002 09:49:25 -0000 1.47
+++ mga_common.c 1 Nov 2002 00:21:45 -0000 1.48
@@ -2,10 +2,12 @@
#include "fastmemcpy.h"
#include "../mmx_defs.h"
#include "../postproc/rgb2rgb.h"
+#include "mp_msg.h"
// mga_vid drawing functions
+static void set_window( void ); /* forward declaration to kill warnings */
#ifdef VO_XMGA
-static void set_window( void ); /* forward declaration to kill warnings */
+static void mDrawColorKey( void ); /* forward declaration to kill warnings */
#endif
static int mga_next_frame=0;
@@ -14,6 +16,9 @@
static uint8_t *vid_data, *frames[4];
static int f = -1;
+static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
+static uint32_t drwcX,drwcY,dwidth,dheight;
+
static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
switch(mga_vid_config.format){
@@ -297,6 +302,9 @@
else
printf("Screen width/height unknown!\n");
return VO_TRUE;
+ case VOCTRL_GET_PANSCAN:
+ if ( !vo_fs ) return VO_FALSE;
+ return VO_TRUE;
#endif
#if defined( VO_XMGA ) && defined( HAVE_NEW_GUI )
@@ -312,6 +320,7 @@
vo_x11_fullscreen();
vo_panscan_amount=0;
/* indended, fallthrough to update panscan on fullscreen/windowed switch */
+#endif
case VOCTRL_SET_PANSCAN:
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) // || ( !vo_fs && vo_panscan_amount ) )
{
@@ -321,7 +330,6 @@
set_window();
}
return VO_TRUE;
-#endif
}
return VO_NOTIMPL;
}
@@ -416,3 +424,84 @@
return 0;
}
+static void set_window( void ){
+
+#ifdef VO_XMGA
+ if ( WinID )
+ {
+ XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
+ mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
+ drwX=0; drwY=0;
+ XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
+ mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+
+ }
+ else
+#endif
+ { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=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,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+ }
+ vo_dwidth=drwWidth; vo_dheight=drwHeight;
+
+#ifdef VO_XMGA
+#ifdef HAVE_XINERAMA
+ if(XineramaIsActive(mDisplay))
+ {
+ XineramaScreenInfo *screens;
+ int num_screens;
+ int i;
+
+ screens = XineramaQueryScreens(mDisplay,&num_screens);
+
+ /* find the screen we are on */
+ i = 0;
+ while(!(screens[i].x_org <= drwcX && screens[i].y_org <= drwcY &&
+ screens[i].x_org + screens[i].width >= drwcX &&
+ screens[i].y_org + screens[i].height >= drwcY ))
+ {
+ i++;
+ }
+
+ /* set drwcX and drwcY to the right values */
+ drwcX = drwcX - screens[i].x_org;
+ drwcY = drwcY - screens[i].y_org;
+ XFree(screens);
+ }
+
+#endif
+
+ mDrawColorKey();
+#endif
+
+ mga_vid_config.x_org=drwcX;
+ mga_vid_config.y_org=drwcY;
+ mga_vid_config.dest_width=drwWidth;
+ mga_vid_config.dest_height=drwHeight;
+ if ( vo_panscan > 0.0f && vo_fs )
+ {
+ drwX-=vo_panscan_x>>1;
+ drwY-=vo_panscan_y>>1;
+ drwWidth+=vo_panscan_x;
+ drwHeight+=vo_panscan_y;
+
+ mga_vid_config.x_org-=vo_panscan_x>>1;
+ mga_vid_config.y_org-=vo_panscan_y>>1;
+ mga_vid_config.dest_width=drwWidth;
+ mga_vid_config.dest_height=drwHeight;
+#ifdef VO_XMGA
+ mDrawColorKey();
+#endif
+ if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
+ }
+}
Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- vo_xmga.c 17 Oct 2002 09:49:25 -0000 1.80
+++ vo_xmga.c 1 Nov 2002 00:21:45 -0000 1.81
@@ -13,7 +13,6 @@
#include <string.h>
#include "config.h"
-#include "mp_msg.h"
#include "video_out.h"
#include "video_out_internal.h"
@@ -67,8 +66,6 @@
static uint32_t mvWidth;
static Window mRoot;
-static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
-static uint32_t drwcX,drwcY,dwidth,dheight;
static XSetWindowAttributes xWAttribs;
@@ -85,80 +82,6 @@
XSetForeground( mDisplay,vo_gc,fgColor );
XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
XFlush( mDisplay );
-}
-
-static void set_window( void ){
-
- if ( WinID )
- {
- XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
- mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
- drwX=0; drwY=0;
- XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
- mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
- }
- else { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=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,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
- }
- vo_dwidth=drwWidth; vo_dheight=drwHeight;
-
-#ifdef HAVE_XINERAMA
- if(XineramaIsActive(mDisplay))
- {
- XineramaScreenInfo *screens;
- int num_screens;
- int i;
-
- screens = XineramaQueryScreens(mDisplay,&num_screens);
-
- /* find the screen we are on */
- i = 0;
- while(!(screens[i].x_org <= drwcX && screens[i].y_org <= drwcY &&
- screens[i].x_org + screens[i].width >= drwcX &&
- screens[i].y_org + screens[i].height >= drwcY ))
- {
- i++;
- }
-
- /* set drwcX and drwcY to the right values */
- drwcX = drwcX - screens[i].x_org;
- drwcY = drwcY - screens[i].y_org;
- XFree(screens);
- }
-
-#endif
-
- mDrawColorKey();
-
- mga_vid_config.x_org=drwcX;
- mga_vid_config.y_org=drwcY;
- mga_vid_config.dest_width=drwWidth;
- mga_vid_config.dest_height=drwHeight;
- if ( vo_panscan > 0.0f && vo_fs )
- {
- drwX-=vo_panscan_x>>1;
- drwY-=vo_panscan_y>>1;
- drwWidth+=vo_panscan_x;
- drwHeight+=vo_panscan_y;
-
- mga_vid_config.x_org-=vo_panscan_x>>1;
- mga_vid_config.y_org-=vo_panscan_y>>1;
- mga_vid_config.dest_width=drwWidth;
- mga_vid_config.dest_height=drwHeight;
- mDrawColorKey();
- if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
- }
}
static void check_events(void)
More information about the MPlayer-cvslog
mailing list