[Mplayer-cvslog] CVS: main/libvo vo_gl2.c,1.41,1.42

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sat May 1 21:37:11 CEST 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv6184

Modified Files:
	vo_gl2.c 
Log Message:
GUI support


Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- vo_gl2.c	17 Mar 2004 11:53:25 -0000	1.41
+++ vo_gl2.c	1 May 2004 19:37:09 -0000	1.42
@@ -16,6 +16,10 @@
 #include "video_out_internal.h"
 #include "sub.h"
 
+#ifdef HAVE_NEW_GUI
+#include "../Gui/interface.h"
+#endif
+
 #include <GL/gl.h>
 #ifdef GL_WIN32
     #include <windows.h>
@@ -770,6 +774,38 @@
         return 0;
 }
 
+#ifdef HAVE_NEW_GUI
+static uint32_t config_glx_gui(uint32_t d_width, uint32_t d_height) {
+  XWindowAttributes xw_attr;
+  XVisualInfo *vinfo, vinfo_template;
+  int tmp;
+  vo_dwidth = d_width;
+  vo_dheight = d_height;
+  guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
+  XGetWindowAttributes(mDisplay, vo_window, &xw_attr);
+  vinfo_template.visualid=XVisualIDFromVisual(xw_attr.visual);
+  vinfo = XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp);
+
+  if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
+  wsGLXContext = glXCreateContext( mDisplay,vinfo,NULL,True );
+  if (wsGLXContext == NULL) {
+    mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Could not create GLX context!\n");
+    XFree(vinfo);
+    return -1;
+  }
+  glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
+  XFlush(mDisplay);
+  XSync(mDisplay, False);
+
+  if (glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
+  if (glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
+  if (glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
+  if (glXGetConfig(mDisplay,vinfo,GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
+  XFree(vinfo);
+  return 0;
+}
+#endif
+
 #endif
 
 static int initGl(uint32_t d_width, uint32_t d_height)
@@ -846,6 +882,12 @@
 
 	aspect(&d_width,&d_height,A_NOZOOM);
 
+#ifdef HAVE_NEW_GUI
+	if (use_gui) {
+	  if (config_glx_gui(d_width, d_height) == -1)
+	    return -1;
+	} else
+#endif
 #ifdef GL_WIN32
 	if (config_w32(width, height, d_width, d_height, flags, title, format) == -1)
 #else
@@ -1160,6 +1202,8 @@
   case VOCTRL_RESUME: return (int_pause=0);
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_GUISUPPORT:
+        return VO_TRUE;
   case VOCTRL_ONTOP:
 #ifdef GL_WIN32
     vo_w32_ontop();




More information about the MPlayer-cvslog mailing list