mirror of
https://github.com/mpv-player/mpv
synced 2025-01-10 00:49:32 +00:00
video: add VOCTRL_GET_RECENT_FLIP_TIME
This could be used by VO implementations to report a recent vsync time to the generic VO code, which in turn will use it and the display FPS to estimate at which point in time the next vsync will happen.
This commit is contained in:
parent
cd2e4db8a5
commit
3d968fc620
@ -589,7 +589,12 @@ static bool render_frame(struct vo *vo)
|
|||||||
else
|
else
|
||||||
vo->driver->flip_page(vo);
|
vo->driver->flip_page(vo);
|
||||||
|
|
||||||
in->last_flip = mp_time_us();
|
in->last_flip = -1;
|
||||||
|
|
||||||
|
vo->driver->control(vo, VOCTRL_GET_RECENT_FLIP_TIME, &in->last_flip);
|
||||||
|
|
||||||
|
if (in->last_flip < 0)
|
||||||
|
in->last_flip = mp_time_us();
|
||||||
|
|
||||||
long phase = in->last_flip % in->vsync_interval;
|
long phase = in->last_flip % in->vsync_interval;
|
||||||
MP_DBG(vo, "phase: %ld\n", phase);
|
MP_DBG(vo, "phase: %ld\n", phase);
|
||||||
|
@ -86,6 +86,7 @@ enum mp_voctrl {
|
|||||||
|
|
||||||
VOCTRL_GET_ICC_PROFILE_PATH, // char**
|
VOCTRL_GET_ICC_PROFILE_PATH, // char**
|
||||||
VOCTRL_GET_DISPLAY_FPS, // double*
|
VOCTRL_GET_DISPLAY_FPS, // double*
|
||||||
|
VOCTRL_GET_RECENT_FLIP_TIME, // int64_t* (using mp_time_us())
|
||||||
|
|
||||||
VOCTRL_GET_PREF_DEINT, // int*
|
VOCTRL_GET_PREF_DEINT, // int*
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user