[MPlayer-cvslog] r31085 - in trunk/libvo: gl_common.c sdl_common.c video_out.h vo_gl.c

reimar subversion at mplayerhq.hu
Sun Apr 25 12:44:54 CEST 2010


Author: reimar
Date: Sun Apr 25 12:44:53 2010
New Revision: 31085

Log:
Add reinitialization support. Necessary for fullscreen on OSX.

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

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Sun Apr 25 12:34:58 2010	(r31084)
+++ trunk/libvo/gl_common.c	Sun Apr 25 12:44:53 2010	(r31085)
@@ -1869,6 +1869,8 @@ static int sdl_check_events(void) {
   while (SDL_PollEvent(&event)) {
     res |= sdl_default_handle_event(&event);
   }
+  // poll "events" from within MPlayer code
+  res |= sdl_default_handle_event(NULL);
   if (res & VO_EVENT_RESIZE)
     sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE);
   return res;

Modified: trunk/libvo/sdl_common.c
==============================================================================
--- trunk/libvo/sdl_common.c	Sun Apr 25 12:34:58 2010	(r31084)
+++ trunk/libvo/sdl_common.c	Sun Apr 25 12:44:53 2010	(r31085)
@@ -29,9 +29,12 @@
 static int old_w;
 static int old_h;
 static int mode_flags;
+static int reinit;
 
 int vo_sdl_init(void)
 {
+    reinit = 0;
+
     if (!SDL_WasInit(SDL_INIT_VIDEO) &&
         SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
         return 0;
@@ -70,6 +73,9 @@ void vo_sdl_fullscreen(void)
     }
     vo_fs = !vo_fs;
     sdl_set_mode(0, mode_flags);
+    // on OSX at least we now need to do a full reinit.
+    // TODO: this should only be set if really necessary.
+    reinit = 1;
 }
 
 int sdl_set_mode(int bpp, uint32_t flags)
@@ -111,6 +117,11 @@ static const struct mp_keymap keysym_map
 int sdl_default_handle_event(SDL_Event *event)
 {
     int mpkey;
+    if (!event) {
+        int res = reinit ? VO_EVENT_REINIT : 0;
+        reinit = 0;
+        return res;
+    }
     switch (event->type) {
     case SDL_VIDEORESIZE:
         vo_dwidth  = event->resize.w;

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Sun Apr 25 12:34:58 2010	(r31084)
+++ trunk/libvo/video_out.h	Sun Apr 25 12:44:53 2010	(r31085)
@@ -33,6 +33,7 @@
 #define VO_EVENT_EXPOSE 1
 #define VO_EVENT_RESIZE 2
 #define VO_EVENT_KEYPRESS 4
+#define VO_EVENT_REINIT 8
 
 /* Obsolete: VOCTRL_QUERY_VAA 1 */
 /* does the device support the required format */

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Sun Apr 25 12:34:58 2010	(r31084)
+++ trunk/libvo/vo_gl.c	Sun Apr 25 12:44:53 2010	(r31085)
@@ -650,6 +650,10 @@ glconfig:
 static void check_events(void)
 {
     int e=glctx.check_events();
+    if(e&VO_EVENT_REINIT) {
+        uninitGl();
+        initGl(vo_dwidth, vo_dheight);
+    }
     if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
     if(e&VO_EVENT_EXPOSE && int_pause) redraw();
 }


More information about the MPlayer-cvslog mailing list