aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2013-02-23 02:15:06 +0100
committerMarton Balint <cus@passwd.hu>2013-02-27 21:34:13 +0100
commitac37d21f496438f6c8694025744287b60bdd9ba6 (patch)
treec8d0ba07d8cd250d2eb9b4ee25c078b0b5337bc9
parentd0c6ed7da01d3c99448512da722a03604b937048 (diff)
downloadffmpeg-ac37d21f496438f6c8694025744287b60bdd9ba6.tar.gz
ffplay: do not cycle through unavailable show modes
Fixes ticket #2200. Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--ffplay.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ffplay.c b/ffplay.c
index ca1fb9eb89..01ee15e65c 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2943,10 +2943,17 @@ static void toggle_full_screen(VideoState *is)
static void toggle_audio_display(VideoState *is)
{
int bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
- is->show_mode = (is->show_mode + 1) % SHOW_MODE_NB;
- fill_rectangle(screen,
- is->xleft, is->ytop, is->width, is->height,
- bgcolor, 1);
+ int next = is->show_mode;
+ do {
+ next = (next + 1) % SHOW_MODE_NB;
+ } while (next != is->show_mode && (next == SHOW_MODE_VIDEO && !is->video_st || next != SHOW_MODE_VIDEO && !is->audio_st));
+ if (is->show_mode != next) {
+ fill_rectangle(screen,
+ is->xleft, is->ytop, is->width, is->height,
+ bgcolor, 1);
+ is->force_refresh = 1;
+ is->show_mode = next;
+ }
}
static void refresh_loop_wait_event(VideoState *is, SDL_Event *event) {
@@ -3008,7 +3015,6 @@ static void event_loop(VideoState *cur_stream)
break;
case SDLK_w:
toggle_audio_display(cur_stream);
- cur_stream->force_refresh = 1;
break;
case SDLK_PAGEUP:
incr = 600.0;