obs-module.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /******************************************************************************
  2. Copyright (C) 2014 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include "obs.h"
  16. #ifdef __cplusplus
  17. #define MODULE_EXPORT extern "C" EXPORT
  18. #else
  19. #define MODULE_EXPORT EXPORT
  20. #endif
  21. /**
  22. * @file
  23. *
  24. * This file is used by modules for module declaration and module exports.
  25. */
  26. /** Required: Declares a libobs module. */
  27. #define OBS_DECLARE_MODULE() \
  28. MODULE_EXPORT uint32_t obs_module_ver(void); \
  29. uint32_t obs_module_ver(void) {return LIBOBS_API_VER;}
  30. /**
  31. * Required: Called when the module is loaded. Use this function to load all
  32. * the sources/encoders/outputs/services for your module, or anything else that
  33. * may need loading.
  34. *
  35. * @param libobs_ver The version of libobs.
  36. * @return Return true to continue loading the module, otherwise
  37. * false to indcate failure and unload the module
  38. */
  39. MODULE_EXPORT bool obs_module_load(uint32_t libobs_version);
  40. /** Optional: Called when the module is unloaded. */
  41. MODULE_EXPORT void obs_module_unload(void);
  42. /**
  43. * Optional: Declares the author(s) of the module
  44. *
  45. * @param name Author name(s)
  46. */
  47. #define OBS_MODULE_AUTHOR(name) \
  48. MODULE_EXPORT const char *obs_module_author(void); \
  49. const char *obs_module_author(void) {return name;}
  50. /**
  51. * Optional: Declares the author of the module
  52. *
  53. * @param locale Locale to look up the description for.
  54. */
  55. MODULE_EXPORT const char *obs_module_description(const char *locale);