[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.52,1.53 vo_xv.c,1.49,1.50

Arpi of Ize arpi at mplayer.dev.hu
Thu Jan 31 01:38:02 CET 2002


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv27389

Modified Files:
	vo_x11.c vo_xv.c 
Log Message:
using the common -vm code, patch by Santi Béjar <tiarda at yahoo.es>

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- vo_x11.c	30 Jan 2002 15:26:11 -0000	1.52
+++ vo_x11.c	31 Jan 2002 00:37:59 -0000	1.53
@@ -59,10 +59,6 @@
 /* local data */
 static unsigned char *ImageData;
 
-#ifdef HAVE_XF86VM
-XF86VidModeModeInfo **vidmodes=NULL;
-#endif
-
 /* X11 related variables */
 //static Display *mDisplay;
 static Window mywindow;
@@ -256,7 +252,11 @@
  Colormap theCmap;
  XSetWindowAttributes xswa;
  unsigned long xswamask;
+#ifdef HAVE_XF86VM
  unsigned int modeline_width, modeline_height;
+ static uint32_t vm_width;
+ static uint32_t vm_height;
+#endif
 
  image_height=height;
  image_width=width;
@@ -298,61 +298,19 @@
     hint.width=image_width;
     hint.height=image_height;
  
-
-#ifdef HAVE_XF86VM
-    if (vm) {
-        unsigned int vm_event, vm_error;
-	unsigned int vm_ver, vm_rev;
-        int i,j,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 Extension not available.\n");
-
-    if (have_vm) {
-      if (vidmodes==NULL)
-        XF86VidModeGetAllModeLines(mDisplay,mScreen,&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,mScreen,0);
-      XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
-      XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
-      X=(vo_screenwidth-modeline_width)/2;
-      Y=(vo_screenheight-modeline_height)/2;
-      XF86VidModeSetViewPort(mDisplay,mScreen,X,Y);
-    }
-  }
-#endif
-
 #ifdef HAVE_XF86VM
     if ( vm )
-     {
-      hint.x=(vo_screenwidth-modeline_width)/2;
-      hint.y=(vo_screenheight-modeline_height)/2;
-      hint.width=modeline_width;
-      hint.height=modeline_height;
-     }
+   {
+	if ((d_width==0) && (d_height==0))
+	  { vm_width=image_width; vm_height=image_height; }
+	else
+	  { vm_width=d_width; vm_height=d_height; }
+	vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height);
+	hint.x=(vo_screenwidth-modeline_width)/2;
+	hint.y=(vo_screenheight-modeline_height)/2;
+	hint.width=modeline_width;
+	hint.height=modeline_height;
+   }
     else
 #endif
     if ( fullscreen )
@@ -642,19 +600,11 @@
  {
   XDestroyWindow( mDisplay,mywindow );
  } 
+
 #ifdef HAVE_XF86VM
- #ifdef HAVE_NEW_GUI
-        if ((vidmodes!=NULL)&&( vo_window == None ) )
- #else
-        if (vidmodes!=NULL)
- #endif
-        {
-          int screen; screen=DefaultScreen( mDisplay );
-          XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
-          XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
-          free(vidmodes);
-        }
+ vo_vm_close(mDisplay);
 #endif
+
 printf("vo: uninit!\n");
 }
 

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- vo_xv.c	29 Jan 2002 10:07:05 -0000	1.49
+++ vo_xv.c	31 Jan 2002 00:37:59 -0000	1.50
@@ -321,6 +321,12 @@
  XGCValues xgcv;
  XSetWindowAttributes xswa;
  unsigned long xswamask;
+#ifdef HAVE_XF86VM
+ int vm=0;
+ unsigned int modeline_width, modeline_height;
+ static uint32_t vm_width;
+ static uint32_t vm_height;
+#endif
 
  aspect_save_orig(width,height);
  aspect_save_prescale(d_width,d_height);
@@ -335,6 +341,7 @@
 #endif
 
  mFullscreen=flags&1;
+ if( flags&0x02 ) vm = 1;
  num_buffers=vo_doublebuffering?NUM_BUFFERS:1;
  
  if (!vo_init()) return -1;
@@ -350,7 +357,21 @@
    hint.width = d_width;
    hint.height = d_height;
    aspect(&d_width,&d_height,A_NOZOOM);
-
+#ifdef HAVE_XF86VM
+    if ( vm )
+      {
+	if ((d_width==0) && (d_height==0))
+	  { vm_width=image_width; vm_height=image_height; }
+	else
+	  { vm_width=d_width; vm_height=d_height; }
+	vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height);
+	hint.x=(vo_screenwidth-modeline_width)/2;
+	hint.y=(vo_screenheight-modeline_height)/2;
+	hint.width=modeline_width;
+	hint.height=modeline_height;
+      }
+    else
+#endif
    if ( mFullscreen )
     {
      hint.width=vo_screenwidth;
@@ -401,6 +422,17 @@
    mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv);
    XFlush(mDisplay);
    XSync(mDisplay, False);
+#ifdef HAVE_XF86VM
+    if ( vm )
+     {
+      /* Grab the mouse pointer in our window */
+      XGrabPointer(mDisplay, mywindow, True, 0,
+                   GrabModeAsync, GrabModeAsync,
+                   mywindow, None, CurrentTime);
+      XSetInputFocus(mDisplay, mywindow, RevertToNone, CurrentTime);
+     }
+#endif
+
 #ifdef HAVE_NEW_GUI
   }
   else
@@ -720,6 +752,10 @@
   XDestroyWindow( mDisplay,mywindow );
  }
  for( i=0;i<num_buffers;i++ ) deallocate_xvimage( i );
+#ifdef HAVE_XF86VM
+ vo_vm_close(mDisplay);
+#endif
+
 }
 
 static uint32_t preinit(const char *arg)




More information about the MPlayer-cvslog mailing list