diff options
Diffstat (limited to 'video/out/vo.c')
-rw-r--r-- | video/out/vo.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 6fff185c6c..52ed04d3b5 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -25,11 +25,12 @@ #include <stdbool.h> #include <unistd.h> -//#include <sys/mman.h> + +#include "talloc.h" #include "config.h" +#include "osdep/timer.h" #include "core/options.h" -#include "talloc.h" #include "core/bstr.h" #include "vo.h" #include "aspect.h" @@ -41,11 +42,6 @@ #include "video/vfcap.h" #include "sub/sub.h" -#include "osdep/shmem.h" -#ifdef CONFIG_X11 -#include "x11_common.h" -#endif - int xinerama_x; int xinerama_y; @@ -247,6 +243,7 @@ void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration) void vo_check_events(struct vo *vo) { + vo->next_wakeup_time = GetTimerMS() + 60 * 1000; if (!vo->config_ok) { if (vo->registered_fd != -1) mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd); @@ -256,6 +253,20 @@ void vo_check_events(struct vo *vo) vo->driver->check_events(vo); } +// Return the amount of time vo_check_events() should be called in milliseconds. +// Note: video timing is completely separate from this. +unsigned int vo_get_sleep_time(struct vo *vo) +{ + unsigned int sleep = 60 * 1000; + if (vo->config_ok && vo->next_wakeup_time) { + unsigned int now = GetTimerMS(); + sleep = 0; + if (vo->next_wakeup_time >= now) + sleep = vo->next_wakeup_time - now; + } + return sleep; +} + void vo_seek_reset(struct vo *vo) { vo_control(vo, VOCTRL_RESET, NULL); |