check for SDL_VideoInfo.current_[wh] availability in configure, and
authorMåns Rullgård <mans@mansr.com>
Wed, 14 Jun 2006 21:02:55 +0000 (21:02 +0000)
committerMåns Rullgård <mans@mansr.com>
Wed, 14 Jun 2006 21:02:55 +0000 (21:02 +0000)
fall back on SDL_WM_ToggleFullScreen() if not available

Originally committed as revision 5477 to svn://svn.ffmpeg.org/ffmpeg/trunk

configure
ffplay.c

index 066f740..7e490ca 100755 (executable)
--- a/configure
+++ b/configure
@@ -1190,15 +1190,23 @@ if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
-    restore_flags
     if test $? = 0; then
         _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
     if test $? = 0; then
         _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
-        if test "$_sdlversion" -lt 130 ; then
+        if test "$_sdlversion" -lt 121 ; then
             sdl_too_old=yes
         else
             sdl=yes
             sdl_too_old=yes
         else
             sdl=yes
+            check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
+#include <SDL.h>
+int main(void){
+    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
+    int w = vi->current_w;
+    return 0;
+}
+EOF
         fi
     fi
         fi
     fi
+    restore_flags
 fi
 
 ##########################################
 fi
 
 ##########################################
@@ -1534,6 +1542,9 @@ if test "$sdl" = "yes" ; then
   echo "CONFIG_SDL=yes" >> config.mak
   echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
   echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
   echo "CONFIG_SDL=yes" >> config.mak
   echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
   echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
+  if test "$sdl_video_size" = "yes"; then
+    echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
+  fi
 fi
 if test "$texi2html" = "yes"; then
   echo "BUILD_DOC=yes" >> config.mak
 fi
 if test "$texi2html" = "yes"; then
   echo "BUILD_DOC=yes" >> config.mak
index 030a760..720ce32 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -2096,19 +2096,25 @@ void toggle_full_screen(void)
 {
     int w, h, flags;
     is_full_screen = !is_full_screen;
 {
     int w, h, flags;
     is_full_screen = !is_full_screen;
-    flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
-    if (is_full_screen) {
-        w = fs_screen_width;
-        h = fs_screen_height;
-        flags |= SDL_FULLSCREEN;
+    if (!fs_screen_width) {
+        /* use default SDL method */
+        SDL_WM_ToggleFullScreen(screen);
     } else {
     } else {
-        w = screen_width;
-        h = screen_height;
-        flags |= SDL_RESIZABLE;
+        /* use the recorded resolution */
+        flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
+        if (is_full_screen) {
+            w = fs_screen_width;
+            h = fs_screen_height;
+            flags |= SDL_FULLSCREEN;
+        } else {
+            w = screen_width;
+            h = screen_height;
+            flags |= SDL_RESIZABLE;
+        }
+        screen = SDL_SetVideoMode(w, h, 0, flags);
+        cur_stream->width = w;
+        cur_stream->height = h;
     }
     }
-    screen = SDL_SetVideoMode(w, h, 0, flags);
-    cur_stream->width = w;
-    cur_stream->height = h;
 }
 
 void toggle_pause(void)
 }
 
 void toggle_pause(void)
@@ -2426,10 +2432,11 @@ int main(int argc, char **argv)
     }
 
     if (!display_disable) {
     }
 
     if (!display_disable) {
+#ifdef HAVE_SDL_VIDEO_SIZE
         const SDL_VideoInfo *vi = SDL_GetVideoInfo();
         fs_screen_width = vi->current_w;
         fs_screen_height = vi->current_h;
         const SDL_VideoInfo *vi = SDL_GetVideoInfo();
         fs_screen_width = vi->current_w;
         fs_screen_height = vi->current_h;
-
+#endif
         flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
         if (is_full_screen && fs_screen_width) {
             w = fs_screen_width;
         flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
         if (is_full_screen && fs_screen_width) {
             w = fs_screen_width;