obspython.i 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. %module(threads="1") obspython
  2. %nothread;
  3. %{
  4. #define SWIG_FILE_WITH_INIT
  5. #define DEPRECATED_START
  6. #define DEPRECATED_END
  7. #include <graphics/graphics.h>
  8. #include <graphics/vec4.h>
  9. #include <graphics/vec3.h>
  10. #include <graphics/vec2.h>
  11. #include <graphics/matrix4.h>
  12. #include <graphics/matrix3.h>
  13. #include <graphics/quat.h>
  14. #include <obs.h>
  15. #include <obs-hotkey.h>
  16. #include <obs-source.h>
  17. #include <obs-data.h>
  18. #include <obs-properties.h>
  19. #include <obs-interaction.h>
  20. #include <callback/calldata.h>
  21. #include <callback/decl.h>
  22. #include <callback/proc.h>
  23. #include <callback/signal.h>
  24. #include <util/bmem.h>
  25. #include <util/base.h>
  26. #include "obspython.h"
  27. #include <util/platform.h>
  28. #include <util/config-file.h>
  29. #if defined(ENABLE_UI)
  30. #include "obs-frontend-api.h"
  31. #endif
  32. /* Redefine SWIG_PYTHON_INITIALIZE_THREADS if:
  33. * - Python version is 3.7 or later because PyEval_InitThreads() became deprecated and unnecessary
  34. * - SWIG version is not 4.1 or later because SWIG_PYTHON_INITIALIZE_THREADS will be define correctly
  35. * with Python 3.7 and later */
  36. #if PY_VERSION_HEX >= 0x03070000 && SWIGVERSION < 0x040100
  37. #undef SWIG_PYTHON_INITIALIZE_THREADS
  38. #define SWIG_PYTHON_INITIALIZE_THREADS
  39. #endif
  40. %}
  41. %feature("python:annotations", "c");
  42. %feature("autodoc", "2");
  43. #define DEPRECATED_START
  44. #define DEPRECATED_END
  45. #define OBS_DEPRECATED
  46. #define OBS_EXTERNAL_DEPRECATED
  47. #define EXPORT
  48. %rename(blog) wrap_blog;
  49. %inline %{
  50. static inline void wrap_blog(int log_level, const char *message)
  51. {
  52. blog(log_level, "%s", message);
  53. }
  54. %}
  55. %include "stdint.i"
  56. /* Used to free when using %newobject functions. E.G.:
  57. * %newobject obs_module_get_config_path; */
  58. %typemap(newfree) char * "bfree($1);";
  59. %ignore blog;
  60. %ignore blogva;
  61. %ignore bcrash;
  62. %ignore base_set_crash_handler;
  63. %ignore obs_source_info;
  64. %ignore obs_register_source_s(const struct obs_source_info *info, size_t size);
  65. %ignore obs_output_set_video(obs_output_t *output, video_t *video);
  66. %ignore obs_output_video(const obs_output_t *output);
  67. %ignore obs_add_tick_callback;
  68. %ignore obs_remove_tick_callback;
  69. %ignore obs_add_main_render_callback;
  70. %ignore obs_remove_main_render_callback;
  71. %ignore obs_enum_sources;
  72. %ignore obs_properties_add_button;
  73. %ignore obs_property_set_modified_callback;
  74. %ignore signal_handler_connect;
  75. %ignore signal_handler_disconnect;
  76. %ignore signal_handler_connect_global;
  77. %ignore signal_handler_disconnect_global;
  78. %ignore signal_handler_remove_current;
  79. %ignore obs_hotkey_register_frontend;
  80. %ignore obs_hotkey_register_encoder;
  81. %ignore obs_hotkey_register_output;
  82. %ignore obs_hotkey_register_service;
  83. %ignore obs_hotkey_register_source;
  84. %ignore obs_hotkey_pair_register_frontend;
  85. %ignore obs_hotkey_pair_register_encoder;
  86. %ignore obs_hotkey_pair_register_output;
  87. %ignore obs_hotkey_pair_register_service;
  88. %ignore obs_hotkey_pair_register_source;
  89. /* The function gs_debug_marker_begin_format has a va_args.
  90. * By default, SWIG just drop it and replace it with a single NULL pointer.
  91. * Source: http://swig.org/Doc4.0/Varargs.html#Varargs_nn4
  92. *
  93. * But the generated wrapper will make the compiler emit a warning
  94. * because varargs is an unused parameter.
  95. * So in the check step, varargs will be treated like any unused parameter. */
  96. %typemap(check) (const float color[4], const char *format, ...) {
  97. (void)varargs;
  98. }
  99. %include "graphics/graphics.h"
  100. %include "graphics/vec4.h"
  101. %include "graphics/vec3.h"
  102. %include "graphics/vec2.h"
  103. %include "graphics/matrix4.h"
  104. %include "graphics/matrix3.h"
  105. %include "graphics/quat.h"
  106. %include "obspython.h"
  107. %include "obs-data.h"
  108. %include "obs-source.h"
  109. %include "obs-properties.h"
  110. %include "obs-interaction.h"
  111. %include "obs-hotkey.h"
  112. %include "obs.h"
  113. %include "callback/calldata.h"
  114. %include "callback/proc.h"
  115. %include "callback/signal.h"
  116. %include "util/bmem.h"
  117. %include "util/base.h"
  118. %include "util/platform.h"
  119. %include "util/config-file.h"
  120. #if defined(ENABLE_UI)
  121. %include "obs-frontend-api.h"
  122. #endif
  123. /* declare these manually because mutex + GIL = deadlocks */
  124. %thread;
  125. void obs_enter_graphics(void); //Should only block on entering mutex
  126. %nothread;
  127. %include "obs.h"