Browse Source

libobs: Add API function to get version string

Some plugins are using the OBS_VERSION macro obs-config.h to specify the
current version, which will bake the string in to the plugin, making it
so that if the plugin is not replaced for a patch, it could potentially
have the incorrect version.  This makes it so that a plugin/frontend can
get the current version string that's baked in to libobs itself.
jp9000 8 years ago
parent
commit
e423492d61
2 changed files with 8 additions and 0 deletions
  1. 5 0
      libobs/obs.c
  2. 3 0
      libobs/obs.h

+ 5 - 0
libobs/obs.c

@@ -884,6 +884,11 @@ uint32_t obs_get_version(void)
 	return LIBOBS_API_VER;
 }
 
+const char *obs_get_version_string(void)
+{
+	return OBS_VERSION;
+}
+
 void obs_set_locale(const char *locale)
 {
 	struct obs_module *module;

+ 3 - 0
libobs/obs.h

@@ -260,6 +260,9 @@ EXPORT bool obs_initialized(void);
 /** @return The current core version */
 EXPORT uint32_t obs_get_version(void);
 
+/** @return The current core version string */
+EXPORT const char *obs_get_version_string(void);
+
 /**
  * Sets a new locale to use for modules.  This will call obs_module_set_locale
  * for each module with the new locale.