[Mplayer-cvslog] CVS: main/libvo mga_common.c,1.46,1.47 vo_gl.c,1.30,1.31 vo_xmga.c,1.79,1.80 vo_xvidix.c,1.51,1.52

Zoltan Ponekker pontscho at mplayerhq.hu
Thu Oct 17 11:49:44 CEST 2002


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

Modified Files:
	mga_common.c vo_gl.c vo_xmga.c vo_xvidix.c 
Log Message:
-fixed-vo support

Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- mga_common.c	10 Oct 2002 00:10:58 -0000	1.46
+++ mga_common.c	17 Oct 2002 09:49:25 -0000	1.47
@@ -380,7 +380,9 @@
 	//clear the buffer
 	memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
 
+#ifndef VO_XMGA
 	ioctl(f,MGA_VID_ON,0);
+#endif
 
   return 0;
 }

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- vo_gl.c	28 Aug 2002 21:32:32 -0000	1.30
+++ vo_gl.c	17 Oct 2002 09:49:25 -0000	1.31
@@ -5,12 +5,6 @@
 
 #define TEXTUREFORMAT_32BPP
 
-/* 
- * video_out_gl.c, X11/OpenGL interface
- * based on video_out_x11 by Aaron Holtzman,
- * and WS opengl window manager by Pontscho/Fresh!
- */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,28 +38,14 @@
 	""
 };
 
-/* private prototypes */
-// static void Display_Image (unsigned char *ImageData);
-
 /* local data */
 static unsigned char *ImageData=NULL;
 
-/* X11 related variables */
-//static Display *mydisplay;
-//static Window vo_window;
-//static GC mygc;
-//static XImage *myximage;
-//static int depth,mode;
-//static XWindowAttributes attribs;
-//static int texture_id=1;
-
 static GLXContext wsGLXContext;
-//XVisualInfo        * wsVisualInfo;
 static int                  wsGLXAttrib[] = { GLX_RGBA,
                                        GLX_RED_SIZE,1,
                                        GLX_GREEN_SIZE,1,
                                        GLX_BLUE_SIZE,1,
-//                                       GLX_DEPTH_SIZE,16,
                                        GLX_DOUBLEBUFFER,
                                        None };
 
@@ -113,8 +93,6 @@
 	image_width = width;
 	image_format = format;
   
-	if(!vo_init()) return -1;
-
 	aspect_save_orig(width,height);
 	aspect_save_prescale(d_width,d_height);
 	aspect_save_screenres(vo_screenwidth,vo_screenheight);
@@ -138,9 +116,6 @@
 
 	/* Make the window */
 
-//	XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
-
-//	XMatchVisualInfo(mDisplay, screen, depth, TrueColor, &vinfo);
   vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
   if (vinfo == NULL)
   {
@@ -150,66 +125,49 @@
 
 	xswa.background_pixel = 0;
 	xswa.border_pixel     = 1;
-//	xswa.colormap         = XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone);
 	xswa.colormap         = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone);
 	xswamask = CWBackPixel | CWBorderPixel | CWColormap;
-//  xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWCursor | CWOverrideRedirect | CWSaveUnder | CWX | CWY | CWWidth | CWHeight;
-
-  vo_window = XCreateWindow(mDisplay, mRootWin,
-    hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
-
-  vo_x11_classhint( mDisplay,vo_window,"gl" );
-  vo_hidecursor(mDisplay,vo_window);
-
-  wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
-//  XStoreName( wsDisplay,wsMyWin,wsSysName );
-
-//  printf("GLXcontext ok\n");
-
-//  if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 );
-
-	XSelectInput(mDisplay, vo_window, StructureNotifyMask);
 
-	/* Tell other applications about this window */
-
-	XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
-
-	/* Map window. */
-
-	XMapWindow(mDisplay, vo_window);
-	if ( flags&1 ) vo_x11_fullscreen();
+	if ( vo_window == None )
+	 {
+      vo_window = XCreateWindow(mDisplay, mRootWin,
+        hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
+
+      vo_x11_classhint( mDisplay,vo_window,"gl" );
+      vo_hidecursor(mDisplay,vo_window);
+
+//      if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 );
+	  XSelectInput(mDisplay, vo_window, StructureNotifyMask);
+	  /* Tell other applications about this window */
+	  XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
+	  /* Map window. */
+	  XMapWindow(mDisplay, vo_window);
+	  if ( flags&1 ) vo_x11_fullscreen();
 #ifdef HAVE_XINERAMA
-	vo_x11_xinerama_move(mDisplay,vo_window);
+	  vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
 
-	/* Wait for map. */
-	do 
-	{
+	  /* Wait for map. */
+	  do 
+	  {
 		XNextEvent(mDisplay, &xev);
-	}
-	while (xev.type != MapNotify || xev.xmap.event != vo_window);
+	  }
+	  while (xev.type != MapNotify || xev.xmap.event != vo_window);
 
-	XSelectInput(mDisplay, vo_window, NoEventMask);
+	  XSelectInput(mDisplay, vo_window, NoEventMask);
+	 }
 
-  glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
+	if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
+    wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
+    glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
 
 	XFlush(mDisplay);
 	XSync(mDisplay, False);
 
-//	mygc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
-
-//		myximage = XGetImage(mDisplay, vo_window, 0, 0,
-//		width, image_height, AllPlanes, ZPixmap);
-//		ImageData = myximage->data;
-//	bpp = myximage->bits_per_pixel;
-
-	//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
 	vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
 		     | ButtonPressMask | ButtonReleaseMask
         );
 
-//  printf("Window setup ok\n");
-
 #if 0
 	// If we have blue in the lowest bit then obviously RGB 
 	mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR;
@@ -250,6 +208,7 @@
     image_bytes=(image_bpp+7)/8;
   }
 
+  if ( ImageData ) free( ImageData );
   ImageData=malloc(texture_width*texture_height*image_bytes);
   memset(ImageData,128,texture_width*texture_height*image_bytes);
 
@@ -334,8 +293,6 @@
 	yuv2rgb(ImageData, src[0], src[1], src[2], 
 			w,h, dstride, stride[0],stride[1]);
 
-//	emms ();
-
     for(i=0;i<h;i++){
       glTexSubImage2D( GL_TEXTURE_2D,  // target
 		       0,              // level
@@ -359,9 +316,6 @@
 	yuv2rgb(ImageData, src[0], src[1], src[2],
 		image_width, image_height, 
 		image_width*BYTES_PP, image_width, image_width/2 );
-//  printf("Ready!\n");
-
-//		emms ();
 
     for(i=0;i<image_height;i++){
       glTexSubImage2D( GL_TEXTURE_2D,  // target
@@ -375,7 +329,6 @@
 		       ImageData+i*BYTES_PP*image_width );        // *pixels
     }
 
-//	Display_Image(ImageData);
 	return 0; 
 }
 
@@ -407,7 +360,6 @@
 		       ImageData);        // *pixels
     }
 
-//	Display_Image(ImageData);
 	return 0; 
 }
 
@@ -430,7 +382,6 @@
 		       ImageData+i*image_bytes*image_width );        // *pixels
     }
 
-//	Display_Image(ImageData);
 	return 0; 
 }
 
@@ -476,6 +427,9 @@
 	printf("[gl] Unknown subdevice: %s\n",arg);
 	return ENOSYS;
     }
+
+	if(!vo_init()) return 1;
+
     return 0;
 }
 

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- vo_xmga.c	9 Oct 2002 13:40:23 -0000	1.79
+++ vo_xmga.c	17 Oct 2002 09:49:25 -0000	1.80
@@ -247,7 +247,9 @@
        
     } else {
 
-      vo_window=XCreateWindow( mDisplay,mRootWin,
+     if ( vo_window == None )
+	  {
+       vo_window=XCreateWindow( mDisplay,mRootWin,
          vo_dx,vo_dy,
          vo_dwidth,vo_dheight,
          xWAttribs.border_pixel,
@@ -255,20 +257,22 @@
          InputOutput,
          vinfo.visual,xswamask,&xWAttribs );
      
-      vo_x11_classhint( mDisplay,vo_window,"xmga" );
-      vo_hidecursor(mDisplay,vo_window);
-      vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
+       vo_x11_classhint( mDisplay,vo_window,"xmga" );
+       vo_hidecursor(mDisplay,vo_window);
+       vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
 
-      XStoreName( mDisplay,vo_window,mTitle );
-      XMapWindow( mDisplay,vo_window );
+       XStoreName( mDisplay,vo_window,mTitle );
+       XMapWindow( mDisplay,vo_window );
  
-      if ( flags&1 ) vo_x11_fullscreen();
+       if ( flags&1 ) vo_x11_fullscreen();
 
 #ifdef HAVE_XINERAMA
-      vo_x11_xinerama_move(mDisplay,vo_window);
+       vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
+      } else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
      }
 
+    if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
     vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
 
   } // !GUI
@@ -288,6 +292,8 @@
 
  XFlush( mDisplay );
  XSync( mDisplay,False );
+ 
+ ioctl(f,MGA_VID_ON,0);
 
  return 0;
 }

Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- vo_xvidix.c	28 Aug 2002 21:32:32 -0000	1.51
+++ vo_xvidix.c	17 Oct 2002 09:49:25 -0000	1.52
@@ -201,8 +201,6 @@
     XWindowAttributes attribs;
     int window_depth;
 
-//    if (title)
-//	free(title);
     title = "MPlayer VIDIX X11 Overlay";
 
     panscan_init();
@@ -212,9 +210,6 @@
     image_format = format;
     vo_mouse_autohide=1;
 
-    if (!vo_init())
-        return(-1);
-
     aspect_save_orig(width, height);
     aspect_save_prescale(d_width, d_height);
     aspect_save_screenres(vo_screenwidth, vo_screenheight);
@@ -258,9 +253,6 @@
 {
 #endif
 
-    /* destroy window before creating one */
-    if (vo_window) XDestroyWindow(mDisplay, vo_window);
-
 #ifdef X11_FULLSCREEN
     if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
 #endif
@@ -296,24 +288,28 @@
     }
     else
      {
-      vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
-	    vo_dx, vo_dy, window_width, window_height, xswa.border_pixel,
-	    vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa);
-
-      vo_x11_classhint(mDisplay, vo_window, "xvidix");
-      vo_hidecursor(mDisplay, vo_window);
-      vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
+	  if ( vo_window == None )
+	   {
+        vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
+	      vo_dx, vo_dy, window_width, window_height, xswa.border_pixel,
+	      vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa);
+
+        vo_x11_classhint(mDisplay, vo_window, "xvidix");
+        vo_hidecursor(mDisplay, vo_window);
+        vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
 
-      XStoreName(mDisplay, vo_window, title);
-      XMapWindow(mDisplay, vo_window);
+        XStoreName(mDisplay, vo_window, title);
+        XMapWindow(mDisplay, vo_window);
     
-      if ( flags&1 ) vo_x11_fullscreen();
+        if ( flags&1 ) vo_x11_fullscreen();
     
 #ifdef HAVE_XINERAMA
-      vo_x11_xinerama_move(mDisplay, vo_window);
+        vo_x11_xinerama_move(mDisplay, vo_window);
 #endif
-
+       } else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
      }
+	 
+	if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
     vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
 #ifdef HAVE_NEW_GUI
 }
@@ -419,6 +415,8 @@
 	mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available ones!\n");
 	vidix_name = NULL;
     }
+
+    if (!vo_init()) return(1);
 
     if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
 	return(1);




More information about the MPlayer-cvslog mailing list