changeset 4132:84ecfd03c86a

test for preinit errors and correct handling subdevice
author nick
date Sun, 13 Jan 2002 10:30:10 +0000
parents e3c69a00a6f9
children 7134f727e3c6
files libvo/vo_xvidix.c libvo/vosub_vidix.c
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xvidix.c	Sun Jan 13 10:10:15 2002 +0000
+++ b/libvo/vo_xvidix.c	Sun Jan 13 10:30:10 2002 +0000
@@ -1,7 +1,7 @@
 /*
     VIDIX accelerated overlay in a X window
     
-    (C) Alex Beregszaszi
+    (C) Alex Beregszaszi & Nick Kurshev
     
     WS window manager by Pontscho/Fresh!
 
@@ -44,6 +44,7 @@
 
 /* VIDIX related stuff */
 static const char *vidix_name = (char *)(-1);
+static int pre_init_err = 0;
 
 /* Image parameters */
 static uint32_t image_width;
@@ -115,6 +116,11 @@
     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");
@@ -325,6 +331,10 @@
 
 static uint32_t query_format(uint32_t format)
 {
+  static int first = 1;
+  if(first)
+  {
+    first = 0;
     if (vidix_name == (char *)(-1))
     {
 	if (vo_subdevice)
@@ -337,9 +347,12 @@
     }
 
     if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
+    {
+	pre_init_err = 1;
 	return(0);
-    
-    return(vidix_query_fourcc(format));
+    }
+  }    
+  return pre_init_err ? 0 : vidix_query_fourcc(format);
 }
 
 
--- a/libvo/vosub_vidix.c	Sun Jan 13 10:10:15 2002 +0000
+++ b/libvo/vosub_vidix.c	Sun Jan 13 10:30:10 2002 +0000
@@ -57,7 +57,7 @@
 	  return -1;
 	}
 	vidix_handler = vdlOpen("/usr/lib/mplayer/vidix/",
-				drvname ? drvname[0] == ':' ? &drvname[1] : NULL : NULL,
+				drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL,
 				TYPE_OUTPUT,
 				verbose);
 	if(vidix_handler == NULL)