diff options
author | Marton Balint <cus@passwd.hu> | 2018-06-11 23:19:37 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2018-06-20 22:26:41 +0200 |
commit | e8050aa79152899dbe50d4fb31e9303db8818cc2 (patch) | |
tree | bfcc4203a1109861a7b1f3919b3b643cf435c804 | |
parent | b1e0e216462a989a39e7b413aef6d32f8cedc154 (diff) | |
download | ffmpeg-e8050aa79152899dbe50d4fb31e9303db8818cc2.tar.gz |
ffplay: ignore keypress events before a window is created
Current ffplay code assumes that the read thread is in its main loop before any
key events are captured, but apparently on IOS even keypresses without a window
are forwared.
Fixes ticket #7252.
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r-- | fftools/ffplay.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 84ba6673dc..55cea32cae 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3251,15 +3251,14 @@ static void event_loop(VideoState *cur_stream) refresh_loop_wait_event(cur_stream, &event); switch (event.type) { case SDL_KEYDOWN: - if (exit_on_keydown) { + if (exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q) { do_exit(cur_stream); break; } + // If we don't yet have a window, skip all key events, because read_thread might still be initializing... + if (!cur_stream->width) + continue; switch (event.key.keysym.sym) { - case SDLK_ESCAPE: - case SDLK_q: - do_exit(cur_stream); - break; case SDLK_f: toggle_full_screen(cur_stream); cur_stream->force_refresh = 1; |