[Mplayer-cvslog] CVS: main/libvo vo_sdl.c,1.74,1.75

Fredrik Kuivinen CVS ksorim at mplayer.dev.hu
Thu Mar 21 15:08:51 CET 2002


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

Modified Files:
	vo_sdl.c 
Log Message:
This will hopefully fix
* uninit call without a previous config call
* Several config calls between preinit and uninit


Index: vo_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- vo_sdl.c	21 Mar 2002 10:22:55 -0000	1.74
+++ vo_sdl.c	21 Mar 2002 14:08:40 -0000	1.75
@@ -450,19 +450,18 @@
 	
 	
 	/* default to no fullscreen mode, we'll set this as soon we have the avail. modes */
-	priv->fullmode = -2;
-	
-	priv->surface = NULL;
-	priv->rgbsurface = NULL;
-	priv->overlay = NULL;
-	priv->fullmodes = NULL;
+    priv->fullmode = -2;
+
+    priv->fullmodes = NULL;
 	priv->bpp = 0;
 
 	/* initialize the SDL Video system */
-	if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) {
-		printf("SDL: Initializing of SDL failed: %s.\n", SDL_GetError());
-		return -1;
-	}
+    if (!SDL_WasInit(SDL_INIT_VIDEO)) {
+        if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) {
+            printf("SDL: Initializing of SDL failed: %s.\n", SDL_GetError());
+            return -1;
+        }
+    }
 	
 	SDL_VideoDriverName(priv->driver, 8);
 	printf("SDL: Using driver: %s\n", priv->driver);
@@ -521,9 +520,12 @@
 	priv->bpp = vidInfo->vfmt->BitsPerPixel;
 	if (priv->mode == YUV && priv->bpp < 16) {
 
-		if(verbose) printf("SDL: Your SDL display target wants to be at a color depth of (%d), but we need it to be at\
-least 16 bits, so we need to emulate 16-bit color. This is going to slow things down; you might want to\
-increase your display's color depth, if possible.\n", priv->bpp);
+		if(verbose) printf("SDL: Your SDL display target wants to be at a color "
+                           "depth of (%d), but we need it to be at least 16 "
+                           "bits, so we need to emulate 16-bit color. This is "
+                           "going to slow things down; you might want to "
+                           "increase your display's color depth, if possible.\n",
+                           priv->bpp);
 
 		priv->bpp = 16;  
 	}
@@ -571,10 +573,8 @@
 	/* DONT attempt to free the fullscreen modes array. SDL_Quit* does this for us */
 	
 	/* Cleanup SDL */
-	//SDL_Quit();
-	SDL_QuitSubSystem(SDL_INIT_VIDEO);
-	/* might have to be changed to quitsubsystem only, if plugins become
-	 * changeable on the fly */
+    if(SDL_WasInit(SDL_INIT_VIDEO))
+        SDL_QuitSubSystem(SDL_INIT_VIDEO);
 
 	if(verbose > 2) printf("SDL: Closed Plugin\n");
 
@@ -812,10 +812,6 @@
     priv->dstwidth  = d_width ? d_width : width;
     priv->dstheight = d_height ? d_height : height;
 
-    priv->rgbsurface = NULL;
-    priv->overlay = NULL;
-    priv->surface = NULL;
-    
     priv->format = format;
     
 #ifdef HAVE_X11
@@ -1616,7 +1612,13 @@
 
 static uint32_t preinit(const char *arg)
 {
-  return 0;
+    struct sdl_priv_s *priv = &sdl_priv;
+
+    priv->rgbsurface = NULL;
+    priv->overlay = NULL;
+    priv->surface = NULL;
+
+    return 0;
 }
 
 static uint32_t get_image(mp_image_t *mpi)




More information about the MPlayer-cvslog mailing list