]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
enable mjpeg in swf
[ffmpeg] / ffplay.c
index a97924e63e993fe51234d1430e828af8fdb00bed..3ffc520c5dc29a59a0b14e419dff71d4a0e5d124 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -833,22 +833,21 @@ 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;
+
     if (is_full_screen && fs_screen_width) {
         w = fs_screen_width;
         h = fs_screen_height;
-        flags |= SDL_FULLSCREEN;
+    } else if(!is_full_screen && screen_width){
+        w = screen_width;
+        h = screen_height;
+    }else if (is->video_st && is->video_st->codec->width){
+        w = is->video_st->codec->width;
+        h = is->video_st->codec->height;
     } else {
-        if(screen_width){
-            w = screen_width;
-            h = screen_height;
-        }else if (is->video_st && is->video_st->codec->width){
-            w = is->video_st->codec->width;
-            h = is->video_st->codec->height;
-        } else {
-            w = 640;
-            h = 480;
-        }
-        flags |= SDL_RESIZABLE;
+        w = 640;
+        h = 480;
     }
 #ifndef CONFIG_DARWIN
     screen = SDL_SetVideoMode(w, h, 0, flags);
@@ -2147,11 +2146,9 @@ static void toggle_full_screen(void)
     is_full_screen = !is_full_screen;
     if (!fs_screen_width) {
         /* use default SDL method */
-        SDL_WM_ToggleFullScreen(screen);
-    } else {
-        /* use the recorded resolution */
-        video_open(cur_stream);
+//        SDL_WM_ToggleFullScreen(screen);
     }
+    video_open(cur_stream);
 }
 
 static void toggle_pause(void)
@@ -2284,8 +2281,8 @@ static void event_loop(void)
             if (cur_stream) {
                 screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
                                           SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
-                cur_stream->width = event.resize.w;
-                cur_stream->height = event.resize.h;
+                screen_width = cur_stream->width = event.resize.w;
+                screen_height= cur_stream->height= event.resize.h;
             }
             break;
         case SDL_QUIT:
@@ -2308,11 +2305,19 @@ static void event_loop(void)
 void opt_width(const char *arg)
 {
     screen_width = atoi(arg);
+    if(screen_width<=0){
+        fprintf(stderr, "invalid width\n");
+        exit(1);
+    }
 }
 
 void opt_height(const char *arg)
 {
     screen_height = atoi(arg);
+    if(screen_height<=0){
+        fprintf(stderr, "invalid height\n");
+        exit(1);
+    }
 }
 
 static void opt_format(const char *arg)