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@poste.it>
This commit is contained in:
Stefano Sabatini 2011-04-25 00:49:18 +02:00
parent 54ad8e06f4
commit 1d6c82d405

View File

@ -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]);