Explorar el Código

libobs: Add obs_get_frame_interval_ns

Returns the current video frame interval between frames, in nanoseconds.
jp9000 hace 6 años
padre
commit
70ecbcd5d4
Se han modificado 4 ficheros con 8 adiciones y 0 borrados
  1. 1 0
      libobs/obs-internal.h
  2. 1 0
      libobs/obs-video.c
  3. 5 0
      libobs/obs.c
  4. 1 0
      libobs/obs.h

+ 1 - 0
libobs/obs-internal.h

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

+ 1 - 0
libobs/obs-video.c

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

+ 5 - 0
libobs/obs.c

@@ -2144,6 +2144,11 @@ uint64_t obs_get_average_frame_time_ns(void)
 	return obs ? obs->video.video_avg_frame_time_ns : 0;
 	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)
 enum obs_obj_type obs_obj_get_type(void *obj)
 {
 {
 	struct obs_context_data *context = obj;
 	struct obs_context_data *context = obj;

+ 1 - 0
libobs/obs.h

@@ -727,6 +727,7 @@ EXPORT uint64_t obs_get_video_frame_time(void);
 
 
 EXPORT double obs_get_active_fps(void);
 EXPORT double obs_get_active_fps(void);
 EXPORT uint64_t obs_get_average_frame_time_ns(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_total_frames(void);
 EXPORT uint32_t obs_get_lagged_frames(void);
 EXPORT uint32_t obs_get_lagged_frames(void);