[FFmpeg-devel] [PATCH 2/2] ffplay: add sdl_surface_flags to the current context

Jean First jeanfirst at gmail.com
Wed Oct 19 13:54:34 CEST 2011


---
 ffplay.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 9eeb305..125861b 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -277,6 +277,7 @@ static char *vfilters = NULL;
 
 /* current context */
 static int is_full_screen;
+static int sdl_surface_flags;
 static int64_t audio_callback_time;
 
 static AVPacket flush_pkt;
@@ -919,11 +920,12 @@ static void do_exit(VideoState *is)
 }
 
 static int video_open(VideoState *is){
-    int flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
     int w,h;
 
-    if(is_full_screen) flags |= SDL_FULLSCREEN;
-    else               flags |= SDL_RESIZABLE;
+    sdl_surface_flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
+
+    if(is_full_screen) sdl_surface_flags |= SDL_FULLSCREEN;
+    else               sdl_surface_flags |= SDL_RESIZABLE;
 
     if (is_full_screen && fs_screen_width) {
         w = fs_screen_width;
@@ -947,7 +949,7 @@ static int video_open(VideoState *is){
     if(screen && is->width == screen->w && screen->w == w
        && is->height== screen->h && screen->h == h)
         return 0;
-    screen = SDL_SetVideoMode(w, h, 0, flags);
+    screen = SDL_SetVideoMode(w, h, 0, sdl_surface_flags);
     if (!screen) {
         fprintf(stderr, "SDL: could not set video mode - exiting\n");
         do_exit(is);
@@ -2850,8 +2852,7 @@ static void event_loop(VideoState *cur_stream)
             }
             break;
         case SDL_VIDEORESIZE:
-            screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
-                                      SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
+            screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, sdl_surface_flags);
             screen_width = cur_stream->width = event.resize.w;
             screen_height= cur_stream->height= event.resize.h;
             break;
-- 
1.7.6.1



More information about the ffmpeg-devel mailing list