1
0
Эх сурвалжийг харах

libobs: Add API to get base source dimensions

These functions are primarily for use with filters, filters need to be
able to get the width/height of a target source without it necessarily
getting the post-filtered dimensions.
jp9000 10 жил өмнө
parent
commit
b9eef3c4f2
2 өөрчлөгдсөн 20 нэмэгдсэн , 0 устгасан
  1. 14 0
      libobs/obs-source.c
  2. 6 0
      libobs/obs.h

+ 14 - 0
libobs/obs-source.c

@@ -1245,6 +1245,20 @@ uint32_t obs_source_get_height(obs_source_t *source)
 		get_base_height(source);
 }
 
+uint32_t obs_source_get_base_width(obs_source_t *source)
+{
+	if (!source_valid(source)) return 0;
+
+	return get_base_width(source);
+}
+
+uint32_t obs_source_get_base_height(obs_source_t *source)
+{
+	if (!source_valid(source)) return 0;
+
+	return get_base_height(source);
+}
+
 obs_source_t *obs_filter_get_parent(const obs_source_t *filter)
 {
 	return filter ? filter->filter_parent : NULL;

+ 6 - 0
libobs/obs.h

@@ -922,6 +922,12 @@ EXPORT void obs_source_send_key_click(obs_source_t *source,
 /** Sets the default source flags. */
 EXPORT void obs_source_set_default_flags(obs_source_t *source, uint32_t flags);
 
+/** Gets the base width for a source (not taking in to account filtering) */
+EXPORT uint32_t obs_source_get_base_width(obs_source_t *source);
+
+/** Gets the base height for a source (not taking in to account filtering) */
+EXPORT uint32_t obs_source_get_base_height(obs_source_t *source);
+
 
 /* ------------------------------------------------------------------------- */
 /* Scenes */