Mercurial > mplayer.hg
changeset 34611:f1a31e5fc35f
vo_sdl: reuse some more sdl_common code.
author | reimar |
---|---|
date | Sun, 12 Feb 2012 18:49:07 +0000 |
parents | 4ff933a89818 |
children | b5cfd8f9f811 |
files | libvo/gl_common.c libvo/sdl_common.c libvo/sdl_common.h libvo/vo_sdl.c |
diffstat | 4 files changed, 13 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/gl_common.c Sun Feb 12 18:44:19 2012 +0000 +++ b/libvo/gl_common.c Sun Feb 12 18:49:07 2012 +0000 @@ -2037,7 +2037,7 @@ } 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);
--- a/libvo/sdl_common.c Sun Feb 12 18:44:19 2012 +0000 +++ b/libvo/sdl_common.c Sun Feb 12 18:49:07 2012 +0000 @@ -109,24 +109,26 @@ 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[] = {
--- a/libvo/sdl_common.h Sun Feb 12 18:44:19 2012 +0000 +++ b/libvo/sdl_common.h Sun Feb 12 18:49:07 2012 +0000 @@ -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 */
--- a/libvo/vo_sdl.c Sun Feb 12 18:44:19 2012 +0000 +++ b/libvo/vo_sdl.c Sun Feb 12 18:49:07 2012 +0000 @@ -393,11 +393,7 @@ #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 @@ 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 @@ 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 @@ } /* 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 @@ SDL_SRF_UNLOCK(priv->surface) setup_surfaces(); } - else - mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_SetVideoModeFailedFull, SDL_GetError()); }