From 66f993d214b418bbab0bf57af8e12190611f628f Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 25 Dec 2017 14:06:36 -0800 Subject: [PATCH] libobs: Exclude certain declarations from SWIG processing Prevents SWIG from being able to process certain declarations that would cause binding generation errors/warnings. --- UI/obs-frontend-api/obs-frontend-api.h | 8 ++++++++ libobs/graphics/graphics.h | 7 +++++++ libobs/obs-hotkey.h | 10 +++++++++- libobs/obs.h | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/UI/obs-frontend-api/obs-frontend-api.h b/UI/obs-frontend-api/obs-frontend-api.h index 7802efbf8..bd504a7fe 100644 --- a/UI/obs-frontend-api/obs-frontend-api.h +++ b/UI/obs-frontend-api/obs-frontend-api.h @@ -47,6 +47,8 @@ enum obs_frontend_event { /* ------------------------------------------------------------------------- */ +#ifndef SWIG + struct obs_frontend_source_list { DARRAY(obs_source_t*) sources; }; @@ -60,6 +62,8 @@ static inline void obs_frontend_source_list_free( da_free(source_list->sources); } +#endif //!SWIG + /* ------------------------------------------------------------------------- */ /* NOTE: Functions that return char** string lists are a single allocation of @@ -73,6 +77,8 @@ static inline void obs_frontend_source_list_free( * translated, and obs_frontend_pop_ui_translation when translation is * complete. */ +#ifndef SWIG + EXPORT void *obs_frontend_get_main_window(void); EXPORT void *obs_frontend_get_main_window_handle(void); @@ -128,6 +134,8 @@ EXPORT void obs_frontend_push_ui_translation( obs_frontend_translate_ui_cb translate); EXPORT void obs_frontend_pop_ui_translation(void); +#endif //!SWIG + EXPORT void obs_frontend_streaming_start(void); EXPORT void obs_frontend_streaming_stop(void); EXPORT bool obs_frontend_streaming_active(void); diff --git a/libobs/graphics/graphics.h b/libobs/graphics/graphics.h index 8ad0afce1..df9583f0b 100644 --- a/libobs/graphics/graphics.h +++ b/libobs/graphics/graphics.h @@ -291,6 +291,7 @@ enum gs_shader_param_type { GS_SHADER_PARAM_TEXTURE, }; +#ifndef SWIG struct gs_shader_param_info { enum gs_shader_param_type type; const char *name; @@ -327,6 +328,7 @@ EXPORT void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size); EXPORT void gs_shader_set_default(gs_sparam_t *param); EXPORT void gs_shader_set_next_sampler(gs_sparam_t *param, gs_samplerstate_t *sampler); +#endif /* --------------------------------------------------- * effect functions @@ -340,6 +342,7 @@ EXPORT void gs_shader_set_next_sampler(gs_sparam_t *param, GS_EFFECT_TEXTURE };*/ +#ifndef SWIG struct gs_effect_param_info { const char *name; enum gs_shader_param_type type; @@ -349,6 +352,7 @@ struct gs_effect_param_info { float min, max, inc, mul; */ }; +#endif EXPORT void gs_effect_destroy(gs_effect_t *effect); @@ -382,8 +386,11 @@ EXPORT void gs_effect_update_params(gs_effect_t *effect); EXPORT gs_eparam_t *gs_effect_get_viewproj_matrix(const gs_effect_t *effect); EXPORT gs_eparam_t *gs_effect_get_world_matrix(const gs_effect_t *effect); +#ifndef SWIG EXPORT void gs_effect_get_param_info(const gs_eparam_t *param, struct gs_effect_param_info *info); +#endif + EXPORT void gs_effect_set_bool(gs_eparam_t *param, bool val); EXPORT void gs_effect_set_float(gs_eparam_t *param, float val); EXPORT void gs_effect_set_int(gs_eparam_t *param, int val); diff --git a/libobs/obs-hotkey.h b/libobs/obs-hotkey.h index 7ff2bae7a..9a616832f 100644 --- a/libobs/obs-hotkey.h +++ b/libobs/obs-hotkey.h @@ -22,9 +22,15 @@ extern "C" { #endif typedef size_t obs_hotkey_id; -#define OBS_INVALID_HOTKEY_ID (~(obs_hotkey_id)0) typedef size_t obs_hotkey_pair_id; + +#ifndef SWIG +#define OBS_INVALID_HOTKEY_ID (~(obs_hotkey_id)0) #define OBS_INVALID_HOTKEY_PAIR_ID (~(obs_hotkey_pair_id)0) +#else +const size_t OBS_INVALID_HOTKEY_ID = (size_t)-1; +const size_t OBS_INVALID_HOTKEY_PAIR_ID = (size_t)-1; +#endif enum obs_key { #define OBS_HOTKEY(x) x, @@ -68,6 +74,7 @@ EXPORT obs_hotkey_id obs_hotkey_binding_get_hotkey_id( EXPORT obs_hotkey_t *obs_hotkey_binding_get_hotkey( obs_hotkey_binding_t *binding); +#ifndef SWIG struct obs_hotkeys_translations { const char *insert; const char *del; @@ -115,6 +122,7 @@ struct obs_hotkeys_translations { * the default English translations for that specific operating system. */ EXPORT void obs_hotkeys_set_translations_s( struct obs_hotkeys_translations *translations, size_t size); +#endif #define obs_hotkeys_set_translations(translations) \ obs_hotkeys_set_translations_s(translations, \ diff --git a/libobs/obs.h b/libobs/obs.h index 5c51ed29a..6a70a8b71 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -145,6 +145,7 @@ struct obs_transform_info { struct vec2 bounds; }; +#ifndef SWIG /** * Video initialization structure */ @@ -175,6 +176,7 @@ struct obs_video_info { enum obs_scale_type scale_type; /**< How to scale if scaling */ }; +#endif /** * Audio initialization structure @@ -281,6 +283,7 @@ EXPORT const char *obs_get_locale(void); */ EXPORT profiler_name_store_t *obs_get_profiler_name_store(void); +#ifndef SWIG /** * Sets base video output base resolution/fps/format. * @@ -298,6 +301,7 @@ EXPORT profiler_name_store_t *obs_get_profiler_name_store(void); * OBS_VIDEO_FAIL for generic failure */ EXPORT int obs_reset_video(struct obs_video_info *ovi); +#endif /** * Sets base audio output format/channels/samples/etc @@ -306,8 +310,10 @@ EXPORT int obs_reset_video(struct obs_video_info *ovi); */ EXPORT bool obs_reset_audio(const struct obs_audio_info *oai); +#ifndef SWIG /** Gets the current video settings, returns false if no video */ EXPORT bool obs_get_video_info(struct obs_video_info *ovi); +#endif /** Gets the current audio settings, returns false if no audio */ EXPORT bool obs_get_audio_info(struct obs_audio_info *oai); @@ -381,6 +387,7 @@ EXPORT void obs_load_all_modules(void); * be called after all modules have been loaded. */ EXPORT void obs_post_load_modules(void); +#ifndef SWIG struct obs_module_info { const char *bin_path; const char *data_path; @@ -391,6 +398,7 @@ typedef void (*obs_find_module_callback_t)(void *param, /** Finds all modules within the search paths added by obs_add_module_path. */ EXPORT void obs_find_modules(obs_find_module_callback_t callback, void *param); +#endif typedef void (*obs_enum_module_callback_t)(void *param, obs_module_t *module); @@ -539,9 +547,11 @@ enum obs_base_effect { /** Returns a commonly used base effect */ EXPORT gs_effect_t *obs_get_base_effect(enum obs_base_effect effect); +#ifndef SWIG /* DEPRECATED: gets texture_rect default effect */ DEPRECATED EXPORT gs_effect_t *obs_get_default_rect_effect(void); +#endif /** Returns the primary obs signal handler */ EXPORT signal_handler_t *obs_get_signal_handler(void); @@ -549,9 +559,11 @@ EXPORT signal_handler_t *obs_get_signal_handler(void); /** Returns the primary obs procedure handler */ EXPORT proc_handler_t *obs_get_proc_handler(void); +#ifndef SWIG /** Renders the main view */ DEPRECATED EXPORT void obs_render_main_view(void); +#endif /** Renders the last main output texture */ EXPORT void obs_render_main_texture(void); @@ -1759,6 +1771,7 @@ EXPORT const char *obs_encoder_get_id(const obs_encoder_t *encoder); EXPORT uint32_t obs_get_encoder_caps(const char *encoder_id); +#ifndef SWIG /** Duplicates an encoder packet */ DEPRECATED EXPORT void obs_duplicate_encoder_packet(struct encoder_packet *dst, @@ -1766,6 +1779,7 @@ EXPORT void obs_duplicate_encoder_packet(struct encoder_packet *dst, DEPRECATED EXPORT void obs_free_encoder_packet(struct encoder_packet *packet); +#endif EXPORT void obs_encoder_packet_ref(struct encoder_packet *dst, struct encoder_packet *src); -- GitLab