webrtc: Fix documentaton moving symbols in the right pages
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / gst-libs / gst / webrtc / rtpsender.c
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-sender
22  * @short_description: RTCRtpSender object
23  * @title: GstWebRTCRTPSender
24  * @see_also: #GstWebRTCRTPReceiver, #GstWebRTCRTPTransceiver
25  * @symbols:
26  * - GstWebRTCRTPSender
27  *
28  * <https://www.w3.org/TR/webrtc/#rtcrtpsender-interface>
29  */
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include "rtpsender.h"
36 #include "rtptransceiver.h"
37 #include "webrtc-priv.h"
38
39 #define GST_CAT_DEFAULT gst_webrtc_rtp_sender_debug
40 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
41
42 #define gst_webrtc_rtp_sender_parent_class parent_class
43 G_DEFINE_TYPE_WITH_CODE (GstWebRTCRTPSender, gst_webrtc_rtp_sender,
44     GST_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (gst_webrtc_rtp_sender_debug,
45         "webrtcsender", 0, "webrtcsender");
46     );
47
48 enum
49 {
50   SIGNAL_0,
51   LAST_SIGNAL,
52 };
53
54 enum
55 {
56   PROP_0,
57   PROP_PRIORITY,
58   PROP_TRANSPORT,
59 };
60
61 //static guint gst_webrtc_rtp_sender_signals[LAST_SIGNAL] = { 0 };
62
63 /**
64  * gst_webrtc_rtp_sender_set_priority:
65  * @sender: a #GstWebRTCRTPSender
66  * @priority: The priority of this sender
67  *
68  * Sets the content of the IPv4 Type of Service (ToS), also known as DSCP
69  * (Differentiated Services Code Point).
70  * This also sets the Traffic Class field of IPv6.
71  *
72  * Since: 1.20
73  */
74
75 void
76 gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender * sender,
77     GstWebRTCPriorityType priority)
78 {
79   GST_OBJECT_LOCK (sender);
80   sender->priority = priority;
81   GST_OBJECT_UNLOCK (sender);
82   g_object_notify (G_OBJECT (sender), "priority");
83 }
84
85 static void
86 gst_webrtc_rtp_sender_set_property (GObject * object, guint prop_id,
87     const GValue * value, GParamSpec * pspec)
88 {
89   GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
90
91   switch (prop_id) {
92     case PROP_PRIORITY:
93       gst_webrtc_rtp_sender_set_priority (sender, g_value_get_uint (value));
94       break;
95     default:
96       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
97       break;
98   }
99 }
100
101 static void
102 gst_webrtc_rtp_sender_get_property (GObject * object, guint prop_id,
103     GValue * value, GParamSpec * pspec)
104 {
105   GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
106
107   switch (prop_id) {
108     case PROP_PRIORITY:
109       GST_OBJECT_LOCK (sender);
110       g_value_set_uint (value, sender->priority);
111       GST_OBJECT_UNLOCK (sender);
112       break;
113     case PROP_TRANSPORT:
114       GST_OBJECT_LOCK (sender);
115       g_value_set_object (value, sender->transport);
116       GST_OBJECT_UNLOCK (sender);
117       break;
118     default:
119       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
120       break;
121   }
122 }
123
124 static void
125 gst_webrtc_rtp_sender_finalize (GObject * object)
126 {
127   GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
128
129   if (sender->transport)
130     gst_object_unref (sender->transport);
131   sender->transport = NULL;
132
133   G_OBJECT_CLASS (parent_class)->finalize (object);
134 }
135
136 static void
137 gst_webrtc_rtp_sender_class_init (GstWebRTCRTPSenderClass * klass)
138 {
139   GObjectClass *gobject_class = (GObjectClass *) klass;
140
141   gobject_class->get_property = gst_webrtc_rtp_sender_get_property;
142   gobject_class->set_property = gst_webrtc_rtp_sender_set_property;
143   gobject_class->finalize = gst_webrtc_rtp_sender_finalize;
144
145   /**
146    * GstWebRTCRTPSender:priority:
147    *
148    * The priority from which to set the DSCP field on packets
149    *
150    * Since: 1.20
151    */
152   g_object_class_install_property (gobject_class,
153       PROP_PRIORITY,
154       g_param_spec_enum ("priority",
155           "Priority",
156           "The priority from which to set the DSCP field on packets",
157           GST_TYPE_WEBRTC_PRIORITY_TYPE, GST_WEBRTC_PRIORITY_TYPE_LOW,
158           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
159
160   /**
161    * GstWebRTCRTPSender:transport:
162    *
163    * The DTLS transport for this sender
164    *
165    * Since: 1.20
166    */
167   g_object_class_install_property (gobject_class,
168       PROP_TRANSPORT,
169       g_param_spec_object ("transport", "Transport",
170           "The DTLS transport for this sender",
171           GST_TYPE_WEBRTC_DTLS_TRANSPORT,
172           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
173 }
174
175 static void
176 gst_webrtc_rtp_sender_init (GstWebRTCRTPSender * webrtc)
177 {
178 }
179
180 GstWebRTCRTPSender *
181 gst_webrtc_rtp_sender_new (void)
182 {
183   return g_object_new (GST_TYPE_WEBRTC_RTP_SENDER, NULL);
184 }