2 * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 * SECTION:gstwebrtc-transceiver
22 * @short_description: RTCRtpTransceiver object
23 * @title: GstWebRTCRTPTransceiver
24 * @see_also: #GstWebRTCRTPSender, #GstWebRTCRTPReceiver
26 * <ulink url="https://www.w3.org/TR/webrtc/#rtcrtptransceiver-interface">https://www.w3.org/TR/webrtc/#rtcrtptransceiver-interface</ulink>
33 #include "rtptransceiver.h"
35 #define GST_CAT_DEFAULT gst_webrtc_rtp_transceiver_debug
36 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
38 #define gst_webrtc_rtp_transceiver_parent_class parent_class
39 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstWebRTCRTPTransceiver,
40 gst_webrtc_rtp_transceiver, GST_TYPE_OBJECT,
41 GST_DEBUG_CATEGORY_INIT (gst_webrtc_rtp_transceiver_debug,
42 "webrtctransceiver", 0, "webrtctransceiver");
57 PROP_STOPPED, // FIXME
58 PROP_DIRECTION, // FIXME
62 //static guint gst_webrtc_rtp_transceiver_signals[LAST_SIGNAL] = { 0 };
65 gst_webrtc_rtp_transceiver_set_property (GObject * object, guint prop_id,
66 const GValue * value, GParamSpec * pspec)
68 GstWebRTCRTPTransceiver *webrtc = GST_WEBRTC_RTP_TRANSCEIVER (object);
72 webrtc->sender = g_value_dup_object (value);
75 webrtc->receiver = g_value_dup_object (value);
78 webrtc->mline = g_value_get_uint (value);
81 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
87 gst_webrtc_rtp_transceiver_get_property (GObject * object, guint prop_id,
88 GValue * value, GParamSpec * pspec)
90 GstWebRTCRTPTransceiver *webrtc = GST_WEBRTC_RTP_TRANSCEIVER (object);
94 g_value_set_object (value, webrtc->sender);
97 g_value_set_object (value, webrtc->receiver);
100 g_value_set_uint (value, webrtc->mline);
103 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
109 gst_webrtc_rtp_transceiver_constructed (GObject * object)
111 GstWebRTCRTPTransceiver *webrtc = GST_WEBRTC_RTP_TRANSCEIVER (object);
113 gst_object_set_parent (GST_OBJECT (webrtc->sender), GST_OBJECT (webrtc));
114 gst_object_set_parent (GST_OBJECT (webrtc->receiver), GST_OBJECT (webrtc));
116 G_OBJECT_CLASS (parent_class)->constructed (object);
120 gst_webrtc_rtp_transceiver_dispose (GObject * object)
122 GstWebRTCRTPTransceiver *webrtc = GST_WEBRTC_RTP_TRANSCEIVER (object);
124 if (webrtc->sender) {
125 GST_OBJECT_PARENT (webrtc->sender) = NULL;
126 gst_object_unref (webrtc->sender);
128 webrtc->sender = NULL;
129 if (webrtc->receiver) {
130 GST_OBJECT_PARENT (webrtc->receiver) = NULL;
131 gst_object_unref (webrtc->receiver);
133 webrtc->receiver = NULL;
135 G_OBJECT_CLASS (parent_class)->dispose (object);
139 gst_webrtc_rtp_transceiver_finalize (GObject * object)
141 GstWebRTCRTPTransceiver *webrtc = GST_WEBRTC_RTP_TRANSCEIVER (object);
143 g_free (webrtc->mid);
144 if (webrtc->codec_preferences)
145 gst_caps_unref (webrtc->codec_preferences);
147 G_OBJECT_CLASS (parent_class)->finalize (object);
151 gst_webrtc_rtp_transceiver_class_init (GstWebRTCRTPTransceiverClass * klass)
153 GObjectClass *gobject_class = (GObjectClass *) klass;
155 gobject_class->get_property = gst_webrtc_rtp_transceiver_get_property;
156 gobject_class->set_property = gst_webrtc_rtp_transceiver_set_property;
157 gobject_class->constructed = gst_webrtc_rtp_transceiver_constructed;
158 gobject_class->dispose = gst_webrtc_rtp_transceiver_dispose;
159 gobject_class->finalize = gst_webrtc_rtp_transceiver_finalize;
161 g_object_class_install_property (gobject_class,
163 g_param_spec_object ("sender", "Sender",
164 "The RTP sender for this transceiver",
165 GST_TYPE_WEBRTC_RTP_SENDER,
166 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
168 g_object_class_install_property (gobject_class,
170 g_param_spec_object ("receiver", "Receiver",
171 "The RTP receiver for this transceiver",
172 GST_TYPE_WEBRTC_RTP_RECEIVER,
173 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
175 g_object_class_install_property (gobject_class,
177 g_param_spec_uint ("mlineindex", "Media Line Index",
178 "Index in the SDP of the Media",
180 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
184 gst_webrtc_rtp_transceiver_init (GstWebRTCRTPTransceiver * webrtc)