libobs: Add obs_get_frame_interval_ns

Returns the current video frame interval between frames, in nanoseconds.
master
jp9000 2019-07-06 15:30:52 -07:00
parent 3a6a1a4ff8
commit 70ecbcd5d4
4 changed files with 8 additions and 0 deletions

View File

@ -273,6 +273,7 @@ struct obs_core_video {
volatile bool gpu_encode_stop;
uint64_t video_time;
uint64_t video_frame_interval_ns;
uint64_t video_avg_frame_time_ns;
double video_fps;
video_t *video;

View File

@ -824,6 +824,7 @@ void *obs_graphics_thread(void *param)
bool was_active = false;
obs->video.video_time = os_gettime_ns();
obs->video.video_frame_interval_ns = interval;
os_set_thread_name("libobs: graphics thread");

View File

@ -2144,6 +2144,11 @@ uint64_t obs_get_average_frame_time_ns(void)
return obs ? obs->video.video_avg_frame_time_ns : 0;
}
uint64_t obs_get_frame_interval_ns(void)
{
return obs ? obs->video.video_frame_interval_ns : 0;
}
enum obs_obj_type obs_obj_get_type(void *obj)
{
struct obs_context_data *context = obj;

View File

@ -727,6 +727,7 @@ EXPORT uint64_t obs_get_video_frame_time(void);
EXPORT double obs_get_active_fps(void);
EXPORT uint64_t obs_get_average_frame_time_ns(void);
EXPORT uint64_t obs_get_frame_interval_ns(void);
EXPORT uint32_t obs_get_total_frames(void);
EXPORT uint32_t obs_get_lagged_frames(void);