]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
Make debug work early on ffplay
[ffmpeg] / ffplay.c
index 030a760ae4a2ad83c2e1a76bf9aae0d665cf2848..bbc4ad36853b40ce0d10c807c7ba220c558fc584 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -19,6 +19,7 @@
 #define HAVE_AV_CONFIG_H
 #include "avformat.h"
 
+#include "version.h"
 #include "cmdutils.h"
 
 #include <SDL.h>
@@ -1605,8 +1606,6 @@ static int stream_component_open(VideoState *is, int stream_index)
     codec = avcodec_find_decoder(enc->codec_id);
     enc->debug_mv = debug_mv;
     enc->debug = debug;
-    if(debug)
-        av_log_set_level(AV_LOG_DEBUG);
     enc->workaround_bugs = workaround_bugs;
     enc->lowres = lowres;
     if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE;
@@ -1735,7 +1734,7 @@ static void stream_component_close(VideoState *is, int stream_index)
     }
 }
 
-void dump_stream_info(AVFormatContext *s)
+static void dump_stream_info(const AVFormatContext *s)
 {
     if (s->track != 0)
         fprintf(stderr, "Track: %d\n", s->track);
@@ -2042,7 +2041,7 @@ static void stream_close(VideoState *is)
     SDL_DestroyMutex(is->video_decoder_mutex);
 }
 
-void stream_cycle_channel(VideoState *is, int codec_type)
+static void stream_cycle_channel(VideoState *is, int codec_type)
 {
     AVFormatContext *ic = is->ic;
     int start_index, stream_index;
@@ -2092,33 +2091,39 @@ void stream_cycle_channel(VideoState *is, int codec_type)
 }
 
 
-void toggle_full_screen(void)
+static void toggle_full_screen(void)
 {
     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 {
-        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)
+static void toggle_pause(void)
 {
     if (cur_stream)
         stream_pause(cur_stream);
     step = 0;
 }
 
-void step_to_next_frame(void)
+static void step_to_next_frame(void)
 {
     if (cur_stream) {
         if (cur_stream->paused)
@@ -2128,7 +2133,7 @@ void step_to_next_frame(void)
     step = 1;
 }
 
-void do_exit(void)
+static void do_exit(void)
 {
     if (cur_stream) {
         stream_close(cur_stream);
@@ -2140,7 +2145,7 @@ void do_exit(void)
     exit(0);
 }
 
-void toggle_audio_display(void)
+static void toggle_audio_display(void)
 {
     if (cur_stream) {
         cur_stream->show_audio = !cur_stream->show_audio;
@@ -2148,7 +2153,7 @@ void toggle_audio_display(void)
 }
 
 /* handle an event sent by the GUI */
-void event_loop(void)
+static void event_loop(void)
 {
     SDL_Event event;
     double incr, pos, frac;
@@ -2312,6 +2317,7 @@ void opt_seek(const char *arg)
 
 static void opt_debug(const char *arg)
 {
+    av_log_set_level(atoi(arg));
     debug = atoi(arg);
 }
 
@@ -2426,10 +2432,11 @@ int main(int argc, char **argv)
     }
 
     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;
-
+#endif
         flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
         if (is_full_screen && fs_screen_width) {
             w = fs_screen_width;