changeset 4363:98178c055016

preinit moved to right place
author alex
date Sat, 26 Jan 2002 19:42:21 +0000
parents 7ef67ffa9274
children 819eeb32159f
files libvo/vo_xvidix.c
diffstat 1 files changed, 18 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xvidix.c	Sat Jan 26 19:12:49 2002 +0000
+++ b/libvo/vo_xvidix.c	Sat Jan 26 19:42:21 2002 +0000
@@ -49,13 +49,14 @@
 static Window mWindow;
 static int X_already_started = 0;
 
+/* Colorkey handling */
 static GC mGC;
 static XGCValues mGCV;
 static uint32_t	fgColor;
+static vidix_grkey_t gr_key;
 
-/* VIDIX related stuff */
-static const char *vidix_name = (char *)(-1);
-static int pre_init_err = 0;
+/* VIDIX related */
+static char *vidix_name;
 
 /* Image parameters */
 static uint32_t image_width;
@@ -67,13 +68,11 @@
 static uint32_t window_x, window_y;
 static uint32_t window_width, window_height;
 
-/* used by XGetGeometry & XTranslateCoordinates */
+/* 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;
 
-static vidix_grkey_t gr_key;
-
 static void set_window(int force_update)
 {
 #ifdef HAVE_NEW_GUI
@@ -169,7 +168,6 @@
     mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
 	window_x, window_y, window_width, window_height);
 
-
     /* mDrawColorKey: */
 
     /* fill drawable with specified color */
@@ -195,11 +193,6 @@
     XWindowAttributes attribs;
     int window_depth;
 
-    if(pre_init_err)
-    {
-	mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] Quiting due preinit error\n");
-	return -1;
-    }
 //    if (title)
 //	free(title);
     title = strdup("MPlayer VIDIX X11 Overlay");
@@ -390,7 +383,6 @@
     return(&vo_info);
 }
 
-
 static void check_events(void)
 {
     const int event = vo_x11_check_events(mDisplay);
@@ -437,31 +429,9 @@
 
 static uint32_t query_format(uint32_t format)
 {
-  static int first = 1;
-  if(first)
-  {
-    first = 0;
-    if (vidix_name == (char *)(-1))
-    {
-	if (vo_subdevice)
-	    vidix_name = strdup(vo_subdevice);
-	else
-	{
-    	    mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available drivers!\n");
-	    vidix_name = NULL;
-	}
-    }
-
-    if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
-    {
-	pre_init_err = 1;
-	return(0);
-    }
-  }    
-  return(pre_init_err ? 0 : vidix_query_fourcc(format));
+  return(vidix_query_fourcc(format));
 }
 
-
 static void uninit(void)
 {
     vidix_term();
@@ -493,7 +463,18 @@
 
 static uint32_t preinit(const char *arg)
 {
-  return 0;
+    if (arg)
+        vidix_name = strdup(arg);
+    else
+    {
+	mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available ones!\n");
+	vidix_name = NULL;
+    }
+
+    if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
+	return(1);
+
+    return(0);
 }
 
 static void query_vaa(vo_vaa_t *vaa)