[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.3,1.4
Michael Graffam
mgraffam at users.sourceforge.net
Sat Mar 24 22:31:40 CET 2001
Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv22060/libvo
Modified Files:
vo_x11.c
Log Message:
adds XF86VidMode support to vo_x11.c to do "pseudo-scaling"
uses d_width, d_height when in fullscreen mode to switch to a
desired modeline.
Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** vo_x11.c 2001/03/24 04:35:45 1.3
--- vo_x11.c 2001/03/24 21:31:37 1.4
***************
*** 29,32 ****
--- 29,35 ----
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
+ #ifdef HAVE_XF86VM
+ #include <X11/extensions/xf86vmode.h>
+ #endif
#include <errno.h>
#include "yuv2rgb.h"
***************
*** 51,54 ****
--- 54,61 ----
static unsigned char *ImageData;
+ #ifdef HAVE_XF86VM
+ XF86VidModeModeInfo **vidmodes=NULL;
+ #endif
+
/* X11 related variables */
static Display *mDisplay;
***************
*** 139,142 ****
--- 146,197 ----
hint.width=image_width;
hint.height=image_height;
+
+ #ifdef HAVE_XF86VM
+ if (fullscreen) {
+ unsigned int modeline_width, modeline_height, vm_event, vm_error;
+ unsigned int vm_ver, vm_rev;
+ int i,j,k,have_vm=0,X,Y;
+
+ int modecount;
+
+ if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
+ XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
+ printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
+ have_vm=1;
+ } else
+ printf("XF86VidMode Extenstion not available.\n");
+
+ if (have_vm) {
+ if (vidmodes==NULL)
+ XF86VidModeGetAllModeLines(mDisplay,screen,&modecount,&vidmodes);
+ j=0;
+ modeline_width=vidmodes[0]->hdisplay;
+ modeline_height=vidmodes[0]->vdisplay;
+ if ((d_width==0) && (d_height==0))
+ { X=image_width; Y=image_height; }
+ else
+ { X=d_width; Y=d_height; }
+
+ for (i=1; i<modecount; i++)
+ if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y))
+ if ( (vidmodes[i]->hdisplay < modeline_width ) && (vidmodes[i]->vdisplay < modeline_height) )
+ {
+ modeline_width=vidmodes[i]->hdisplay;
+ modeline_height=vidmodes[i]->vdisplay;
+ j=i;
+ }
+
+ printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",modeline_width, modeline_height, image_width, image_height);
+ XF86VidModeLockModeSwitch(mDisplay,screen,0);
+ XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]);
+ XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]);
+ X=(vo_screenwidth-modeline_width)/2;
+ Y=(vo_screenheight-modeline_height)/2;
+ XF86VidModeSetViewPort(mDisplay,screen,X,Y);
+ }
+ }
+ #endif
+
+
if ( fullscreen )
{
***************
*** 469,472 ****
--- 524,537 ----
uninit(void)
{
+ #ifdef HAVE_XF86VM
+ if (vidmodes!=NULL)
+ {
+ int screen; screen=DefaultScreen( mDisplay );
+ XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
+ XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
+ free(vidmodes);
+ }
+ #endif
+
printf("vo: uninit!\n");
}
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list