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

reimar subversion at mplayerhq.hu
Sun Apr 25 11:24:30 CEST 2010


Author: reimar
Date: Sun Apr 25 11:24:30 2010
New Revision: 31077

Log:
Fullscreen support for -vo gl using SDL.

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

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Sun Apr 25 10:40:28 2010	(r31076)
+++ trunk/libvo/gl_common.c	Sun Apr 25 11:24:30 2010	(r31077)
@@ -34,6 +34,7 @@
 #include <math.h>
 #include "gl_common.h"
 #include "csputils.h"
+#include "aspect.h"
 
 void (GLAPIENTRY *mpglBegin)(GLenum);
 void (GLAPIENTRY *mpglEnd)(void);
@@ -1887,10 +1888,21 @@ static int dummy_check_events(void) {
   return 0;
 }
 
+static void dummy_update_xinerama_info(void) {
+  if (vo_screenwidth <= 0 || vo_screenheight <= 0) {
+    mp_msg(MSGT_VO, MSGL_ERR, "You must specify the screen dimensions"
+                              "with -screenw and -screenh\n");
+    vo_screenwidth  = 1280;
+    vo_screenheight = 768;
+  }
+  aspect_save_screenres(vo_screenwidth, vo_screenheight);
+}
+
 int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
   memset(ctx, 0, sizeof(*ctx));
   ctx->setGlWindow = setGlWindow_dummy;
   ctx->releaseGlContext = releaseGlContext_dummy;
+  ctx->update_xinerama_info = dummy_update_xinerama_info;
   ctx->check_events = dummy_check_events;
   ctx->type = type;
   switch (ctx->type) {
@@ -1924,6 +1936,7 @@ int init_mpglcontext(MPGLContext *ctx, e
     ctx->setGlWindow = setGlWindow_sdl;
     ctx->swapGlBuffers = swapGlBuffers_sdl;
     ctx->check_events = sdl_check_events;
+    ctx->fullscreen = vo_sdl_fullscreen;
     return 1;
 #endif
   default:

Modified: trunk/libvo/sdl_common.c
==============================================================================
--- trunk/libvo/sdl_common.c	Sun Apr 25 10:40:28 2010	(r31076)
+++ trunk/libvo/sdl_common.c	Sun Apr 25 11:24:30 2010	(r31077)
@@ -26,9 +26,34 @@
 #include "input/mouse.h"
 #include "video_out.h"
 
+static int old_w;
+static int old_h;
+static int mode_flags;
+
+void vo_sdl_fullscreen(void)
+{
+    if (vo_fs) {
+        vo_dwidth  = old_w;
+        vo_dheight = old_h;
+    } else {
+        old_w = vo_dwidth;
+        old_h = vo_dheight;
+        vo_dwidth  = vo_screenwidth;
+        vo_dheight = vo_screenheight;
+    }
+    vo_fs = !vo_fs;
+    sdl_set_mode(0, mode_flags);
+}
+
 int sdl_set_mode(int bpp, uint32_t flags)
 {
-    SDL_Surface *s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags);
+    SDL_Surface *s;
+    mode_flags = flags;
+    if (vo_fs) flags |= SDL_FULLSCREEN;
+    // doublebuf with opengl creates flickering
+    if (vo_doublebuffering && !(flags & SDL_OPENGL))
+        flags |= SDL_DOUBLEBUF;
+    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;

Modified: trunk/libvo/sdl_common.h
==============================================================================
--- trunk/libvo/sdl_common.h	Sun Apr 25 10:40:28 2010	(r31076)
+++ trunk/libvo/sdl_common.h	Sun Apr 25 11:24:30 2010	(r31077)
@@ -28,6 +28,7 @@
 #include <SDL.h>
 #endif
 
+void vo_sdl_fullscreen(void);
 int sdl_set_mode(int bpp, uint32_t flags);
 int sdl_default_handle_event(SDL_Event *event);
 


More information about the MPlayer-cvslog mailing list