瀏覽代碼

libobs: Add ability to get max cx/cy/fps from service

This obs_service_t object callback was implemented specifically for
services which may have a maximum recommended width, height, and
framerate that needs to be enforced.
jp9000 5 年之前
父節點
當前提交
e4c6b59852
共有 3 個文件被更改,包括 22 次插入1 次删除
  1. 18 0
      libobs/obs-service.c
  2. 1 1
      libobs/obs-service.h
  3. 3 0
      libobs/obs.h

+ 18 - 0
libobs/obs-service.c

@@ -418,3 +418,21 @@ const char *obs_service_get_output_type(const obs_service_t *service)
 		return service->info.get_output_type(service->context.data);
 		return service->info.get_output_type(service->context.data);
 	return NULL;
 	return NULL;
 }
 }
+
+void obs_service_get_max_res_fps(const obs_service_t *service, int *cx, int *cy,
+				 int *fps)
+{
+	if (cx)
+		*cx = 0;
+	if (cy)
+		*cy = 0;
+	if (fps)
+		*fps = 0;
+
+	if (!obs_service_valid(service, "obs_service_get_max_res_fps"))
+		return;
+
+	if (service->info.get_max_res_fps)
+		service->info.get_max_res_fps(service->context.data, cx, cy,
+					      fps);
+}

+ 1 - 1
libobs/obs-service.h

@@ -74,7 +74,7 @@ struct obs_service_info {
 
 
 	const char *(*get_output_type)(void *data);
 	const char *(*get_output_type)(void *data);
 
 
-	/* TODO: more stuff later */
+	void (*get_max_res_fps)(void *data, int *cx, int *cy, int *fps);
 };
 };
 
 
 EXPORT void obs_register_service_s(const struct obs_service_info *info,
 EXPORT void obs_register_service_s(const struct obs_service_info *info,

+ 3 - 0
libobs/obs.h

@@ -2211,6 +2211,9 @@ EXPORT void *obs_service_get_type_data(obs_service_t *service);
 
 
 EXPORT const char *obs_service_get_id(const obs_service_t *service);
 EXPORT const char *obs_service_get_id(const obs_service_t *service);
 
 
+EXPORT void obs_service_get_max_res_fps(const obs_service_t *service, int *cx,
+					int *cy, int *fps);
+
 /* NOTE: This function is temporary and should be removed/replaced at a later
 /* NOTE: This function is temporary and should be removed/replaced at a later
  * date. */
  * date. */
 EXPORT const char *obs_service_get_output_type(const obs_service_t *service);
 EXPORT const char *obs_service_get_output_type(const obs_service_t *service);