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.
20 #ifndef __GST_WEBRTC_BIN_H__
21 #define __GST_WEBRTC_BIN_H__
23 #include <gst/sdp/sdp.h>
25 #include "gstwebrtcice.h"
29 #define GST_WEBRTC_BIN_ERROR gst_webrtc_bin_error_quark ()
30 GQuark gst_webrtc_bin_error_quark (void);
34 GST_WEBRTC_BIN_ERROR_FAILED,
35 GST_WEBRTC_BIN_ERROR_INVALID_SYNTAX,
36 GST_WEBRTC_BIN_ERROR_INVALID_MODIFICATION,
37 GST_WEBRTC_BIN_ERROR_INVALID_STATE,
38 GST_WEBRTC_BIN_ERROR_BAD_SDP,
39 GST_WEBRTC_BIN_ERROR_FINGERPRINT,
40 } GstWebRTCJSEPSDPError;
42 GType gst_webrtc_bin_pad_get_type(void);
43 #define GST_TYPE_WEBRTC_BIN_PAD (gst_webrtc_bin_pad_get_type())
44 #define GST_WEBRTC_BIN_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_BIN_PAD,GstWebRTCBinPad))
45 #define GST_IS_WEBRTC_BIN_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_BIN_PAD))
46 #define GST_WEBRTC_BIN_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_BIN_PAD,GstWebRTCBinPadClass))
47 #define GST_IS_WEBRTC_BIN_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_BIN_PAD))
48 #define GST_WEBRTC_BIN_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_BIN_PAD,GstWebRTCBinPadClass))
50 typedef struct _GstWebRTCBinPad GstWebRTCBinPad;
51 typedef struct _GstWebRTCBinPadClass GstWebRTCBinPadClass;
53 struct _GstWebRTCBinPad
59 GstWebRTCRTPTransceiver *trans;
62 struct _GstWebRTCBinPadClass
64 GstGhostPadClass parent_class;
67 GType gst_webrtc_bin_get_type(void);
68 #define GST_TYPE_WEBRTC_BIN (gst_webrtc_bin_get_type())
69 #define GST_WEBRTC_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_BIN,GstWebRTCBin))
70 #define GST_IS_WEBRTC_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_BIN))
71 #define GST_WEBRTC_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_BIN,GstWebRTCBinClass))
72 #define GST_IS_WEBRTC_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_BIN))
73 #define GST_WEBRTC_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_BIN,GstWebRTCBinClass))
81 GstWebRTCSignalingState signaling_state;
82 GstWebRTCICEGatheringState ice_gathering_state;
83 GstWebRTCICEConnectionState ice_connection_state;
84 GstWebRTCPeerConnectionState peer_connection_state;
86 GstWebRTCSessionDescription *current_local_description;
87 GstWebRTCSessionDescription *pending_local_description;
88 GstWebRTCSessionDescription *current_remote_description;
89 GstWebRTCSessionDescription *pending_remote_description;
91 GstWebRTCBinPrivate *priv;
94 struct _GstWebRTCBinClass
96 GstBinClass parent_class;
99 struct _GstWebRTCBinPrivate
101 guint max_sink_pad_serial;
104 GArray *transceivers;
105 GArray *session_mid_map;
109 GArray *ice_stream_map;
110 GArray *pending_ice_candidates;
112 /* peerconnection variables */
114 gboolean need_negotiation;
115 gpointer sctp_transport; /* FIXME */
117 /* peerconnection helper thread for promises */
118 GMainContext *main_context;
125 gboolean async_pending;
129 /* count of the number of media streams we've offered for uniqueness */
130 /* FIXME: overflow? */
136 typedef void (*GstWebRTCBinFunc) (GstWebRTCBin * webrtc, gpointer data);
140 GstWebRTCBin *webrtc;
143 GDestroyNotify notify;
144 // GstPromise *promise; /* FIXME */
147 void gst_webrtc_bin_enqueue_task (GstWebRTCBin * pc,
148 GstWebRTCBinFunc func,
150 GDestroyNotify notify);
154 #endif /* __GST_WEBRTC_BIN_H__ */