summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-18 15:04:46 +0200
committerwm4 <wm4@nowhere>2014-07-18 15:04:46 +0200
commitdc00b146c487f71ef1f0a23a4f2b9948b2fac18b (patch)
tree0292395823a0bef392c4795acc8d50ca75deedea /player/core.h
parent34fdf082d8d7d79a24962ff2d8b43b3bef5905b2 (diff)
downloadmpv-dc00b146c487f71ef1f0a23a4f2b9948b2fac18b.tar.bz2
mpv-dc00b146c487f71ef1f0a23a4f2b9948b2fac18b.tar.xz
player: remove the last instances of polling
Mouse cursor handling, --heartbeat-cmd, and OSD messages basically relied on polling. For this reason, the playloop always used a small timeout (not more than 500ms). Fix these cases, and raise the timeout to 100 seconds. There is no reason behind this number; for this specific purpose it's as close to infinity as any other number. On MS Windows, or if vo_sdl is used, the timeout remains very small. In these cases the GUI code doesn't do proper event handling in the first place, and fixing it requires much more effort. getch2_poll() still does polling, because as far as I'm aware no event- based way to detect this state change exists.
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/player/core.h b/player/core.h
index 039f5c26cb..01fefd0889 100644
--- a/player/core.h
+++ b/player/core.h
@@ -291,9 +291,11 @@ typedef struct MPContext {
double audio_delay;
- double last_heartbeat;
+ double next_heartbeat;
double last_idle_tick;
+ double sleeptime; // number of seconds to sleep before next iteration
+
double mouse_timer;
unsigned int mouse_event_ts;
bool mouse_cursor_visible;