Преглед на файлове

libobs: Add obs_is_source_configurable function

Mostly only used for transitions with the intention of automatically
creating transitions which don't require configuration, returns whether
the source has any properties or not (whether it's configurable)
jp9000 преди 9 години
родител
ревизия
56dc605497
променени са 2 файла, в които са добавени 17 реда и са изтрити 0 реда
  1. 12 0
      libobs/obs-source.c
  2. 5 0
      libobs/obs.h

+ 12 - 0
libobs/obs-source.c

@@ -586,6 +586,18 @@ obs_properties_t *obs_get_source_properties(const char *id)
 	return NULL;
 	return NULL;
 }
 }
 
 
+bool obs_is_source_configurable(const char *id)
+{
+	const struct obs_source_info *info = get_source_info(id);
+	return info && info->get_properties;
+}
+
+bool obs_source_configurable(const obs_source_t *source)
+{
+	return data_valid(source, "obs_source_configurable") &&
+		source->info.get_properties;
+}
+
 obs_properties_t *obs_source_properties(const obs_source_t *source)
 obs_properties_t *obs_source_properties(const obs_source_t *source)
 {
 {
 	if (!data_valid(source, "obs_source_properties"))
 	if (!data_valid(source, "obs_source_properties"))

+ 5 - 0
libobs/obs.h

@@ -685,6 +685,11 @@ EXPORT obs_data_t *obs_get_source_defaults(const char *id);
 /** Returns the property list, if any.  Free with obs_properties_destroy */
 /** Returns the property list, if any.  Free with obs_properties_destroy */
 EXPORT obs_properties_t *obs_get_source_properties(const char *id);
 EXPORT obs_properties_t *obs_get_source_properties(const char *id);
 
 
+/** Returns whether the source has custom properties or not */
+EXPORT bool obs_is_source_configurable(const char *id);
+
+EXPORT bool obs_source_configurable(const obs_source_t *source);
+
 /**
 /**
  * Returns the properties list for a specific existing source.  Free with
  * Returns the properties list for a specific existing source.  Free with
  * obs_properties_destroy
  * obs_properties_destroy