Commit 1d6c82d4 authored by Stefano Sabatini's avatar 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: 's avatarStefano Sabatini <stefano.sabatini-lala@poste.it>
parent 54ad8e06
...@@ -168,7 +168,7 @@ typedef struct VideoState { ...@@ -168,7 +168,7 @@ typedef struct VideoState {
AVAudioConvert *reformat_ctx; AVAudioConvert *reformat_ctx;
enum ShowMode { 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; } show_mode;
int16_t sample_array[SAMPLE_ARRAY_SIZE]; int16_t sample_array[SAMPLE_ARRAY_SIZE];
int sample_array_index; int sample_array_index;
...@@ -264,7 +264,7 @@ static int exit_on_keydown; ...@@ -264,7 +264,7 @@ static int exit_on_keydown;
static int exit_on_mousedown; static int exit_on_mousedown;
static int loop=1; static int loop=1;
static int framedrop=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; static int rdftspeed=20;
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
...@@ -2471,10 +2471,8 @@ static int decode_thread(void *arg) ...@@ -2471,10 +2471,8 @@ static int decode_thread(void *arg)
ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]); ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]);
} }
is->refresh_tid = SDL_CreateThread(refresh_thread, is); is->refresh_tid = SDL_CreateThread(refresh_thread, is);
if(ret<0) { if (is->show_mode == SHOW_MODE_NONE)
if (!display_disable) is->show_mode = ret >= 0 ? SHOW_MODE_VIDEO : SHOW_MODE_RDFT;
is->show_mode = SHOW_MODE_RDFT;
}
if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) { if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]); stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment