diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/vo.h | 6 | ||||
-rw-r--r-- | video/out/vo_lavc.c | 2 | ||||
-rw-r--r-- | video/out/vo_vdpau.c | 26 | ||||
-rw-r--r-- | video/out/x11_common.c | 4 | ||||
-rw-r--r-- | video/out/x11_common.h | 2 |
5 files changed, 22 insertions, 18 deletions
diff --git a/video/out/vo.h b/video/out/vo.h index f357b21797..3dcc58b6c3 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -195,9 +195,13 @@ struct vo_driver { /* * Blit/Flip buffer to the screen. Must be called after each frame! + * pts_us is the frame presentation time, linked to mp_time_us(). + * pts_us is 0 if the frame should be presented immediately. + * duration is estimated time in us until the next frame is shown. + * duration is -1 if it is unknown or unset. */ void (*flip_page)(struct vo *vo); - void (*flip_page_timed)(struct vo *vo, unsigned int pts_us, int duration); + void (*flip_page_timed)(struct vo *vo, int64_t pts_us, int duration); /* * Closes driver. Should restore the original state of the system. diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c index 6d1eb5c6f8..5140720f92 100644 --- a/video/out/vo_lavc.c +++ b/video/out/vo_lavc.c @@ -460,7 +460,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) } } -static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration) +static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) { } diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index d213b33c6f..975ef526c3 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -97,13 +97,13 @@ struct vdpctx { bool is_preempted; bool preemption_acked; bool preemption_user_notified; - unsigned int last_preemption_retry_fail; + double last_preemption_retry_fail; VdpGetProcAddress *vdp_get_proc_address; VdpPresentationQueueTarget flip_target; VdpPresentationQueue flip_queue; uint64_t last_vdp_time; - unsigned int last_sync_update; + uint64_t last_sync_update; VdpOutputSurface output_surfaces[MAX_OUTPUT_SURFACES]; VdpOutputSurface screenshot_surface; @@ -181,15 +181,15 @@ struct vdpctx { static bool status_ok(struct vo *vo); -static int change_vdptime_sync(struct vdpctx *vc, unsigned int *t) +static int change_vdptime_sync(struct vdpctx *vc, int64_t *t) { struct vdp_functions *vdp = vc->vdp; VdpStatus vdp_st; VdpTime vdp_time; vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time); CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time"); - unsigned int t1 = *t; - unsigned int t2 = GetTimer(); + uint64_t t1 = *t; + uint64_t t2 = mp_time_us(); uint64_t old = vc->last_vdp_time + (t1 - vc->last_sync_update) * 1000ULL; if (vdp_time > old) { if (vdp_time > old + (t2 - t1) * 1000ULL) @@ -209,7 +209,7 @@ static uint64_t sync_vdptime(struct vo *vo) { struct vdpctx *vc = vo->priv; - unsigned int t = GetTimer(); + uint64_t t = mp_time_us(); if (t - vc->last_sync_update > 5000000) change_vdptime_sync(vc, &t); uint64_t now = (t - vc->last_sync_update) * 1000ULL + vc->last_vdp_time; @@ -218,10 +218,10 @@ static uint64_t sync_vdptime(struct vo *vo) return now; } -static uint64_t convert_to_vdptime(struct vo *vo, unsigned int t) +static uint64_t convert_to_vdptime(struct vo *vo, uint64_t t) { struct vdpctx *vc = vo->priv; - return (int)(t - vc->last_sync_update) * 1000LL + vc->last_vdp_time; + return (t - vc->last_sync_update) * 1000LL + vc->last_vdp_time; } static int render_video_to_output_surface(struct vo *vo, @@ -513,7 +513,7 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time); CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time"); vc->last_vdp_time = vdp_time; - vc->last_sync_update = GetTimer(); + vc->last_sync_update = mp_time_us(); vc->vsync_interval = 1; if (vc->composite_detect && vo_x11_screen_is_composited(vo)) { @@ -822,11 +822,11 @@ static int handle_preemption(struct vo *vo) } /* Trying to initialize seems to be quite slow, so only try once a * second to avoid using 100% CPU. */ - if (vc->last_preemption_retry_fail - && GetTimerMS() - vc->last_preemption_retry_fail < 1000) + if (vc->last_preemption_retry_fail && + mp_time_sec() - vc->last_preemption_retry_fail < 1.0) return -1; if (win_x11_init_vdpau_procs(vo) < 0 || initialize_vdpau_objects(vo) < 0) { - vc->last_preemption_retry_fail = GetTimerMS() | 1; + vc->last_preemption_retry_fail = mp_time_sec(); return -1; } vc->last_preemption_retry_fail = 0; @@ -1102,7 +1102,7 @@ static inline uint64_t prev_vs2(struct vdpctx *vc, uint64_t ts, int shift) return ts - offset; } -static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration) +static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) { struct vdpctx *vc = vo->priv; struct vdp_functions *vdp = vc->vdp; diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 571bc9032c..5eb6031d66 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -1398,10 +1398,10 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) static void xscreensaver_heartbeat(struct vo_x11_state *x11) { - unsigned int time = GetTimerMS(); + double time = mp_time_sec(); if (x11->display && x11->screensaver_off && - (time - x11->screensaver_time_last) > 30000) + (time - x11->screensaver_time_last) > 30) { x11->screensaver_time_last = time; diff --git a/video/out/x11_common.h b/video/out/x11_common.h index 8717c225e2..74822dcecb 100644 --- a/video/out/x11_common.h +++ b/video/out/x11_common.h @@ -40,7 +40,7 @@ struct vo_x11_state { int screensaver_off; int dpms_disabled; - unsigned int screensaver_time_last; + double screensaver_time_last; XIM xim; XIC xic; |