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-sessiondescription
22 * @short_description: RTCSessionDescription object
23 * @title: GstWebRTCSessionDescription
25 * <https://www.w3.org/TR/webrtc/#rtcsessiondescription-class>
32 #include "rtcsessiondescription.h"
34 #define GST_CAT_DEFAULT gst_webrtc_peerconnection_debug
35 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
38 * gst_webrtc_sdp_type_to_string:
39 * @type: a #GstWebRTCSDPType
41 * Returns: the string representation of @type or "unknown" when @type is not
45 gst_webrtc_sdp_type_to_string (GstWebRTCSDPType type)
48 case GST_WEBRTC_SDP_TYPE_OFFER:
50 case GST_WEBRTC_SDP_TYPE_PRANSWER:
52 case GST_WEBRTC_SDP_TYPE_ANSWER:
54 case GST_WEBRTC_SDP_TYPE_ROLLBACK:
62 * gst_webrtc_session_description_copy:
63 * @src: (transfer none): a #GstWebRTCSessionDescription
65 * Returns: (transfer full): a new copy of @src
67 GstWebRTCSessionDescription *
68 gst_webrtc_session_description_copy (const GstWebRTCSessionDescription * src)
70 GstWebRTCSessionDescription *ret;
75 ret = g_new0 (GstWebRTCSessionDescription, 1);
77 ret->type = src->type;
78 gst_sdp_message_copy (src->sdp, &ret->sdp);
84 * gst_webrtc_session_description_free:
85 * @desc: (transfer full): a #GstWebRTCSessionDescription
87 * Free @desc and all associated resources
90 gst_webrtc_session_description_free (GstWebRTCSessionDescription * desc)
92 g_return_if_fail (desc != NULL);
94 gst_sdp_message_free (desc->sdp);
99 * gst_webrtc_session_description_new:
100 * @type: a #GstWebRTCSDPType
101 * @sdp: (transfer full): a #GstSDPMessage
103 * Returns: (transfer full): a new #GstWebRTCSessionDescription from @type
106 GstWebRTCSessionDescription *
107 gst_webrtc_session_description_new (GstWebRTCSDPType type, GstSDPMessage * sdp)
109 GstWebRTCSessionDescription *ret;
111 ret = g_new0 (GstWebRTCSessionDescription, 1);
119 G_DEFINE_BOXED_TYPE_WITH_CODE (GstWebRTCSessionDescription,
120 gst_webrtc_session_description, gst_webrtc_session_description_copy,
121 gst_webrtc_session_description_free,
122 GST_DEBUG_CATEGORY_INIT (gst_webrtc_peerconnection_debug,
123 "webrtcsessiondescription", 0, "webrtcsessiondescription"));