Difference between revisions of "GstWebRTC - API Reference"

From RidgeRun Developer Connection
Jump to: navigation, search
Line 4: Line 4:
  
 
==Classes, Structs and Enums==
 
==Classes, Structs and Enums==
 +
This section describes the enumerator and classes involved in the custom signaler creation.
 +
<br>
 
===GstBaseSignaler Class===
 
===GstBaseSignaler Class===
  
Line 16: Line 18:
  
 
;gboolean peer_connected
 
;gboolean peer_connected
:True if peer is connected
+
:True if peer is currently connected
  
 
;[https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstSDPMessage.html GstSDPMessage] *peer_sdp
 
;[https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstSDPMessage.html GstSDPMessage] *peer_sdp
:Instance of GstSDPMessage class
+
:Remote SDP negotiated by peer
  
 
;[[GstWebRTC_-_API_Reference#GstBaseSignalerSdpType|GstBaseSignalerSdpType]] type
 
;[[GstWebRTC_-_API_Reference#GstBaseSignalerSdpType|GstBaseSignalerSdpType]] type
:Type of SDP
+
:Whether we are sending an offer or answering a remote offer. In other words, whether we are starting the call or not.
 
<br>
 
<br>
 
----
 
----
 
===GstBaseSignalerSdpType===
 
===GstBaseSignalerSdpType===
* GST_BASE_SIGNALER_SDP_OFFER
+
;GST_BASE_SIGNALER_SDP_OFFER
<br>
+
:The SDP is an offer
* GST_BASE_SIGNALER_SDP_ANSWER
+
;GST_BASE_SIGNALER_SDP_ANSWER
<br>
+
:The SDP is an answer
* GST_BASE_SIGNALER_SDP_UNKNOWN
+
;GST_BASE_SIGNALER_SDP_UNKNOWN
<br>
+
:The SDP is unknown, typically an error
 +
 
 
==Virtual Functions==
 
==Virtual Functions==
 
The subclass must implement the following functions, these functions are called by the base class.
 
The subclass must implement the following functions, these functions are called by the base class.
 +
 
===Connect===
 
===Connect===
 
<pre>
 
<pre>
 
gboolean  (*connect) (GstBaseSignaler *self)
 
gboolean  (*connect) (GstBaseSignaler *self)
 
</pre>
 
</pre>
Connect to signaling from subclasses.
+
The concrete signaler should connect to the signaling mechanism.
 
<br>
 
<br>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
:True if connection was successful.
+
:True if connection was successful
 +
 
 
----
 
----
 +
 
===Disconnect===
 
===Disconnect===
Disconnect from signaling.
+
The concrete signaler should disconnect to the signaling mechanism.
 
<pre>
 
<pre>
 
gboolean  (*disconnect) (GstBaseSignaler *self)
 
gboolean  (*disconnect) (GstBaseSignaler *self)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
 
:True if disconnection was successful.
 
:True if disconnection was successful.
 +
 
----
 
----
 +
 
===Send SDP===
 
===Send SDP===
Send sdp to the signaling.
+
The concrete signaler should send the given SDP to the peer via its signaling mechanism.
 
<pre>
 
<pre>
 
gboolean  (*send_sdp) (GstBaseSignaler *self, GstSDPMessage *sdp, GstBaseSignalerSdpType type)
 
gboolean  (*send_sdp) (GstBaseSignaler *self, GstSDPMessage *sdp, GstBaseSignalerSdpType type)
Line 62: Line 70:
  
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
:''sdp:'' The GstSDPMessage helper class instance.
+
:''sdp:'' The SDP that should be sent.
:''type:''
+
:''type:'' Whether the SDP is an OFFER or an ANSWER
 
;Returns
 
;Returns
:True if spd sent succesfully was successful.
+
:True if the SDP was succesfully sent.
 +
 
 
----
 
----
 +
 
===Send Candidates===
 
===Send Candidates===
Send candidates to the signaling.
+
The concrete signaler should send the given candidates to the peer via its signaling mechanism. The candidates are given in a SDP form. This method can be called several times.
 
<pre>
 
<pre>
 
gboolean  (*send_candidates) (GstBaseSignaler *self, GstSDPMessage *candidates)
 
gboolean  (*send_candidates) (GstBaseSignaler *self, GstSDPMessage *candidates)
Line 75: Line 85:
  
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
:''candidates:''
+
:''candidates:'' The candidates to be sent.
 
;Returns
 
;Returns
:True if sent candidates succesfully was successful.
+
:True if sent candidates successfully was successful.
 +
 
 
----
 
----
  
 
==Signals==
 
==Signals==
The following signals must be emitted by the subclass:<br>
+
The following signals must be emitted by the subclass using the [https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-emit-by-name g_signal_emit_by_name]:
 +
 
 
===Signaling bound===
 
===Signaling bound===
 +
The concrete signaler should emit the "signaling-bound" when the local peer connects to the signaling mechanism.
 
<pre>
 
<pre>
 
void (*signaling_bound) (GstBaseSignaler *self)
 
void (*signaling_bound) (GstBaseSignaler *self)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
 
:Nothing
 
:Nothing
 +
 
----
 
----
 +
 
===Peer Connected===
 
===Peer Connected===
 +
The concrete signaler should emit the "peer-connected" when the remote peer connects to the signaling mechanism.
 
<pre>
 
<pre>
 
void (*peer_connected) (GstBaseSignaler *self)
 
void (*peer_connected) (GstBaseSignaler *self)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
 
:Nothing
 
:Nothing
 +
 
----
 
----
 +
 
===Peer Disconnected===
 
===Peer Disconnected===
 +
The concrete signaler should emit the "peer-disconnected" when the local peer disconnects from the signaling mechanism.
 
<pre>
 
<pre>
 
void (*peer_disconnected) (GstBaseSignaler *self)
 
void (*peer_disconnected) (GstBaseSignaler *self)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
 
:Nothing
 
:Nothing
 +
 
----
 
----
 +
 
===Peer SDP===
 
===Peer SDP===
 +
The concrete signaler should emit the "peer-SDP" when the peer SDP has been sent via the signaling mechanism.
 
<pre>
 
<pre>
 
void (*peer_sdp) (GstBaseSignaler *self, GstBaseSignalerSdpType * type, GstSDPMessage * sdp)
 
void (*peer_sdp) (GstBaseSignaler *self, GstBaseSignalerSdpType * type, GstSDPMessage * sdp)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
:''type:''
 
:''type:''
 
:''sdp:''
 
:''sdp:''
 
;Returns
 
;Returns
 
:Nothing
 
:Nothing
 +
 
----
 
----
 +
 
===Peer Candidate===
 
===Peer Candidate===
 +
The concrete signaler should emit the "peer-candidate" when the peer candidate has been sent via the signaling mechanism.
 
<pre>
 
<pre>
 
void (*peer_candidate) (GstBaseSignaler *self, gint sdp_index, gchar * sdp)
 
void (*peer_candidate) (GstBaseSignaler *self, gint sdp_index, gchar * sdp)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
:''sdp_index''
 
:''sdp_index''
 
:''sdp:''
 
:''sdp:''
Line 133: Line 158:
 
----
 
----
 
===Signaling Error===
 
===Signaling Error===
 +
The concrete signaler should emit the "signaling-error" when there is an unrecoverable signaling error. The internal state machine will terminate the pipeline. The concrete signaler should fill the GError respectively.
 
<pre>
 
<pre>
void (*signaling_error) (GstBaseSignaler *self)
+
void (*signaling_error) (GstBaseSignaler *self, GError *error)
 
</pre>
 
</pre>
 
;Parameters
 
;Parameters
:''self:'' The base class
+
:''self:'' The concrete signaler
 
;Returns
 
;Returns
 
:Nothing
 
:Nothing
 
}}
 
}}

Revision as of 15:39, 20 September 2017


Custom Signalers


Home

Plugin Elements



Classes, Structs and Enums

This section describes the enumerator and classes involved in the custom signaler creation.

GstBaseSignaler Class

Base class for custom signalers.

Members

guint id
The ID of the local endpoint
gchar *peer_id
The ID of the remote endpoint
gboolean peer_connected
True if peer is currently connected
GstSDPMessage *peer_sdp
Remote SDP negotiated by peer
GstBaseSignalerSdpType type
Whether we are sending an offer or answering a remote offer. In other words, whether we are starting the call or not.



GstBaseSignalerSdpType

GST_BASE_SIGNALER_SDP_OFFER
The SDP is an offer
GST_BASE_SIGNALER_SDP_ANSWER
The SDP is an answer
GST_BASE_SIGNALER_SDP_UNKNOWN
The SDP is unknown, typically an error

Virtual Functions

The subclass must implement the following functions, these functions are called by the base class.

Connect

gboolean  (*connect) (GstBaseSignaler *self)

The concrete signaler should connect to the signaling mechanism.

Parameters
self: The concrete signaler
Returns
True if connection was successful

Disconnect

The concrete signaler should disconnect to the signaling mechanism.

gboolean  (*disconnect) (GstBaseSignaler *self)
Parameters
self: The concrete signaler
Returns
True if disconnection was successful.

Send SDP

The concrete signaler should send the given SDP to the peer via its signaling mechanism.

gboolean  (*send_sdp) (GstBaseSignaler *self, GstSDPMessage *sdp, GstBaseSignalerSdpType type)
Parameters
self: The concrete signaler
sdp: The SDP that should be sent.
type: Whether the SDP is an OFFER or an ANSWER
Returns
True if the SDP was succesfully sent.

Send Candidates

The concrete signaler should send the given candidates to the peer via its signaling mechanism. The candidates are given in a SDP form. This method can be called several times.

gboolean  (*send_candidates) (GstBaseSignaler *self, GstSDPMessage *candidates)
Parameters
self: The concrete signaler
candidates: The candidates to be sent.
Returns
True if sent candidates successfully was successful.

Signals

The following signals must be emitted by the subclass using the g_signal_emit_by_name:

Signaling bound

The concrete signaler should emit the "signaling-bound" when the local peer connects to the signaling mechanism.

void (*signaling_bound) (GstBaseSignaler *self)
Parameters
self: The concrete signaler
Returns
Nothing

Peer Connected

The concrete signaler should emit the "peer-connected" when the remote peer connects to the signaling mechanism.

void (*peer_connected) (GstBaseSignaler *self)
Parameters
self: The concrete signaler
Returns
Nothing

Peer Disconnected

The concrete signaler should emit the "peer-disconnected" when the local peer disconnects from the signaling mechanism.

void (*peer_disconnected) (GstBaseSignaler *self)
Parameters
self: The concrete signaler
Returns
Nothing

Peer SDP

The concrete signaler should emit the "peer-SDP" when the peer SDP has been sent via the signaling mechanism.

void (*peer_sdp) (GstBaseSignaler *self, GstBaseSignalerSdpType * type, GstSDPMessage * sdp)
Parameters
self: The concrete signaler
type:
sdp:
Returns
Nothing

Peer Candidate

The concrete signaler should emit the "peer-candidate" when the peer candidate has been sent via the signaling mechanism.

void (*peer_candidate) (GstBaseSignaler *self, gint sdp_index, gchar * sdp)
Parameters
self: The concrete signaler
sdp_index
sdp:
Returns
Nothing

Signaling Error

The concrete signaler should emit the "signaling-error" when there is an unrecoverable signaling error. The internal state machine will terminate the pipeline. The concrete signaler should fill the GError respectively.

void (*signaling_error) (GstBaseSignaler *self, GError *error)
Parameters
self: The concrete signaler
Returns
Nothing


Custom Signalers


Home

Plugin Elements