1 /* |
|
2 * gabble-media-stream.h - Header for GabbleMediaStream |
|
3 * Copyright (C) 2006 Collabora Ltd. |
|
4 * Portions |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Lesser General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2.1 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Lesser General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public |
|
17 * License along with this library; if not, write to the Free Software |
|
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 */ |
|
20 |
|
21 #ifndef __GABBLE_MEDIA_STREAM_H__ |
|
22 #define __GABBLE_MEDIA_STREAM_H__ |
|
23 |
|
24 #include <glib-object.h> |
|
25 #include "loudmouth/loudmouth.h" |
|
26 |
|
27 #include "gabble-types.h" |
|
28 #include "telepathy-constants.h" |
|
29 |
|
30 G_BEGIN_DECLS |
|
31 |
|
32 typedef enum |
|
33 { |
|
34 STREAM_SIG_STATE_NEW, |
|
35 STREAM_SIG_STATE_SENT, |
|
36 STREAM_SIG_STATE_ACKNOWLEDGED, |
|
37 STREAM_SIG_STATE_REMOVING |
|
38 } StreamSignallingState; |
|
39 |
|
40 typedef guint32 CombinedStreamDirection; |
|
41 |
|
42 typedef struct _GabbleMediaStream GabbleMediaStream; |
|
43 typedef struct _GabbleMediaStreamClass GabbleMediaStreamClass; |
|
44 |
|
45 struct _GabbleMediaStreamClass { |
|
46 GObjectClass parent_class; |
|
47 }; |
|
48 |
|
49 struct _GabbleMediaStream { |
|
50 GObject parent; |
|
51 |
|
52 gchar *name; |
|
53 |
|
54 JingleInitiator initiator; |
|
55 TpMediaStreamState connection_state; |
|
56 StreamSignallingState signalling_state; |
|
57 |
|
58 CombinedStreamDirection combined_direction; |
|
59 gboolean got_local_codecs; |
|
60 gboolean playing; |
|
61 |
|
62 gpointer priv; |
|
63 }; |
|
64 |
|
65 IMPORT_C GType gabble_media_stream_get_type(void); |
|
66 |
|
67 /* TYPE MACROS */ |
|
68 #define GABBLE_TYPE_MEDIA_STREAM \ |
|
69 (gabble_media_stream_get_type()) |
|
70 #define GABBLE_MEDIA_STREAM(obj) \ |
|
71 (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_MEDIA_STREAM, GabbleMediaStream)) |
|
72 #define GABBLE_MEDIA_STREAM_CLASS(klass) \ |
|
73 (G_TYPE_CHECK_CLASS_CAST((klass), GABBLE_TYPE_MEDIA_STREAM, GabbleMediaStreamClass)) |
|
74 #define GABBLE_IS_MEDIA_STREAM(obj) \ |
|
75 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_MEDIA_STREAM)) |
|
76 #define GABBLE_IS_MEDIA_STREAM_CLASS(klass) \ |
|
77 (G_TYPE_CHECK_CLASS_TYPE((klass), GABBLE_TYPE_MEDIA_STREAM)) |
|
78 #define GABBLE_MEDIA_STREAM_GET_CLASS(obj) \ |
|
79 (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_MEDIA_STREAM, GabbleMediaStreamClass)) |
|
80 |
|
81 #define TP_TYPE_TRANSPORT_STRUCT (dbus_g_type_get_struct ("GValueArray", \ |
|
82 G_TYPE_UINT, \ |
|
83 G_TYPE_STRING, \ |
|
84 G_TYPE_UINT, \ |
|
85 G_TYPE_UINT, \ |
|
86 G_TYPE_STRING, \ |
|
87 G_TYPE_STRING, \ |
|
88 G_TYPE_DOUBLE, \ |
|
89 G_TYPE_UINT, \ |
|
90 G_TYPE_STRING, \ |
|
91 G_TYPE_STRING, \ |
|
92 G_TYPE_INVALID)) |
|
93 #define TP_TYPE_TRANSPORT_LIST (dbus_g_type_get_collection ("GPtrArray", \ |
|
94 TP_TYPE_TRANSPORT_STRUCT)) |
|
95 #define TP_TYPE_CANDIDATE_STRUCT (dbus_g_type_get_struct ("GValueArray", \ |
|
96 G_TYPE_STRING, \ |
|
97 TP_TYPE_TRANSPORT_LIST, \ |
|
98 G_TYPE_INVALID)) |
|
99 #define TP_TYPE_CANDIDATE_LIST (dbus_g_type_get_collection ("GPtrArray", \ |
|
100 TP_TYPE_CANDIDATE_STRUCT)) |
|
101 |
|
102 #define TP_TYPE_CODEC_STRUCT (dbus_g_type_get_struct ("GValueArray", \ |
|
103 G_TYPE_UINT, \ |
|
104 G_TYPE_STRING, \ |
|
105 G_TYPE_UINT, \ |
|
106 G_TYPE_UINT, \ |
|
107 G_TYPE_UINT, \ |
|
108 DBUS_TYPE_G_STRING_STRING_HASHTABLE, \ |
|
109 G_TYPE_INVALID)) |
|
110 #define TP_TYPE_CODEC_LIST (dbus_g_type_get_collection ("GPtrArray", \ |
|
111 TP_TYPE_CODEC_STRUCT)) |
|
112 |
|
113 #define COMBINED_DIRECTION_GET_DIRECTION(d) \ |
|
114 ((TpMediaStreamDirection) ((d) & TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL)) |
|
115 #define COMBINED_DIRECTION_GET_PENDING_SEND(d) \ |
|
116 ((TpMediaStreamPendingSend) ((d) >> 2)) |
|
117 #define MAKE_COMBINED_DIRECTION(d, p) \ |
|
118 ((CombinedStreamDirection) ((d) | ((p) << 2))) |
|
119 |
|
120 gboolean |
|
121 gabble_media_stream_codec_choice (GabbleMediaStream *self, |
|
122 guint codec_id, |
|
123 GError **error); |
|
124 |
|
125 gboolean |
|
126 gabble_media_stream_error (GabbleMediaStream *self, |
|
127 guint errno, |
|
128 const gchar *message, |
|
129 GError **error); |
|
130 |
|
131 gboolean |
|
132 gabble_media_stream_native_candidates_prepared (GabbleMediaStream *self, |
|
133 GError **error); |
|
134 |
|
135 gboolean |
|
136 gabble_media_stream_new_active_candidate_pair (GabbleMediaStream *self, |
|
137 const gchar *native_candidate_id, |
|
138 const gchar *remote_candidate_id, |
|
139 GError **error); |
|
140 |
|
141 gboolean |
|
142 gabble_media_stream_new_native_candidate (GabbleMediaStream *self, |
|
143 const gchar *candidate_id, |
|
144 const GPtrArray *transports, |
|
145 GError **error); |
|
146 |
|
147 gboolean |
|
148 gabble_media_stream_ready (GabbleMediaStream *self, |
|
149 const GPtrArray *codecs, |
|
150 GError **error); |
|
151 |
|
152 gboolean |
|
153 gabble_media_stream_set_local_codecs (GabbleMediaStream *self, |
|
154 const GPtrArray *codecs, |
|
155 GError **error); |
|
156 |
|
157 gboolean |
|
158 gabble_media_stream_stream_state (GabbleMediaStream *self, |
|
159 guint state, |
|
160 GError **error); |
|
161 |
|
162 gboolean |
|
163 gabble_media_stream_supported_codecs (GabbleMediaStream *self, |
|
164 const GPtrArray *codecs, |
|
165 GError **error); |
|
166 |
|
167 |
|
168 void _gabble_media_stream_close (GabbleMediaStream *close); |
|
169 gboolean _gabble_media_stream_post_remote_codecs (GabbleMediaStream *stream, LmMessage *message, LmMessageNode *desc_node, GError **error); |
|
170 gboolean _gabble_media_stream_post_remote_candidates (GabbleMediaStream *stream, LmMessage *message, LmMessageNode *transport_node, GError **error); |
|
171 LmMessageNode *_gabble_media_stream_add_content_node (GabbleMediaStream *stream, LmMessageNode *session_node); |
|
172 void _gabble_media_stream_content_node_add_description (GabbleMediaStream *stream, LmMessageNode *content_node); |
|
173 LmMessageNode *_gabble_media_stream_content_node_add_transport (GabbleMediaStream *stream, LmMessageNode *content_node); |
|
174 void _gabble_media_stream_update_sending (GabbleMediaStream *stream, gboolean start_sending); |
|
175 |
|
176 G_END_DECLS |
|
177 |
|
178 #endif /* #ifndef __GABBLE_MEDIA_STREAM_H__*/ |
|