You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
ffplay: hide cursor on no mouse movement
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
13
ffplay.c
13
ffplay.c
@@ -90,6 +90,8 @@ const int program_birth_year = 2003;
|
|||||||
/* TODO: We assume that a decoded and resampled frame fits into this buffer */
|
/* TODO: We assume that a decoded and resampled frame fits into this buffer */
|
||||||
#define SAMPLE_ARRAY_SIZE (8 * 65536)
|
#define SAMPLE_ARRAY_SIZE (8 * 65536)
|
||||||
|
|
||||||
|
#define CURSOR_HIDE_DELAY 1000000
|
||||||
|
|
||||||
static int64_t sws_flags = SWS_BICUBIC;
|
static int64_t sws_flags = SWS_BICUBIC;
|
||||||
|
|
||||||
typedef struct MyAVPacketList {
|
typedef struct MyAVPacketList {
|
||||||
@@ -303,6 +305,8 @@ static const char *audio_codec_name;
|
|||||||
static const char *subtitle_codec_name;
|
static const char *subtitle_codec_name;
|
||||||
static const char *video_codec_name;
|
static const char *video_codec_name;
|
||||||
static int rdftspeed = 20;
|
static int rdftspeed = 20;
|
||||||
|
static int64_t cursor_last_shown;
|
||||||
|
static int cursor_hidden = 0;
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
static char *vfilters = NULL;
|
static char *vfilters = NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -3038,6 +3042,11 @@ static void event_loop(VideoState *cur_stream)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
|
if (cursor_hidden) {
|
||||||
|
SDL_ShowCursor(1);
|
||||||
|
cursor_hidden = 0;
|
||||||
|
}
|
||||||
|
cursor_last_shown = av_gettime();
|
||||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||||
x = event.button.x;
|
x = event.button.x;
|
||||||
} else {
|
} else {
|
||||||
@@ -3084,6 +3093,10 @@ static void event_loop(VideoState *cur_stream)
|
|||||||
alloc_picture(event.user.data1);
|
alloc_picture(event.user.data1);
|
||||||
break;
|
break;
|
||||||
case FF_REFRESH_EVENT:
|
case FF_REFRESH_EVENT:
|
||||||
|
if (!cursor_hidden && av_gettime() - cursor_last_shown > CURSOR_HIDE_DELAY) {
|
||||||
|
SDL_ShowCursor(0);
|
||||||
|
cursor_hidden = 1;
|
||||||
|
}
|
||||||
video_refresh(event.user.data1);
|
video_refresh(event.user.data1);
|
||||||
cur_stream->refresh = 0;
|
cur_stream->refresh = 0;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user