changeset 5240:e766c07b1d5c

This will hopefully fix * uninit call without a previous config call * Several config calls between preinit and uninit
author ksorim
date Thu, 21 Mar 2002 14:08:40 +0000
parents fe6b890f68f2
children 126d5fd76a70
files libvo/vo_sdl.c
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_sdl.c	Thu Mar 21 10:22:55 2002 +0000
+++ b/libvo/vo_sdl.c	Thu Mar 21 14:08:40 2002 +0000
@@ -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)