From cb2be8723a16f9fdb13582562cb630c945dcd0a7 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 30 Jun 2023 11:44:33 +0200 Subject: Support building for Godot 4.1 (new default). --- src/WebRTCLibPeerConnection.cpp | 4 ++++ src/WebRTCLibPeerConnection.hpp | 4 ++++ src/init_gdextension.cpp | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/WebRTCLibPeerConnection.cpp b/src/WebRTCLibPeerConnection.cpp index a372644..effc1d7 100644 --- a/src/WebRTCLibPeerConnection.cpp +++ b/src/WebRTCLibPeerConnection.cpp @@ -180,7 +180,11 @@ Error WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) { return _create_pc(config); } +#if defined(GDNATIVE_WEBRTC) || defined(GDEXTENSION_WEBRTC_40) Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try { +#else +Ref WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try { +#endif ERR_FAIL_COND_V(!peer_connection, nullptr); // Read config from dictionary diff --git a/src/WebRTCLibPeerConnection.hpp b/src/WebRTCLibPeerConnection.hpp index c4f8111..6608735 100644 --- a/src/WebRTCLibPeerConnection.hpp +++ b/src/WebRTCLibPeerConnection.hpp @@ -79,7 +79,11 @@ public: SignalingState _get_signaling_state() const override; godot::Error _initialize(const godot::Dictionary &p_config) override; +#if defined(GDNATIVE_WEBRTC) || defined(GDEXTENSION_WEBRTC_40) godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override; +#else + godot::Ref _create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override; +#endif godot::Error _create_offer() override; godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) override; godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) override; diff --git a/src/init_gdextension.cpp b/src/init_gdextension.cpp index 85aed1d..47f8177 100644 --- a/src/init_gdextension.cpp +++ b/src/init_gdextension.cpp @@ -66,7 +66,11 @@ void unregister_webrtc_extension_types(ModuleInitializationLevel p_level) { } extern "C" { +#ifdef GDEXTENSION_WEBRTC_40 GDExtensionBool GDE_EXPORT webrtc_extension_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { +#else +GDExtensionBool GDE_EXPORT webrtc_extension_init(const GDExtensionInterfaceGetProcAddress p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { +#endif GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); init_obj.register_initializer(register_webrtc_extension_types); -- cgit v1.2.3