mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-22 00:48:09 +01:00
Made WebrctPeerConnection instantiable by it's own.
This commit is contained in:
parent
ae9f5b9bee
commit
ca1d12b6b6
@ -49,6 +49,8 @@ void register_webrtc_types() {
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
WebRTCPeerConnectionJS::make_default();
|
||||
#else
|
||||
WebRTCPeerConnection::make_default();
|
||||
#endif
|
||||
|
||||
ClassDB::register_custom_instance_class<WebRTCPeerConnection>();
|
||||
|
@ -43,6 +43,38 @@ WebRTCPeerConnection *WebRTCPeerConnection::create() {
|
||||
return _create();
|
||||
}
|
||||
|
||||
WebRTCPeerConnection *WebRTCPeerConnection::_create_func() {
|
||||
return memnew(WebRTCPeerConnection);
|
||||
}
|
||||
|
||||
WebRTCPeerConnection::ConnectionState WebRTCPeerConnection::get_connection_state() const {
|
||||
return WebRTCPeerConnection::STATE_FAILED;
|
||||
}
|
||||
Error WebRTCPeerConnection::initialize(Dictionary p_config) {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
Ref<WebRTCDataChannel> WebRTCPeerConnection::create_data_channel(String p_label, Dictionary p_options) {
|
||||
ERR_FAIL_V(Ref<WebRTCDataChannel>());
|
||||
}
|
||||
Error WebRTCPeerConnection::create_offer() {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
Error WebRTCPeerConnection::set_remote_description(String type, String sdp) {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
Error WebRTCPeerConnection::set_local_description(String type, String sdp) {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
Error WebRTCPeerConnection::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
Error WebRTCPeerConnection::poll() {
|
||||
ERR_FAIL_V(ERR_UNAVAILABLE);
|
||||
}
|
||||
void WebRTCPeerConnection::close() {
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
void WebRTCPeerConnection::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("initialize", "configuration"), &WebRTCPeerConnection::initialize, DEFVAL(Dictionary()));
|
||||
ClassDB::bind_method(D_METHOD("create_data_channel", "label", "options"), &WebRTCPeerConnection::create_data_channel, DEFVAL(Dictionary()));
|
||||
|
@ -50,17 +50,21 @@ protected:
|
||||
static void _bind_methods();
|
||||
static WebRTCPeerConnection *(*_create)();
|
||||
|
||||
public:
|
||||
virtual ConnectionState get_connection_state() const = 0;
|
||||
static WebRTCPeerConnection *_create_func();
|
||||
|
||||
virtual Error initialize(Dictionary p_config = Dictionary()) = 0;
|
||||
virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary()) = 0;
|
||||
virtual Error create_offer() = 0;
|
||||
virtual Error set_remote_description(String type, String sdp) = 0;
|
||||
virtual Error set_local_description(String type, String sdp) = 0;
|
||||
virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) = 0;
|
||||
virtual Error poll() = 0;
|
||||
virtual void close() = 0;
|
||||
public:
|
||||
static void make_default() { WebRTCPeerConnection::_create = WebRTCPeerConnection::_create_func; }
|
||||
|
||||
virtual ConnectionState get_connection_state() const;
|
||||
|
||||
virtual Error initialize(Dictionary p_config = Dictionary());
|
||||
virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary());
|
||||
virtual Error create_offer();
|
||||
virtual Error set_remote_description(String type, String sdp);
|
||||
virtual Error set_local_description(String type, String sdp);
|
||||
virtual Error add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName);
|
||||
virtual Error poll();
|
||||
virtual void close();
|
||||
|
||||
static Ref<WebRTCPeerConnection> create_ref();
|
||||
static WebRTCPeerConnection *create();
|
||||
|
Loading…
Reference in New Issue
Block a user