summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2019-03-12 21:37:53 +0100
committerMathieu Duponchelle <mduponchelle1@gmail.com>2019-03-12 21:04:48 +0000
commit08858d753c0afb3e9c437f2e139a392b103ffe90 (patch)
treeaeb5350198875835f8b9335902b10f35a9b6ea49
parentdc0e95acabce149b315b94001ef8e7a0860ef8b4 (diff)
downloadgstreamer-plugins-bad-08858d753c0afb3e9c437f2e139a392b103ffe90.tar.gz
webrtcbin: add get-transceiver signal
get-transceivers is not introspectable, and a method to get a transceiver by index is convenient.
-rw-r--r--ext/webrtc/gstwebrtcbin.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c
index 29294cfcc..76c99edf0 100644
--- a/ext/webrtc/gstwebrtcbin.c
+++ b/ext/webrtc/gstwebrtcbin.c
@@ -273,7 +273,8 @@ gst_webrtc_bin_pad_new (const gchar * name, GstPadDirection direction)
G_DEFINE_TYPE_WITH_CODE (GstWebRTCBin, gst_webrtc_bin, GST_TYPE_BIN,
G_ADD_PRIVATE (GstWebRTCBin)
GST_DEBUG_CATEGORY_INIT (gst_webrtc_bin_debug, "webrtcbin", 0,
- "webrtcbin element"););
+ "webrtcbin element");
+ );
static GstPad *_connect_input_stream (GstWebRTCBin * webrtc,
GstWebRTCBinPad * pad);
@@ -301,6 +302,7 @@ enum
ON_NEW_TRANSCEIVER_SIGNAL,
GET_STATS_SIGNAL,
ADD_TRANSCEIVER_SIGNAL,
+ GET_TRANSCEIVER_SIGNAL,
GET_TRANSCEIVERS_SIGNAL,
ADD_TURN_SERVER_SIGNAL,
CREATE_DATA_CHANNEL_SIGNAL,
@@ -4009,6 +4011,25 @@ gst_webrtc_bin_get_transceivers (GstWebRTCBin * webrtc)
return arr;
}
+static GstWebRTCRTPTransceiver *
+gst_webrtc_bin_get_transceiver (GstWebRTCBin * webrtc, guint idx)
+{
+ GstWebRTCRTPTransceiver *trans = NULL;
+
+ if (idx >= webrtc->priv->transceivers->len) {
+ GST_ERROR_OBJECT (webrtc, "No transceiver for idx %d", idx);
+ goto done;
+ }
+
+ trans =
+ g_array_index (webrtc->priv->transceivers, GstWebRTCRTPTransceiver *,
+ idx);
+ gst_object_ref (trans);
+
+done:
+ return trans;
+}
+
static gboolean
gst_webrtc_bin_add_turn_server (GstWebRTCBin * webrtc, const gchar * uri)
{
@@ -5195,6 +5216,21 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
g_cclosure_marshal_generic, G_TYPE_ARRAY, 0);
/**
+ * GstWebRTCBin::get-transceiver:
+ * @object: the #GstWebRtcBin
+ * @idx: The index of the transceiver
+ *
+ * Returns: the #GstWebRTCRTPTransceiver, or %NULL
+ * Since: 1.16
+ */
+ gst_webrtc_bin_signals[GET_TRANSCEIVER_SIGNAL] =
+ g_signal_new_class_handler ("get-transceiver", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_CALLBACK (gst_webrtc_bin_get_transceiver), NULL, NULL,
+ g_cclosure_marshal_generic, GST_TYPE_WEBRTC_RTP_TRANSCEIVER, 1,
+ G_TYPE_INT);
+
+ /**
* GstWebRTCBin::add-turn-server:
* @object: the #GstWebRtcBin
* @uri: The uri of the server of the form turn(s)://username:password@host:port