[FFmpeg-cvslog] ffplay: fix logic for selecting the show mode in case of missing video

Stefano Sabatini git at videolan.org
Mon Apr 25 22:48:12 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Mon Apr 25 00:49:18 2011 +0200| [1d6c82d40541936fe67061a8374b5bae8fbc4cbb] | committer: Stefano Sabatini

ffplay: fix logic for selecting the show mode in case of missing video

Also automatically select the show mode only if not specified by the
user.

Fix trac issue #109.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d6c82d40541936fe67061a8374b5bae8fbc4cbb
---

 ffplay.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 063cf37..ee0fb0e 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -168,7 +168,7 @@ typedef struct VideoState {
     AVAudioConvert *reformat_ctx;
 
     enum ShowMode {
-        SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
+        SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
     } show_mode;
     int16_t sample_array[SAMPLE_ARRAY_SIZE];
     int sample_array_index;
@@ -264,7 +264,7 @@ static int exit_on_keydown;
 static int exit_on_mousedown;
 static int loop=1;
 static int framedrop=1;
-static enum ShowMode show_mode = SHOW_MODE_VIDEO;
+static enum ShowMode show_mode = SHOW_MODE_NONE;
 
 static int rdftspeed=20;
 #if CONFIG_AVFILTER
@@ -2471,10 +2471,8 @@ static int decode_thread(void *arg)
         ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]);
     }
     is->refresh_tid = SDL_CreateThread(refresh_thread, is);
-    if(ret<0) {
-        if (!display_disable)
-            is->show_mode = SHOW_MODE_RDFT;
-    }
+    if (is->show_mode == SHOW_MODE_NONE)
+        is->show_mode = ret >= 0 ? SHOW_MODE_VIDEO : SHOW_MODE_RDFT;
 
     if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
         stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]);



More information about the ffmpeg-cvslog mailing list