• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19 
20 /**
21  * SECTION:gstwebrtc-receiver
22  * @short_description: RTCRtpReceiver object
23  * @title: GstWebRTCRTPReceiver
24  * @see_also: #GstWebRTCRTPSender, #GstWebRTCRTPTransceiver
25  *
26  * <https://www.w3.org/TR/webrtc/#rtcrtpreceiver-interface>
27  */
28 
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32 
33 #include "rtpreceiver.h"
34 #include "webrtc-priv.h"
35 
36 #define GST_CAT_DEFAULT gst_webrtc_rtp_receiver_debug
37 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
38 
39 #define gst_webrtc_rtp_receiver_parent_class parent_class
40 G_DEFINE_TYPE_WITH_CODE (GstWebRTCRTPReceiver, gst_webrtc_rtp_receiver,
41     GST_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (gst_webrtc_rtp_receiver_debug,
42         "webrtcreceiver", 0, "webrtcreceiver"););
43 
44 enum
45 {
46   SIGNAL_0,
47   LAST_SIGNAL,
48 };
49 
50 enum
51 {
52   PROP_0,
53   PROP_TRANSPORT,
54 };
55 
56 //static guint gst_webrtc_rtp_receiver_signals[LAST_SIGNAL] = { 0 };
57 
58 static void
gst_webrtc_rtp_receiver_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)59 gst_webrtc_rtp_receiver_set_property (GObject * object, guint prop_id,
60     const GValue * value, GParamSpec * pspec)
61 {
62   switch (prop_id) {
63     default:
64       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
65       break;
66   }
67 }
68 
69 static void
gst_webrtc_rtp_receiver_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec)70 gst_webrtc_rtp_receiver_get_property (GObject * object, guint prop_id,
71     GValue * value, GParamSpec * pspec)
72 {
73   GstWebRTCRTPReceiver *receiver = GST_WEBRTC_RTP_RECEIVER (object);
74   switch (prop_id) {
75     case PROP_TRANSPORT:
76       GST_OBJECT_LOCK (receiver);
77       g_value_set_object (value, receiver->transport);
78       GST_OBJECT_UNLOCK (receiver);
79       break;
80     default:
81       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
82       break;
83   }
84 }
85 
86 static void
gst_webrtc_rtp_receiver_finalize(GObject * object)87 gst_webrtc_rtp_receiver_finalize (GObject * object)
88 {
89   GstWebRTCRTPReceiver *webrtc = GST_WEBRTC_RTP_RECEIVER (object);
90 
91   if (webrtc->transport)
92     gst_object_unref (webrtc->transport);
93   webrtc->transport = NULL;
94 
95   G_OBJECT_CLASS (parent_class)->finalize (object);
96 }
97 
98 static void
gst_webrtc_rtp_receiver_class_init(GstWebRTCRTPReceiverClass * klass)99 gst_webrtc_rtp_receiver_class_init (GstWebRTCRTPReceiverClass * klass)
100 {
101   GObjectClass *gobject_class = (GObjectClass *) klass;
102 
103   gobject_class->get_property = gst_webrtc_rtp_receiver_get_property;
104   gobject_class->set_property = gst_webrtc_rtp_receiver_set_property;
105   gobject_class->finalize = gst_webrtc_rtp_receiver_finalize;
106 
107   /**
108    * GstWebRTCRTPReceiver:transport:
109    *
110    * The DTLS transport for this receiver
111    *
112    * Since: 1.20
113    */
114   g_object_class_install_property (gobject_class,
115       PROP_TRANSPORT,
116       g_param_spec_object ("transport", "Transport",
117           "The DTLS transport for this receiver",
118           GST_TYPE_WEBRTC_DTLS_TRANSPORT,
119           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
120 }
121 
122 static void
gst_webrtc_rtp_receiver_init(GstWebRTCRTPReceiver * webrtc)123 gst_webrtc_rtp_receiver_init (GstWebRTCRTPReceiver * webrtc)
124 {
125 }
126 
127 GstWebRTCRTPReceiver *
gst_webrtc_rtp_receiver_new(void)128 gst_webrtc_rtp_receiver_new (void)
129 {
130   return g_object_new (GST_TYPE_WEBRTC_RTP_RECEIVER, NULL);
131 }
132