[Mplayer-cvslog] CVS: main/libvo mga_common.c,1.20,1.21 video_out.c,1.42,1.43 video_out.h,1.25,1.26 vo_xmga.c,1.49,1.50 vo_xv.c,1.60,1.61 vo_xvidix.c,1.23,1.24 x11_common.c,1.55,1.56 x11_common.h,1.15,1.16

Zoltan Ponekker pontscho at mplayer.dev.hu
Thu Mar 7 18:50:28 CET 2002


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

Modified Files:
	mga_common.c video_out.c video_out.h vo_xmga.c vo_xv.c 
	vo_xvidix.c x11_common.c x11_common.h 
Log Message:
rewrite fullscreen support in some libvo driver

Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mga_common.c	7 Mar 2002 13:02:35 -0000	1.20
+++ mga_common.c	7 Mar 2002 17:50:25 -0000	1.21
@@ -237,6 +237,11 @@
     return query_format(*((uint32_t*)data));
   case VOCTRL_GET_IMAGE:
     return get_image(data);
+#ifdef VO_XMGA
+  case VOCTRL_FULLSCREEN:
+    vo_x11_fullscreen();
+    return VO_TRUE;
+#endif
   }
   return VO_NOTIMPL;
 }

Index: video_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- video_out.c	22 Feb 2002 18:00:38 -0000	1.42
+++ video_out.c	7 Mar 2002 17:50:25 -0000	1.43
@@ -44,8 +44,15 @@
 int vo_dwidth=0;
 int vo_dheight=0;
 int vo_dbpp=0;
+
+int vo_old_x = 0;
+int vo_old_y = 0;
+int vo_old_width = 0;
+int vo_old_height = 0;
+
 int vo_doublebuffering = 0;
 int vo_vsync = 0;
+int vo_fs = 0;
 int vo_fsmode = 0;
 
 int vo_pts=0; // for hw decoding

Index: video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- video_out.h	7 Mar 2002 02:43:35 -0000	1.25
+++ video_out.h	7 Mar 2002 17:50:25 -0000	1.26
@@ -198,8 +198,14 @@
 extern int vo_dheight;
 extern int vo_dbpp;
 
+extern int vo_old_x;
+extern int vo_old_y; 
+extern int vo_old_width;
+extern int vo_old_height;
+
 extern int vo_doublebuffering;
 extern int vo_vsync;
+extern int vo_fs;
 extern int vo_fsmode;
 
 extern int vo_pts;

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- vo_xmga.c	7 Mar 2002 01:51:28 -0000	1.49
+++ vo_xmga.c	7 Mar 2002 17:50:25 -0000	1.50
@@ -88,7 +88,7 @@
 
 static Window                 mRoot;
 static uint32_t               drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
-static uint32_t               drwcX,drwcY,dwidth,dheight,mFullscreen;
+static uint32_t               drwcX,drwcY,dwidth,dheight;
 
 #ifdef HAVE_NEW_GUI
  static uint32_t               mdwidth,mdheight;
@@ -96,32 +96,27 @@
 
 static XSetWindowAttributes   xWAttribs;
 
+#define VO_XMGA
 #include "mga_common.c"
+#undef  VO_XMGA
 
 static void mDrawColorKey( void )
 {
  XSetBackground( mDisplay,vo_gc,0 );
  XClearWindow( mDisplay,vo_window );
  XSetForeground( mDisplay,vo_gc,fgColor );
- XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight) );
+ XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
  XFlush( mDisplay );
 }
 
 static void set_window(){
 
-         #ifdef HAVE_NEW_GUI
-          if ( vo_window != None )
-           {
-            mFullscreen=0;
-            dwidth=mdwidth; dheight=mdheight;
-            if ( ( vo_dwidth == vo_screenwidth )&&( vo_dheight == vo_screenheight ) )
-             {
-              mFullscreen=1;
-              dwidth=vo_screenwidth;
-              dheight=vo_screenwidth * mdheight / mdwidth;
-             }
-           }
-         #endif
+         dwidth=mdwidth; dheight=mdheight;
+         if ( vo_fs )
+	  {
+	   dwidth=vo_screenwidth;
+	   dheight=vo_screenwidth * mdheight / mdwidth;
+	  }
 
          XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
          drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight;
@@ -129,7 +124,7 @@
          fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
 
          aspect(&dwidth,&dheight,A_NOZOOM);
-         if ( mFullscreen )
+         if ( vo_fs )
           {
            aspect(&dwidth,&dheight,A_ZOOM);
            drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
@@ -262,7 +257,10 @@
 
  wndX=0; wndY=0;
  wndWidth=d_width; wndHeight=d_height;
- mFullscreen=fullscreen&1;
+ vo_fs=fullscreen&1;
+ vo_dwidth=d_width; vo_dheight=d_height;
+ if ( vo_fs )
+  { vo_old_width=d_width; vo_old_height=d_height; }
 
  switch ( vo_depthonscreen )
   {
@@ -279,7 +277,7 @@
  if ( vo_window == None )
   {
 #endif
-   if ( mFullscreen )
+   if ( vo_fs )
     {
      wndWidth=vo_screenwidth;
      wndHeight=vo_screenheight;
@@ -314,7 +312,7 @@
    vo_x11_classhint( mDisplay,vo_window,"xmga" );
    vo_hidecursor(mDisplay,vo_window);
 
-   if ( mFullscreen ) vo_x11_decoration( mDisplay,vo_window,0 );
+   if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 );
 
    XGetNormalHints( mDisplay,vo_window,&hint );
    hint.x=wndX; hint.y=wndY;

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- vo_xv.c	7 Mar 2002 16:57:40 -0000	1.60
+++ vo_xv.c	7 Mar 2002 17:50:25 -0000	1.61
@@ -92,7 +92,7 @@
 
 static Window                 mRoot;
 static uint32_t               drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
-static uint32_t               drwcX,drwcY,dwidth,dheight,mFullscreen;
+static uint32_t               drwcX,drwcY,dwidth,dheight;
 
 #ifdef HAVE_NEW_GUI
  static uint32_t               mdwidth,mdheight;
@@ -341,7 +341,10 @@
  mdheight=height;
 #endif
 
- mFullscreen=flags&1;
+ vo_fs=flags&1;
+ if ( vo_fs )
+  { vo_old_width=d_width; vo_old_height=d_height; }
+     
 #ifdef HAVE_XF86VM
  if( flags&0x02 ) vm = 1;
 #endif
@@ -376,7 +379,7 @@
       }
     else
 #endif
-   if ( mFullscreen )
+   if ( vo_fs )
     {
      hint.width=vo_screenwidth;
      hint.height=vo_screenheight;
@@ -422,7 +425,7 @@
 #endif
    );
    XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
-   if ( mFullscreen ) vo_x11_decoration( mDisplay,vo_window,0 );
+   if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 );
    XMapWindow(mDisplay, vo_window);
 #ifdef HAVE_XINERAMA
    vo_x11_xinerama_move(mDisplay,vo_window);
@@ -500,11 +503,9 @@
 #ifdef HAVE_NEW_GUI
       if ( vo_window != None )
        {
-        mFullscreen=0;
         dwidth=mdwidth; dheight=mdheight;
-        if ( ( vo_dwidth == vo_screenwidth )&&( vo_dheight == vo_screenheight ) )
+        if ( vo_fs )
          {
-          mFullscreen=1;
           dwidth=vo_screenwidth;
           dheight=vo_screenwidth * mdheight / mdwidth;
          }
@@ -518,7 +519,7 @@
      printf( "[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);
-     if ( mFullscreen )
+     if ( vo_fs )
       {
        aspect(&dwidth,&dheight,A_ZOOM);
        drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
@@ -582,21 +583,16 @@
    printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
 
    #ifdef HAVE_NEW_GUI
-    if ( vo_window != None )
+    dwidth=mdwidth; dheight=mdheight;
+    if ( vo_fs )
      {
-      mFullscreen=0;
-      dwidth=mdwidth; dheight=mdheight;
-      if ( ( vo_dwidth == vo_screenwidth )&&( vo_dheight == vo_screenheight ) )
-       {
-        mFullscreen=1;
-        dwidth=vo_screenwidth;
-        dheight=vo_screenwidth * mdheight / mdwidth;
-       }
+      dwidth=vo_screenwidth;
+      dheight=vo_screenwidth * mdheight / mdwidth;
      }
    #endif
 
    aspect(&dwidth,&dheight,A_NOZOOM);
-   if ( mFullscreen )
+   if ( vo_fs )
     {
      aspect(&dwidth,&dheight,A_ZOOM);
      drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
@@ -611,7 +607,7 @@
  if ( e & VO_EVENT_EXPOSE )
   {
    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,(mFullscreen?drwHeight - 1:drwHeight), 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);
   }
 }
 
@@ -622,7 +618,7 @@
 {
  XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf],
          0, 0,  image_width, image_height,
-         drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
+         drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight),
          False);
  if (num_buffers>1){
     current_buf=(current_buf+1)%num_buffers;
@@ -823,6 +819,9 @@
     return query_format(*((uint32_t*)data));
   case VOCTRL_GET_IMAGE:
     return get_image(data);
+  case VOCTRL_FULLSCREEN:
+    vo_x11_fullscreen();
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }

Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- vo_xvidix.c	22 Feb 2002 15:22:27 -0000	1.23
+++ vo_xvidix.c	7 Mar 2002 17:50:25 -0000	1.24
@@ -70,26 +70,21 @@
 /* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
 static Window mRoot;
 static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
-    drwDepth, drwcX, drwcY, dwidth, dheight, mFullscreen;
+    drwDepth, drwcX, drwcY, dwidth, dheight;
 
 static void set_window(int force_update,const vo_tune_info_t *info)
 {
 #ifdef HAVE_NEW_GUI
-    if (vo_window != None)
-    {
-	if ((vo_dwidth == vo_screenwidth) && (vo_dheight == vo_screenheight))
+	if (vo_fs)
 	{
-	    mFullscreen = 1;
 	    dwidth = vo_screenwidth;
 	    dheight = vo_screenwidth * vo_dheight / vo_dwidth;
 	}
 	else
 	{
-	    mFullscreen = 0;
 	    dwidth = vo_dwidth;
 	    dheight = vo_dheight;
 	}
-    }
 #endif
 
     XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
@@ -98,14 +93,14 @@
     XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
 	&drwcX, &drwcY, &mRoot);
 
-    if (!mFullscreen)
+    if (!vo_fs)
 	mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
 	    drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
 
     /* following stuff copied from vo_xmga.c */
     aspect(&dwidth, &dheight, A_NOZOOM);
 #if X11_FULLSCREEN
-    if (mFullscreen)
+    if (vo_fs)
     {
 	aspect(&dwidth, &dheight, A_ZOOM);
 	drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
@@ -175,7 +170,7 @@
     XClearWindow( mDisplay,vo_window );
     XSetForeground(mDisplay, vo_gc, fgColor);
     XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
-	(mFullscreen ? drwHeight - 1 : drwHeight));
+	(vo_fs ? drwHeight - 1 : drwHeight));
     /* flush, update drawable */
     XFlush(mDisplay);
 
@@ -245,7 +240,9 @@
     window_width = d_width;
     window_height = d_height;
 
-    mFullscreen = flags&0x01;
+    vo_fs = flags&0x01;
+    if (vo_fs)
+     { vo_old_width=d_width; vo_old_height=d_height; }
 
     X_already_started++;
     
@@ -275,7 +272,7 @@
 #endif
 
 #ifdef X11_FULLSCREEN
-    if (mFullscreen) /* fullscreen */
+    if (vo_fs) /* fullscreen */
     {
         if (flags & 0x04)
         {
@@ -321,7 +318,7 @@
     vo_hidecursor(mDisplay, vo_window);
 
 #ifdef X11_FULLSCREEN
-    if (mFullscreen) /* fullscreen */
+    if (vo_fs) /* fullscreen */
 	vo_x11_decoration(mDisplay, vo_window, 0);
 #endif
 
@@ -456,6 +453,9 @@
   switch (request) {
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_FULLSCREEN:
+    vo_x11_fullscreen();
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- x11_common.c	7 Mar 2002 14:04:15 -0000	1.55
+++ x11_common.c	7 Mar 2002 17:50:25 -0000	1.56
@@ -509,6 +509,27 @@
   return ret;
 }
 
+void vo_x11_fullscreen( void )
+{
+ XUnmapWindow( mDisplay,vo_window );
+ if ( !vo_fs )
+  {
+   vo_fs=VO_TRUE;
+   vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth;   vo_old_height=vo_dheight;
+   vo_dx=0;        vo_dy=0;        vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight;
+   vo_x11_decoration( mDisplay,vo_window,0 );
+  }
+  else
+   {
+    vo_fs=VO_FALSE;
+    vo_dx=vo_old_x; vo_dy=vo_old_y; vo_dwidth=vo_old_width; vo_dheight=vo_old_height;
+    vo_x11_decoration( mDisplay,vo_window,1 );
+   }
+ XMapWindow( mDisplay,vo_window );
+ XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
+ return;
+}
+
 void saver_on(Display *mDisplay) {
 
 #ifdef HAVE_XDPMS

Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- x11_common.h	21 Feb 2002 21:11:01 -0000	1.15
+++ x11_common.h	7 Mar 2002 17:50:25 -0000	1.16
@@ -1,4 +1,7 @@
 
+#ifndef X11_COMMON_H
+#define X11_COMMON_H
+
 #ifdef X11_FULLSCREEN
 
 extern int vo_depthonscreen;
@@ -6,6 +9,7 @@
 extern int vo_screenheight;
 extern int vo_dwidth;
 extern int vo_dheight;
+extern int vo_fs;
 
 extern char *mDisplayName;
 extern Display *mDisplay;
@@ -19,6 +23,7 @@
 void vo_x11_decoration( Display * vo_Display,Window w,int d );
 void vo_x11_classhint( Display * display,Window window,char *name );
 int vo_x11_check_events(Display *mydisplay);
+void vo_x11_fullscreen( void );
 #endif
 
 extern Window    vo_window;
@@ -42,4 +47,6 @@
 #ifdef HAVE_XF86VM
 void vo_vm_switch(uint32_t, uint32_t, int*, int*);
 void vo_vm_close(Display*);
+#endif
+
 #endif




More information about the MPlayer-cvslog mailing list