[Mplayer-cvslog] CVS: main/libvo vo_dga.c,1.2,1.3

Michael Graffam mgraffam at users.sourceforge.net
Tue Mar 27 06:29:24 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv31849/libvo

Modified Files:
	vo_dga.c 
Log Message:
Added support to vo_dga to change the video mode to the lowest resolution
that is larger (or equal to) the video stream. Also, by using the -x and -y
options the user can specify a specific video mode. Changed the 
DOCS/AUTHORS file to reflect this patch so that flames get sent to me :)


Index: vo_dga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dga.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** vo_dga.c	2001/03/03 21:46:39	1.2
--- vo_dga.c	2001/03/27 04:29:22	1.3
***************
*** 242,245 ****
--- 242,250 ----
    int x_off, y_off;
  
+ // needed to change DGA video mode
+   int modecount,mX, mY, X, Y, i,j;
+   XDGAMode *modelines=NULL;
+   XDGADevice *dgadevice;
+ 
    if( vo_dga_is_running )return -1;
  
***************
*** 255,263 ****
    } 
  
    XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
                    (char **)&vo_dga_base, &vo_dga_width, &bank, &ram);
-   XF86DGAGetViewPortSize (vo_dga_dpy, XDefaultScreen (vo_dga_dpy),
- 			  &vo_dga_vp_width, &vo_dga_vp_height);
  
    
    // do some more checkings here ...
--- 260,305 ----
    } 
  
+ // Code to change the video mode added by Michael Graffam
+ // mgraffam at idsi.net
+   if (modelines==NULL)
+     modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount);
+   
+   mX=modelines[0].imageWidth;
+   mY=modelines[0].imageHeight;
+   X=d_width; Y=d_height; 
+   
+   j=0; 
+   for (i=1; i<=modecount; i++)
+   {
+     if ( (modelines[i].bitsPerPixel == vo_depthonscreen) && 
+          (modelines[i].maxViewportX) && 
+          (modelines[i].viewportWidth >= X) && 
+          (modelines[i].viewportHeight >= Y) && 
+          (modelines[i].viewportWidth < mX) &&
+          (modelines[i].viewportHeight < mY) ) 
+         {
+            mX=modelines[i].viewportWidth;
+            mY=modelines[i].viewportHeight;
+            j=i;
+         }
+    }
+   X=(modelines[j].imageWidth-mX)/2;
+   Y=(modelines[j].imageHeight-mY)/2;
+   printf("vo_dga: Selected video mode %dx%d for image size %dx%d.\n", mX, mY,width, height);  
+ 
+   XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), X,Y);
+   dgadevice=XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), modelines[j].num);
+   XDGASync(vo_dga_dpy, XDefaultScreen(vo_dga_dpy));
+ 
+   XFree(modelines);
+   XFree(dgadevice);
+ 
+ // end mode change code
+ 
    XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
                    (char **)&vo_dga_base, &vo_dga_width, &bank, &ram);
  
+   vo_dga_vp_width=modelines[j].viewportWidth;
+   vo_dga_vp_height=modelines[j].viewportHeight;
    
    // do some more checkings here ...
***************
*** 299,304 ****
  
  
-   
-   XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0);
    XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
                        XF86DGADirectGraphics | XF86DGADirectMouse | 
--- 341,344 ----


_______________________________________________
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