[MPlayer-cvslog] r34699 - in trunk/libvo: gl_common.c sdl_common.c sdl_common.h vo_sdl.c

reimar subversion at mplayerhq.hu
Sun Feb 12 19:49:07 CET 2012


Author: reimar
Date: Sun Feb 12 19:49:07 2012
New Revision: 34699

Log:
vo_sdl: reuse some more sdl_common code.

Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/sdl_common.c
   trunk/libvo/sdl_common.h
   trunk/libvo/vo_sdl.c

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Sun Feb 12 19:44:19 2012	(r34698)
+++ trunk/libvo/gl_common.c	Sun Feb 12 19:49:07 2012	(r34699)
@@ -2037,7 +2037,7 @@ static void *sdlgpa(const GLubyte *name)
 }
 
 static int setGlWindow_sdl(MPGLContext *ctx) {
-  if (sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE) < 0)
+  if (!sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE))
     return SET_WINDOW_FAILED;
   SDL_GL_LoadLibrary(NULL);
   getFunctions(sdlgpa, NULL);

Modified: trunk/libvo/sdl_common.c
==============================================================================
--- trunk/libvo/sdl_common.c	Sun Feb 12 19:44:19 2012	(r34698)
+++ trunk/libvo/sdl_common.c	Sun Feb 12 19:49:07 2012	(r34699)
@@ -109,24 +109,26 @@ void vo_sdl_fullscreen(void)
     reinit = 1;
 }
 
-int sdl_set_mode(int bpp, uint32_t flags)
+SDL_Surface *sdl_set_mode(int bpp, uint32_t flags)
 {
     SDL_Surface *s;
     mode_flags = flags;
     if (vo_fs) flags |= SDL_FULLSCREEN;
     // doublebuf with opengl creates flickering
+#if !defined( __AMIGAOS4__ ) && !defined( __APPLE__ )
     if (vo_doublebuffering && !(flags & SDL_OPENGL))
         flags |= SDL_DOUBLEBUF;
+#endif
     if (!vo_border)
         flags |= SDL_NOFRAME;
     s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags);
     if (!s) {
       mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError());
-      return -1;
+      return NULL;
     }
     vo_dwidth  = s->w;
     vo_dheight = s->h;
-    return 0;
+    return s;
 }
 
 static const struct mp_keymap keysym_map[] = {

Modified: trunk/libvo/sdl_common.h
==============================================================================
--- trunk/libvo/sdl_common.h	Sun Feb 12 19:44:19 2012	(r34698)
+++ trunk/libvo/sdl_common.h	Sun Feb 12 19:49:07 2012	(r34699)
@@ -32,7 +32,7 @@
 int vo_sdl_init(void);
 void vo_sdl_uninit(void);
 void vo_sdl_fullscreen(void);
-int sdl_set_mode(int bpp, uint32_t flags);
+SDL_Surface *sdl_set_mode(int bpp, uint32_t flags);
 int sdl_default_handle_event(SDL_Event *event);
 
 #endif /* MPLAYER_SDL_COMMON_H */

Modified: trunk/libvo/vo_sdl.c
==============================================================================
--- trunk/libvo/vo_sdl.c	Sun Feb 12 19:44:19 2012	(r34698)
+++ trunk/libvo/vo_sdl.c	Sun Feb 12 19:49:07 2012	(r34699)
@@ -393,11 +393,7 @@ static int sdl_open (void *plugin, void 
 
 #if !defined( __AMIGAOS4__ ) && !defined( __APPLE__ )
 	priv->sdlfullflags |= SDL_DOUBLEBUF;
-	if (vo_doublebuffering)
-	    priv->sdlflags |= SDL_DOUBLEBUF;
 #endif
-        if (!vo_border)
-            priv->sdlflags |= SDL_NOFRAME;
 
 	/* get information about the graphics adapter */
 	vidInfo = SDL_GetVideoInfo ();
@@ -499,7 +495,9 @@ static void set_video_mode(int width, in
     priv->rgbsurface = NULL;
     priv->overlay = NULL;
 
-    newsurface = SDL_SetVideoMode(width, height, bpp, sdlflags);
+    vo_dwidth  = width;
+    vo_dheight = height;
+    newsurface = sdl_set_mode(bpp, sdlflags);
 
     if(newsurface) {
 
@@ -510,13 +508,9 @@ static void set_video_mode(int width, in
         priv->surface = newsurface;
         priv->dstwidth = width;
         priv->dstheight = height;
-        vo_dwidth  = width;
-        vo_dheight = height;
 
         setup_surfaces();
     }
-    else
-        mp_msg(MSGT_VO,MSGL_WARN, "set_video_mode: SDL_SetVideoMode failed: %s\n", SDL_GetError());
 }
 
 static void set_fullmode (int mode) {
@@ -577,8 +571,9 @@ static void set_fullmode (int mode) {
 	}
 
 	/* try to change to given fullscreenmode */
-	newsurface = SDL_SetVideoMode(priv->dstwidth, screen_surface_h, priv->bpp,
-                                  priv->sdlfullflags);
+        vo_dwidth  = priv->dstwidth;
+        vo_dheight = screen_surface_h;
+        newsurface = sdl_set_mode(priv->bpp, priv->sdlfullflags);
 
 	/*
 	 * In Mac OS X (and possibly others?) SDL_SetVideoMode() appears to
@@ -614,8 +609,6 @@ static void set_fullmode (int mode) {
         SDL_SRF_UNLOCK(priv->surface)
         setup_surfaces();
 	}
-    else
-        mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_SetVideoModeFailedFull, SDL_GetError());
 }
 
 


More information about the MPlayer-cvslog mailing list