webrtcdatachannel: Emit 'on-close' signal when calling 'close' action signal
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / ext / webrtc / webrtcdatachannel.h
1 /* GStreamer
2  * Copyright (C) 2018 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 #ifndef __WEBRTC_DATA_CHANNEL_H__
21 #define __WEBRTC_DATA_CHANNEL_H__
22
23 #include <gst/gst.h>
24 #include <gst/webrtc/webrtc_fwd.h>
25 #include <gst/webrtc/dtlstransport.h>
26 #include <gst/webrtc/datachannel.h>
27 #include "webrtcsctptransport.h"
28
29 #include "gst/webrtc/webrtc-priv.h"
30
31 G_BEGIN_DECLS
32
33 GType webrtc_data_channel_get_type(void);
34 #define WEBRTC_TYPE_DATA_CHANNEL            (webrtc_data_channel_get_type())
35 #define WEBRTC_DATA_CHANNEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),WEBRTC_TYPE_DATA_CHANNEL,WebRTCDataChannel))
36 #define WEBRTC_IS_DATA_CHANNEL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),WEBRTC_TYPE_DATA_CHANNEL))
37 #define WEBRTC_DATA_CHANNEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,WEBRTC_TYPE_DATA_CHANNEL,WebRTCDataChannelClass))
38 #define WEBRTC_IS_DATA_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,WEBRTC_TYPE_DATA_CHANNEL))
39 #define WEBRTC_DATA_CHANNEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,WEBRTC_TYPE_DATA_CHANNEL,WebRTCDataChannelClass))
40
41 typedef struct _WebRTCDataChannel WebRTCDataChannel;
42 typedef struct _WebRTCDataChannelClass WebRTCDataChannelClass;
43
44 struct _WebRTCDataChannel
45 {
46   GstWebRTCDataChannel              parent;
47
48   WebRTCSCTPTransport              *sctp_transport;
49   GstElement                       *appsrc;
50   GstElement                       *appsink;
51
52   GstWebRTCBin                     *webrtcbin;
53   gboolean                          opened;
54   gulong                            src_probe;
55   GError                           *stored_error;
56 #ifndef TIZEN_FEATURE_WEBRTC_MODIFICATION
57   gboolean                          peer_closed;
58 #endif
59
60   gpointer                          _padding[GST_PADDING];
61 };
62
63 struct _WebRTCDataChannelClass
64 {
65   GstWebRTCDataChannelClass  parent_class;
66
67   gpointer                  _padding[GST_PADDING];
68 };
69
70 void    webrtc_data_channel_start_negotiation   (WebRTCDataChannel       *channel);
71 G_GNUC_INTERNAL
72 void    webrtc_data_channel_link_to_sctp (WebRTCDataChannel                 *channel,
73                                           WebRTCSCTPTransport               *sctp_transport);
74
75 G_END_DECLS
76
77 #endif /* __WEBRTC_DATA_CHANNEL_H__ */