Mercurial > pidgin
annotate libpurple/media/media.c @ 29202:ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
session, participant, and conference.
author | maiku@pidgin.im |
---|---|
date | Wed, 28 Oct 2009 00:12:19 +0000 |
parents | 918d4043cc33 |
children | 86c23178a4fc |
rev | line source |
---|---|
29140 | 1 /** |
2 * @file media.c Media API | |
3 * @ingroup core | |
4 */ | |
5 | |
6 /* purple | |
7 * | |
8 * Purple is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
25 */ | |
26 | |
27 #include "internal.h" | |
28 | |
29 #include "account.h" | |
30 #include "media.h" | |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
31 #include "media/backend-fs2.h" |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
32 #include "media/backend-iface.h" |
29140 | 33 #include "mediamanager.h" |
34 | |
35 #include "debug.h" | |
36 | |
37 #ifdef USE_GSTREAMER | |
38 #include "marshallers.h" | |
39 #include "media-gst.h" | |
40 #endif | |
41 | |
42 #ifdef USE_VV | |
43 | |
44 /** @copydoc _PurpleMediaSession */ | |
45 typedef struct _PurpleMediaSession PurpleMediaSession; | |
46 /** @copydoc _PurpleMediaStream */ | |
47 typedef struct _PurpleMediaStream PurpleMediaStream; | |
48 /** @copydoc _PurpleMediaClass */ | |
49 typedef struct _PurpleMediaClass PurpleMediaClass; | |
50 /** @copydoc _PurpleMediaPrivate */ | |
51 typedef struct _PurpleMediaPrivate PurpleMediaPrivate; | |
52 | |
53 /** The media class */ | |
54 struct _PurpleMediaClass | |
55 { | |
56 GObjectClass parent_class; /**< The parent class. */ | |
57 }; | |
58 | |
59 /** The media class's private data */ | |
60 struct _PurpleMedia | |
61 { | |
62 GObject parent; /**< The parent of this object. */ | |
63 PurpleMediaPrivate *priv; /**< The private data of this object. */ | |
64 }; | |
65 | |
66 struct _PurpleMediaSession | |
67 { | |
68 gchar *id; | |
69 PurpleMedia *media; | |
70 PurpleMediaSessionType type; | |
71 gboolean initiator; | |
72 }; | |
73 | |
74 struct _PurpleMediaStream | |
75 { | |
76 PurpleMediaSession *session; | |
77 gchar *participant; | |
78 | |
79 GList *local_candidates; | |
80 GList *remote_candidates; | |
81 | |
82 gboolean initiator; | |
83 gboolean accepted; | |
84 gboolean candidates_prepared; | |
85 | |
86 GList *active_local_candidates; | |
87 GList *active_remote_candidates; | |
88 }; | |
89 #endif | |
90 | |
91 struct _PurpleMediaPrivate | |
92 { | |
93 #ifdef USE_VV | |
94 PurpleMediaManager *manager; | |
95 PurpleAccount *account; | |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
96 PurpleMediaBackend *backend; |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
97 gchar *conference_type; |
29140 | 98 gboolean initiator; |
99 gpointer prpl_data; | |
100 | |
101 GHashTable *sessions; /* PurpleMediaSession table */ | |
102 | |
103 GList *streams; /* PurpleMediaStream table */ | |
104 #else | |
105 gpointer dummy; | |
106 #endif | |
107 }; | |
108 | |
109 #ifdef USE_VV | |
110 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) | |
111 | |
112 static void purple_media_class_init (PurpleMediaClass *klass); | |
113 static void purple_media_init (PurpleMedia *media); | |
114 static void purple_media_dispose (GObject *object); | |
115 static void purple_media_finalize (GObject *object); | |
116 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
117 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | |
118 | |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
119 static void purple_media_new_local_candidate_cb(PurpleMediaBackend *backend, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
120 const gchar *sess_id, const gchar *participant, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
121 PurpleMediaCandidate *candidate, PurpleMedia *media); |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
122 static void purple_media_candidates_prepared_cb(PurpleMediaBackend *backend, |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
123 const gchar *sess_id, const gchar *name, PurpleMedia *media); |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
124 static void purple_media_candidate_pair_established_cb( |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
125 PurpleMediaBackend *backend, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
126 const gchar *sess_id, const gchar *name, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
127 PurpleMediaCandidate *local_candidate, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
128 PurpleMediaCandidate *remote_candidate, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
129 PurpleMedia *media); |
29161
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
130 static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend, |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
131 const gchar *sess_id, PurpleMedia *media); |
29140 | 132 |
133 static GObjectClass *parent_class = NULL; | |
134 | |
135 | |
136 | |
137 enum { | |
138 S_ERROR, | |
139 CANDIDATES_PREPARED, | |
140 CODECS_CHANGED, | |
141 LEVEL, | |
142 NEW_CANDIDATE, | |
143 STATE_CHANGED, | |
144 STREAM_INFO, | |
145 LAST_SIGNAL | |
146 }; | |
147 static guint purple_media_signals[LAST_SIGNAL] = {0}; | |
148 | |
149 enum { | |
150 PROP_0, | |
151 PROP_MANAGER, | |
152 PROP_ACCOUNT, | |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
153 PROP_CONFERENCE_TYPE, |
29140 | 154 PROP_INITIATOR, |
155 PROP_PRPL_DATA, | |
156 }; | |
157 #endif | |
158 | |
159 | |
160 GType | |
161 purple_media_get_type() | |
162 { | |
163 #ifdef USE_VV | |
164 static GType type = 0; | |
165 | |
166 if (type == 0) { | |
167 static const GTypeInfo info = { | |
168 sizeof(PurpleMediaClass), | |
169 NULL, | |
170 NULL, | |
171 (GClassInitFunc) purple_media_class_init, | |
172 NULL, | |
173 NULL, | |
174 sizeof(PurpleMedia), | |
175 0, | |
176 (GInstanceInitFunc) purple_media_init, | |
177 NULL | |
178 }; | |
179 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); | |
180 } | |
181 return type; | |
182 #else | |
183 return G_TYPE_NONE; | |
184 #endif | |
185 } | |
186 | |
187 #ifdef USE_VV | |
188 static void | |
189 purple_media_class_init (PurpleMediaClass *klass) | |
190 { | |
191 GObjectClass *gobject_class = (GObjectClass*)klass; | |
192 parent_class = g_type_class_peek_parent(klass); | |
193 | |
194 gobject_class->dispose = purple_media_dispose; | |
195 gobject_class->finalize = purple_media_finalize; | |
196 gobject_class->set_property = purple_media_set_property; | |
197 gobject_class->get_property = purple_media_get_property; | |
198 | |
199 g_object_class_install_property(gobject_class, PROP_MANAGER, | |
200 g_param_spec_object("manager", | |
201 "Purple Media Manager", | |
202 "The media manager that contains this media session.", | |
203 PURPLE_TYPE_MEDIA_MANAGER, | |
204 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
205 | |
206 g_object_class_install_property(gobject_class, PROP_ACCOUNT, | |
207 g_param_spec_pointer("account", | |
208 "PurpleAccount", | |
209 "The account this media session is on.", | |
210 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
211 | |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
212 g_object_class_install_property(gobject_class, PROP_CONFERENCE_TYPE, |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
213 g_param_spec_string("conference-type", |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
214 "Conference Type", |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
215 "The type of conference that this media object " |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
216 "has been created to provide.", |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
217 NULL, |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
218 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
219 |
29140 | 220 g_object_class_install_property(gobject_class, PROP_INITIATOR, |
221 g_param_spec_boolean("initiator", | |
222 "initiator", | |
223 "If the local user initiated the conference.", | |
224 FALSE, | |
225 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
226 | |
227 g_object_class_install_property(gobject_class, PROP_PRPL_DATA, | |
228 g_param_spec_pointer("prpl-data", | |
229 "gpointer", | |
230 "Data the prpl plugin set on the media session.", | |
231 G_PARAM_READWRITE)); | |
232 | |
233 purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass), | |
234 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
235 g_cclosure_marshal_VOID__STRING, | |
236 G_TYPE_NONE, 1, G_TYPE_STRING); | |
237 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass), | |
238 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
239 purple_smarshal_VOID__STRING_STRING, | |
240 G_TYPE_NONE, 2, G_TYPE_STRING, | |
241 G_TYPE_STRING); | |
242 purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass), | |
243 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
244 g_cclosure_marshal_VOID__STRING, | |
245 G_TYPE_NONE, 1, G_TYPE_STRING); | |
246 purple_media_signals[LEVEL] = g_signal_new("level", G_TYPE_FROM_CLASS(klass), | |
247 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
248 purple_smarshal_VOID__STRING_STRING_DOUBLE, | |
249 G_TYPE_NONE, 3, G_TYPE_STRING, | |
250 G_TYPE_STRING, G_TYPE_DOUBLE); | |
251 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass), | |
252 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
253 purple_smarshal_VOID__POINTER_POINTER_OBJECT, | |
254 G_TYPE_NONE, 3, G_TYPE_POINTER, | |
255 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE); | |
256 purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass), | |
257 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
258 purple_smarshal_VOID__ENUM_STRING_STRING, | |
259 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE, | |
260 G_TYPE_STRING, G_TYPE_STRING); | |
261 purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass), | |
262 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
263 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN, | |
264 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE, | |
265 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); | |
266 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate)); | |
267 } | |
268 | |
269 | |
270 static void | |
271 purple_media_init (PurpleMedia *media) | |
272 { | |
273 media->priv = PURPLE_MEDIA_GET_PRIVATE(media); | |
274 memset(media->priv, 0, sizeof(*media->priv)); | |
275 } | |
276 | |
277 static void | |
278 purple_media_stream_free(PurpleMediaStream *stream) | |
279 { | |
280 if (stream == NULL) | |
281 return; | |
282 | |
283 g_free(stream->participant); | |
284 | |
285 if (stream->local_candidates) | |
29165
cb843608e183
Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29163
diff
changeset
|
286 purple_media_candidate_list_free(stream->local_candidates); |
29140 | 287 if (stream->remote_candidates) |
29166
18571ea6e44a
Store remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29165
diff
changeset
|
288 purple_media_candidate_list_free(stream->remote_candidates); |
29140 | 289 |
290 if (stream->active_local_candidates) | |
29167
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
291 purple_media_candidate_list_free( |
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
292 stream->active_local_candidates); |
29140 | 293 if (stream->active_remote_candidates) |
29168
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
294 purple_media_candidate_list_free( |
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
295 stream->active_remote_candidates); |
29140 | 296 |
297 g_free(stream); | |
298 } | |
299 | |
300 static void | |
301 purple_media_session_free(PurpleMediaSession *session) | |
302 { | |
303 if (session == NULL) | |
304 return; | |
305 | |
306 g_free(session->id); | |
307 g_free(session); | |
308 } | |
309 | |
310 static void | |
311 purple_media_dispose(GObject *media) | |
312 { | |
313 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); | |
314 | |
315 purple_debug_info("media","purple_media_dispose\n"); | |
316 | |
317 purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media)); | |
318 | |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
319 if (priv->backend) { |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
320 g_object_unref(priv->backend); |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
321 priv->backend = NULL; |
29140 | 322 } |
323 | |
29157
e85df0170905
Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents:
29156
diff
changeset
|
324 if (priv->manager) { |
29140 | 325 g_object_unref(priv->manager); |
326 priv->manager = NULL; | |
327 } | |
328 | |
329 G_OBJECT_CLASS(parent_class)->dispose(media); | |
330 } | |
331 | |
332 static void | |
333 purple_media_finalize(GObject *media) | |
334 { | |
335 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); | |
336 purple_debug_info("media","purple_media_finalize\n"); | |
337 | |
338 for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams)) | |
339 purple_media_stream_free(priv->streams->data); | |
340 | |
341 if (priv->sessions) { | |
342 GList *sessions = g_hash_table_get_values(priv->sessions); | |
343 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { | |
344 purple_media_session_free(sessions->data); | |
345 } | |
346 g_hash_table_destroy(priv->sessions); | |
347 } | |
348 | |
349 G_OBJECT_CLASS(parent_class)->finalize(media); | |
350 } | |
351 | |
352 static void | |
353 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | |
354 { | |
355 PurpleMedia *media; | |
356 g_return_if_fail(PURPLE_IS_MEDIA(object)); | |
357 | |
358 media = PURPLE_MEDIA(object); | |
359 | |
360 switch (prop_id) { | |
361 case PROP_MANAGER: | |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
362 media->priv->manager = g_value_dup_object(value); |
29140 | 363 break; |
364 case PROP_ACCOUNT: | |
365 media->priv->account = g_value_get_pointer(value); | |
366 break; | |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
367 case PROP_CONFERENCE_TYPE: |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
368 media->priv->conference_type = |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
369 g_value_dup_string(value); |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
370 /* Will eventually get this type from the media manager */ |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
371 media->priv->backend = g_object_new( |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
372 PURPLE_TYPE_MEDIA_BACKEND_FS2, |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
373 "conference-type", |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
374 media->priv->conference_type, |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
375 "media", media, |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
376 NULL); |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
377 g_signal_connect(media->priv->backend, |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
378 "active-candidate-pair", |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
379 G_CALLBACK( |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
380 purple_media_candidate_pair_established_cb), |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
381 media); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
382 g_signal_connect(media->priv->backend, |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
383 "candidates-prepared", |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
384 G_CALLBACK( |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
385 purple_media_candidates_prepared_cb), |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
386 media); |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
387 g_signal_connect(media->priv->backend, |
29161
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
388 "codecs-changed", |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
389 G_CALLBACK( |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
390 purple_media_codecs_changed_cb), |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
391 media); |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
392 g_signal_connect(media->priv->backend, |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
393 "new-candidate", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
394 G_CALLBACK( |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
395 purple_media_new_local_candidate_cb), |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
396 media); |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
397 break; |
29140 | 398 case PROP_INITIATOR: |
399 media->priv->initiator = g_value_get_boolean(value); | |
400 break; | |
401 case PROP_PRPL_DATA: | |
402 media->priv->prpl_data = g_value_get_pointer(value); | |
403 break; | |
404 default: | |
405 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | |
406 break; | |
407 } | |
408 } | |
409 | |
410 static void | |
411 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
412 { | |
413 PurpleMedia *media; | |
414 g_return_if_fail(PURPLE_IS_MEDIA(object)); | |
415 | |
416 media = PURPLE_MEDIA(object); | |
417 | |
418 switch (prop_id) { | |
419 case PROP_MANAGER: | |
420 g_value_set_object(value, media->priv->manager); | |
421 break; | |
422 case PROP_ACCOUNT: | |
423 g_value_set_pointer(value, media->priv->account); | |
424 break; | |
29151
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
425 case PROP_CONFERENCE_TYPE: |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
426 g_value_set_string(value, |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
427 media->priv->conference_type); |
30e8ab2a4bc2
Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents:
29144
diff
changeset
|
428 break; |
29140 | 429 case PROP_INITIATOR: |
430 g_value_set_boolean(value, media->priv->initiator); | |
431 break; | |
432 case PROP_PRPL_DATA: | |
433 g_value_set_pointer(value, media->priv->prpl_data); | |
434 break; | |
435 default: | |
436 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | |
437 break; | |
438 } | |
439 | |
440 } | |
441 | |
442 static PurpleMediaSession* | |
443 purple_media_get_session(PurpleMedia *media, const gchar *sess_id) | |
444 { | |
445 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
446 return (PurpleMediaSession*) (media->priv->sessions) ? | |
447 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL; | |
448 } | |
449 | |
450 static PurpleMediaStream* | |
451 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant) | |
452 { | |
453 GList *streams; | |
454 | |
455 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
456 | |
457 streams = media->priv->streams; | |
458 | |
459 for (; streams; streams = g_list_next(streams)) { | |
460 PurpleMediaStream *stream = streams->data; | |
461 if (!strcmp(stream->session->id, session) && | |
462 !strcmp(stream->participant, participant)) | |
463 return stream; | |
464 } | |
465 | |
466 return NULL; | |
467 } | |
468 | |
469 static GList * | |
470 purple_media_get_streams(PurpleMedia *media, const gchar *session, | |
471 const gchar *participant) | |
472 { | |
473 GList *streams; | |
474 GList *ret = NULL; | |
475 | |
476 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
477 | |
478 streams = media->priv->streams; | |
479 | |
480 for (; streams; streams = g_list_next(streams)) { | |
481 PurpleMediaStream *stream = streams->data; | |
482 if ((session == NULL || | |
483 !strcmp(stream->session->id, session)) && | |
484 (participant == NULL || | |
485 !strcmp(stream->participant, participant))) | |
486 ret = g_list_append(ret, stream); | |
487 } | |
488 | |
489 return ret; | |
490 } | |
491 | |
492 static void | |
493 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session) | |
494 { | |
495 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
496 g_return_if_fail(session != NULL); | |
497 | |
498 if (!media->priv->sessions) { | |
499 purple_debug_info("media", "Creating hash table for sessions\n"); | |
500 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); | |
501 } | |
502 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session); | |
503 } | |
504 | |
29174 | 505 #if 0 |
29140 | 506 static gboolean |
507 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session) | |
508 { | |
509 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
510 return g_hash_table_remove(media->priv->sessions, session->id); | |
511 } | |
29174 | 512 #endif |
29140 | 513 |
514 static PurpleMediaStream * | |
29186 | 515 purple_media_insert_stream(PurpleMediaSession *session, |
516 const gchar *name, gboolean initiator) | |
29140 | 517 { |
518 PurpleMediaStream *media_stream; | |
519 | |
520 g_return_val_if_fail(session != NULL, NULL); | |
521 | |
522 media_stream = g_new0(PurpleMediaStream, 1); | |
523 media_stream->participant = g_strdup(name); | |
524 media_stream->session = session; | |
29186 | 525 media_stream->initiator = initiator; |
29140 | 526 |
527 session->media->priv->streams = | |
528 g_list_append(session->media->priv->streams, media_stream); | |
529 | |
530 return media_stream; | |
531 } | |
532 | |
533 static void | |
534 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name, | |
29165
cb843608e183
Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29163
diff
changeset
|
535 PurpleMediaCandidate *candidate) |
29140 | 536 { |
537 PurpleMediaStream *stream; | |
538 | |
539 g_return_if_fail(session != NULL); | |
540 | |
541 stream = purple_media_get_stream(session->media, session->id, name); | |
542 stream->local_candidates = g_list_append(stream->local_candidates, candidate); | |
543 } | |
544 #endif | |
545 | |
546 GList * | |
547 purple_media_get_session_ids(PurpleMedia *media) | |
548 { | |
549 #ifdef USE_VV | |
550 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
551 return media->priv->sessions != NULL ? | |
552 g_hash_table_get_keys(media->priv->sessions) : NULL; | |
553 #else | |
554 return NULL; | |
555 #endif | |
556 } | |
557 | |
558 #ifdef USE_GSTREAMER | |
559 GstElement * | |
560 purple_media_get_src(PurpleMedia *media, const gchar *sess_id) | |
561 { | |
562 #ifdef USE_VV | |
563 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
29189
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
564 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
565 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
566 return purple_media_backend_fs2_get_src( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
567 PURPLE_MEDIA_BACKEND_FS2( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
568 media->priv->backend), sess_id); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
569 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
570 g_return_val_if_reached(NULL); |
29140 | 571 #else |
572 return NULL; | |
573 #endif | |
574 } | |
575 #endif /* USE_GSTREAMER */ | |
576 | |
577 PurpleAccount * | |
578 purple_media_get_account(PurpleMedia *media) | |
579 { | |
580 #ifdef USE_VV | |
581 PurpleAccount *account; | |
582 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
583 g_object_get(G_OBJECT(media), "account", &account, NULL); | |
584 return account; | |
585 #else | |
586 return NULL; | |
587 #endif | |
588 } | |
589 | |
590 gpointer | |
591 purple_media_get_prpl_data(PurpleMedia *media) | |
592 { | |
593 #ifdef USE_VV | |
594 gpointer prpl_data; | |
595 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
596 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); | |
597 return prpl_data; | |
598 #else | |
599 return NULL; | |
600 #endif | |
601 } | |
602 | |
603 void | |
604 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) | |
605 { | |
606 #ifdef USE_VV | |
607 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
608 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); | |
609 #endif | |
610 } | |
611 | |
612 void | |
613 purple_media_error(PurpleMedia *media, const gchar *error, ...) | |
614 { | |
615 #ifdef USE_VV | |
616 va_list args; | |
617 gchar *message; | |
618 | |
619 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
620 | |
621 va_start(args, error); | |
622 message = g_strdup_vprintf(error, args); | |
623 va_end(args); | |
624 | |
625 purple_debug_error("media", "%s\n", message); | |
626 g_signal_emit(media, purple_media_signals[S_ERROR], 0, message); | |
627 | |
628 g_free(message); | |
629 #endif | |
630 } | |
631 | |
632 void | |
633 purple_media_end(PurpleMedia *media, | |
634 const gchar *session_id, const gchar *participant) | |
635 { | |
636 #ifdef USE_VV | |
29201
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
637 GList *iter, *sessions = NULL, *participants = NULL; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
638 |
29140 | 639 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
29201
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
640 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
641 iter = purple_media_get_streams(media, session_id, participant); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
642 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
643 /* Free matching streams */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
644 for (; iter; iter = g_list_delete_link(iter, iter)) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
645 PurpleMediaStream *stream = iter->data; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
646 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
647 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
648 0, PURPLE_MEDIA_STATE_END, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
649 stream->session->id, stream->participant); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
650 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
651 media->priv->streams = |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
652 g_list_remove(media->priv->streams, stream); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
653 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
654 if (g_list_find(sessions, stream->session) == NULL) |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
655 sessions = g_list_prepend(sessions, stream->session); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
656 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
657 if (g_list_find_custom(participants, stream->participant, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
658 (GCompareFunc)strcmp) == NULL) |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
659 participants = g_list_prepend(participants, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
660 g_strdup(stream->participant)); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
661 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
662 purple_media_stream_free(stream); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
663 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
664 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
665 iter = media->priv->streams; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
666 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
667 /* Reduce to list of sessions to remove */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
668 for (; iter; iter = g_list_next(iter)) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
669 PurpleMediaStream *stream = iter->data; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
670 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
671 sessions = g_list_remove(sessions, stream->session); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
672 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
673 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
674 /* Free sessions with no streams left */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
675 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
676 PurpleMediaSession *session = sessions->data; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
677 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
678 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
679 0, PURPLE_MEDIA_STATE_END, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
680 session->id, NULL); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
681 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
682 g_hash_table_remove(media->priv->sessions, session->id); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
683 purple_media_session_free(session); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
684 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
685 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
686 iter = media->priv->streams; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
687 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
688 /* Reduce to list of participants to remove */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
689 for (; iter; iter = g_list_next(iter)) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
690 PurpleMediaStream *stream = iter->data; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
691 GList *tmp; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
692 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
693 tmp = g_list_find_custom(participants, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
694 stream->participant, (GCompareFunc)strcmp); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
695 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
696 if (tmp != NULL) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
697 g_free(tmp->data); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
698 participants = g_list_delete_link(participants, tmp); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
699 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
700 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
701 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
702 /* Remove participants with no streams left (just emit the signal) */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
703 for (; participants; participants = |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
704 g_list_delete_link(participants, participants)) { |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
705 gchar *participant = participants->data; |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
706 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
707 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
708 0, PURPLE_MEDIA_STATE_END, |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
709 NULL, participant); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
710 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
711 g_free(participant); |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
712 } |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
713 |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
714 /* Free the conference if no sessions left */ |
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
715 if (g_hash_table_size(media->priv->sessions) == 0) { |
29140 | 716 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
717 0, PURPLE_MEDIA_STATE_END, | |
718 NULL, NULL); | |
719 g_object_unref(media); | |
29201
918d4043cc33
Emit PURPLE_MEDIA_END state-changed signals for each stream, session, and
maiku@pidgin.im
parents:
29200
diff
changeset
|
720 return; |
29140 | 721 } |
722 #endif | |
723 } | |
724 | |
725 void | |
726 purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, | |
727 const gchar *session_id, const gchar *participant, | |
728 gboolean local) | |
729 { | |
730 #ifdef USE_VV | |
731 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
732 | |
733 if (type == PURPLE_MEDIA_INFO_ACCEPT) { | |
29202
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
734 GList *streams, *sessions = NULL, *participants = NULL; |
29140 | 735 |
736 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
737 | |
738 streams = purple_media_get_streams(media, | |
739 session_id, participant); | |
740 | |
29202
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
741 /* Emit stream acceptance */ |
29140 | 742 for (; streams; streams = |
743 g_list_delete_link(streams, streams)) { | |
744 PurpleMediaStream *stream = streams->data; | |
29182
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29181
diff
changeset
|
745 |
29140 | 746 stream->accepted = TRUE; |
29202
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
747 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
748 g_signal_emit(media, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
749 purple_media_signals[STREAM_INFO], |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
750 0, type, stream->session->id, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
751 stream->participant, local); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
752 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
753 if (g_list_find(sessions, stream->session) == NULL) |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
754 sessions = g_list_prepend(sessions, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
755 stream->session); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
756 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
757 if (g_list_find_custom(participants, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
758 stream->participant, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
759 (GCompareFunc)strcmp) == NULL) |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
760 participants = g_list_prepend(participants, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
761 g_strdup(stream->participant)); |
29140 | 762 } |
29202
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
763 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
764 /* Emit session acceptance */ |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
765 for (; sessions; sessions = |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
766 g_list_delete_link(sessions, sessions)) { |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
767 PurpleMediaSession *session = sessions->data; |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
768 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
769 if (purple_media_accepted(media, session->id, NULL)) |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
770 g_signal_emit(media, purple_media_signals[ |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
771 STREAM_INFO], 0, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
772 PURPLE_MEDIA_INFO_ACCEPT, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
773 session->id, NULL, local); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
774 } |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
775 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
776 /* Emit participant acceptance */ |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
777 for (; participants; participants = g_list_delete_link( |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
778 participants, participants)) { |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
779 gchar *participant = participants->data; |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
780 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
781 if (purple_media_accepted(media, NULL, participant)) |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
782 g_signal_emit(media, purple_media_signals[ |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
783 STREAM_INFO], 0, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
784 PURPLE_MEDIA_INFO_ACCEPT, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
785 NULL, participant, local); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
786 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
787 g_free(participant); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
788 } |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
789 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
790 /* Emit conference acceptance */ |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
791 if (purple_media_accepted(media, NULL, NULL)) |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
792 g_signal_emit(media, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
793 purple_media_signals[STREAM_INFO], |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
794 0, PURPLE_MEDIA_INFO_ACCEPT, |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
795 NULL, NULL, local); |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
796 |
ecdf669adac9
Have PURPLE_MEDIA_INFO_ACCEPT in stream-info emit for each accepted stream,
maiku@pidgin.im
parents:
29201
diff
changeset
|
797 return; |
29140 | 798 } |
799 | |
800 g_signal_emit(media, purple_media_signals[STREAM_INFO], | |
801 0, type, session_id, participant, local); | |
802 | |
803 if (type == PURPLE_MEDIA_INFO_HANGUP || | |
804 type == PURPLE_MEDIA_INFO_REJECT) { | |
805 purple_media_end(media, session_id, participant); | |
806 } | |
807 #endif | |
808 } | |
809 | |
810 #ifdef USE_VV | |
811 static void | |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
812 purple_media_new_local_candidate_cb(PurpleMediaBackend *backend, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
813 const gchar *sess_id, const gchar *participant, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
814 PurpleMediaCandidate *candidate, PurpleMedia *media) |
29140 | 815 { |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
816 PurpleMediaSession *session = |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
817 purple_media_get_session(media, sess_id); |
29140 | 818 |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
819 purple_media_insert_local_candidate(session, participant, |
29165
cb843608e183
Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29163
diff
changeset
|
820 purple_media_candidate_copy(candidate)); |
29140 | 821 |
822 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE], | |
29160
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29159
diff
changeset
|
823 0, session->id, participant, candidate); |
29140 | 824 } |
825 | |
826 static void | |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
827 purple_media_candidates_prepared_cb(PurpleMediaBackend *backend, |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
828 const gchar *sess_id, const gchar *name, PurpleMedia *media) |
29140 | 829 { |
830 PurpleMediaStream *stream_data; | |
831 | |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
832 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
29140 | 833 |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
834 stream_data = purple_media_get_stream(media, sess_id, name); |
29140 | 835 stream_data->candidates_prepared = TRUE; |
836 | |
29163
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
837 g_signal_emit(media, purple_media_signals[CANDIDATES_PREPARED], |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29162
diff
changeset
|
838 0, sess_id, name); |
29140 | 839 } |
840 | |
841 /* callback called when a pair of transport candidates (local and remote) | |
842 * has been established */ | |
843 static void | |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
844 purple_media_candidate_pair_established_cb(PurpleMediaBackend *backend, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
845 const gchar *sess_id, const gchar *name, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
846 PurpleMediaCandidate *local_candidate, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
847 PurpleMediaCandidate *remote_candidate, |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
848 PurpleMedia *media) |
29140 | 849 { |
850 PurpleMediaStream *stream; | |
851 GList *iter; | |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
852 guint id; |
29140 | 853 |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
854 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
29140 | 855 |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
856 stream = purple_media_get_stream(media, sess_id, name); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
857 id = purple_media_candidate_get_component_id(local_candidate); |
29140 | 858 |
859 iter = stream->active_local_candidates; | |
860 for(; iter; iter = g_list_next(iter)) { | |
29167
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
861 PurpleMediaCandidate *c = iter->data; |
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
862 if (id == purple_media_candidate_get_component_id(c)) { |
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
863 g_object_unref(c); |
29140 | 864 stream->active_local_candidates = |
865 g_list_delete_link(iter, iter); | |
866 stream->active_local_candidates = g_list_prepend( | |
867 stream->active_local_candidates, | |
29167
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
868 purple_media_candidate_copy( |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
869 local_candidate)); |
29140 | 870 break; |
871 } | |
872 } | |
873 if (iter == NULL) | |
874 stream->active_local_candidates = g_list_prepend( | |
875 stream->active_local_candidates, | |
29167
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
876 purple_media_candidate_copy( |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
877 local_candidate)); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
878 |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
879 id = purple_media_candidate_get_component_id(local_candidate); |
29140 | 880 |
881 iter = stream->active_remote_candidates; | |
882 for(; iter; iter = g_list_next(iter)) { | |
29168
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
883 PurpleMediaCandidate *c = iter->data; |
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
884 if (id == purple_media_candidate_get_component_id(c)) { |
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
885 g_object_unref(c); |
29140 | 886 stream->active_remote_candidates = |
887 g_list_delete_link(iter, iter); | |
888 stream->active_remote_candidates = g_list_prepend( | |
889 stream->active_remote_candidates, | |
29168
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
890 purple_media_candidate_copy( |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
891 remote_candidate)); |
29140 | 892 break; |
893 } | |
894 } | |
895 if (iter == NULL) | |
896 stream->active_remote_candidates = g_list_prepend( | |
897 stream->active_remote_candidates, | |
29168
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
898 purple_media_candidate_copy( |
29162
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29161
diff
changeset
|
899 remote_candidate)); |
29140 | 900 |
901 purple_debug_info("media", "candidate pair established\n"); | |
902 } | |
903 | |
29161
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
904 static void |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
905 purple_media_codecs_changed_cb(PurpleMediaBackend *backend, |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
906 const gchar *sess_id, PurpleMedia *media) |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
907 { |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
908 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, sess_id); |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29160
diff
changeset
|
909 } |
29140 | 910 #endif /* USE_VV */ |
911 | |
912 gboolean | |
913 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, | |
914 const gchar *who, PurpleMediaSessionType type, | |
915 gboolean initiator, const gchar *transmitter, | |
916 guint num_params, GParameter *params) | |
917 { | |
918 #ifdef USE_VV | |
919 PurpleMediaSession *session; | |
920 PurpleMediaStream *stream = NULL; | |
921 | |
922 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
923 | |
29155
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
924 if (!purple_media_backend_add_stream(media->priv->backend, |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
925 sess_id, who, type, initiator, transmitter, |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
926 num_params, params)) { |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
927 purple_debug_error("media", "Error adding stream.\n"); |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
928 return FALSE; |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
929 } |
41ae97b7e97e
Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents:
29151
diff
changeset
|
930 |
29140 | 931 session = purple_media_get_session(media, sess_id); |
932 | |
933 if (!session) { | |
934 session = g_new0(PurpleMediaSession, 1); | |
935 session->id = g_strdup(sess_id); | |
936 session->media = media; | |
937 session->type = type; | |
938 session->initiator = initiator; | |
939 | |
940 purple_media_add_session(media, session); | |
941 g_signal_emit(media, purple_media_signals[STATE_CHANGED], | |
942 0, PURPLE_MEDIA_STATE_NEW, | |
943 session->id, NULL); | |
944 } | |
945 | |
29185
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29184
diff
changeset
|
946 if (purple_media_get_stream(media, sess_id, who) == NULL) { |
29186 | 947 stream = purple_media_insert_stream(session, who, initiator); |
29140 | 948 |
949 g_signal_emit(media, purple_media_signals[STATE_CHANGED], | |
950 0, PURPLE_MEDIA_STATE_NEW, | |
951 session->id, who); | |
952 } | |
953 | |
954 return TRUE; | |
955 #else | |
956 return FALSE; | |
957 #endif /* USE_VV */ | |
958 } | |
959 | |
960 PurpleMediaManager * | |
961 purple_media_get_manager(PurpleMedia *media) | |
962 { | |
963 PurpleMediaManager *ret; | |
964 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
965 g_object_get(media, "manager", &ret, NULL); | |
966 return ret; | |
967 } | |
968 | |
969 PurpleMediaSessionType | |
970 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) | |
971 { | |
972 #ifdef USE_VV | |
973 PurpleMediaSession *session; | |
974 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); | |
975 session = purple_media_get_session(media, sess_id); | |
976 return session->type; | |
977 #else | |
978 return PURPLE_MEDIA_NONE; | |
979 #endif | |
980 } | |
981 /* XXX: Should wait until codecs-ready is TRUE before using this function */ | |
982 GList * | |
983 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) | |
984 { | |
985 #ifdef USE_VV | |
986 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
987 | |
29175
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29174
diff
changeset
|
988 return purple_media_backend_get_codecs(media->priv->backend, sess_id); |
29140 | 989 #else |
990 return NULL; | |
991 #endif | |
992 } | |
993 | |
994 GList * | |
995 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, | |
996 const gchar *participant) | |
997 { | |
998 #ifdef USE_VV | |
999 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
29177
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29175
diff
changeset
|
1000 |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29175
diff
changeset
|
1001 return purple_media_backend_get_local_candidates(media->priv->backend, |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29175
diff
changeset
|
1002 sess_id, participant); |
29140 | 1003 #else |
1004 return NULL; | |
1005 #endif | |
1006 } | |
1007 | |
1008 void | |
1009 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, | |
1010 const gchar *participant, | |
1011 GList *remote_candidates) | |
1012 { | |
1013 #ifdef USE_VV | |
1014 PurpleMediaStream *stream; | |
1015 | |
1016 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
1017 stream = purple_media_get_stream(media, sess_id, participant); | |
1018 | |
1019 if (stream == NULL) { | |
1020 purple_debug_error("media", | |
1021 "purple_media_add_remote_candidates: " | |
1022 "couldn't find stream %s %s.\n", | |
1023 sess_id ? sess_id : "(null)", | |
1024 participant ? participant : "(null)"); | |
1025 return; | |
1026 } | |
1027 | |
1028 stream->remote_candidates = g_list_concat(stream->remote_candidates, | |
29166
18571ea6e44a
Store remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29165
diff
changeset
|
1029 purple_media_candidate_list_copy(remote_candidates)); |
29140 | 1030 |
29182
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29181
diff
changeset
|
1031 purple_media_backend_add_remote_candidates(media->priv->backend, |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29181
diff
changeset
|
1032 sess_id, participant, remote_candidates); |
29140 | 1033 #endif |
1034 } | |
1035 | |
1036 #if 0 | |
1037 /* | |
1038 * These two functions aren't being used and I'd rather not lock in the API | |
1039 * until they are needed. If they ever are. | |
1040 */ | |
1041 | |
1042 GList * | |
1043 purple_media_get_active_local_candidates(PurpleMedia *media, | |
1044 const gchar *sess_id, const gchar *participant) | |
1045 { | |
1046 #ifdef USE_VV | |
1047 PurpleMediaStream *stream; | |
1048 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
1049 stream = purple_media_get_stream(media, sess_id, participant); | |
29167
7713312c4ab0
Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29166
diff
changeset
|
1050 return purple_media_candidate_list_copy( |
29140 | 1051 stream->active_local_candidates); |
1052 #else | |
1053 return NULL; | |
1054 #endif | |
1055 } | |
1056 | |
1057 GList * | |
1058 purple_media_get_active_remote_candidates(PurpleMedia *media, | |
1059 const gchar *sess_id, const gchar *participant) | |
1060 { | |
1061 #ifdef USE_VV | |
1062 PurpleMediaStream *stream; | |
1063 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
1064 stream = purple_media_get_stream(media, sess_id, participant); | |
29168
1156bf88b4d3
Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents:
29167
diff
changeset
|
1065 return purple_media_candidate_list_copy( |
29140 | 1066 stream->active_remote_candidates); |
1067 #else | |
1068 return NULL; | |
1069 #endif | |
1070 } | |
1071 #endif | |
1072 | |
1073 gboolean | |
1074 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, | |
1075 const gchar *participant, GList *codecs) | |
1076 { | |
1077 #ifdef USE_VV | |
1078 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1079 | |
29179
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29177
diff
changeset
|
1080 return purple_media_backend_set_remote_codecs(media->priv->backend, |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29177
diff
changeset
|
1081 sess_id, participant, codecs); |
29140 | 1082 #else |
1083 return FALSE; | |
1084 #endif | |
1085 } | |
1086 | |
1087 gboolean | |
1088 purple_media_candidates_prepared(PurpleMedia *media, | |
1089 const gchar *session_id, const gchar *participant) | |
1090 { | |
1091 #ifdef USE_VV | |
1092 GList *streams; | |
1093 gboolean prepared = TRUE; | |
1094 | |
1095 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1096 | |
1097 streams = purple_media_get_streams(media, session_id, participant); | |
1098 | |
1099 for (; streams; streams = g_list_delete_link(streams, streams)) { | |
1100 PurpleMediaStream *stream = streams->data; | |
1101 if (stream->candidates_prepared == FALSE) { | |
1102 g_list_free(streams); | |
1103 prepared = FALSE; | |
1104 break; | |
1105 } | |
1106 } | |
1107 | |
1108 return prepared; | |
1109 #else | |
1110 return FALSE; | |
1111 #endif | |
1112 } | |
1113 | |
1114 gboolean | |
1115 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) | |
1116 { | |
1117 #ifdef USE_VV | |
1118 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1119 | |
29181
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29179
diff
changeset
|
1120 return purple_media_backend_set_send_codec( |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29179
diff
changeset
|
1121 media->priv->backend, sess_id, codec); |
29140 | 1122 #else |
1123 return FALSE; | |
1124 #endif | |
1125 } | |
1126 | |
1127 gboolean | |
1128 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) | |
1129 { | |
1130 #ifdef USE_VV | |
1131 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1132 | |
29187
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29186
diff
changeset
|
1133 return purple_media_backend_codecs_ready( |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29186
diff
changeset
|
1134 media->priv->backend, sess_id); |
29140 | 1135 #else |
1136 return FALSE; | |
1137 #endif | |
1138 } | |
1139 | |
1140 gboolean | |
1141 purple_media_is_initiator(PurpleMedia *media, | |
1142 const gchar *sess_id, const gchar *participant) | |
1143 { | |
1144 #ifdef USE_VV | |
1145 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1146 | |
1147 if (sess_id == NULL && participant == NULL) | |
1148 return media->priv->initiator; | |
1149 else if (sess_id != NULL && participant == NULL) { | |
1150 PurpleMediaSession *session = | |
1151 purple_media_get_session(media, sess_id); | |
1152 return session != NULL ? session->initiator : FALSE; | |
1153 } else if (sess_id != NULL && participant != NULL) { | |
1154 PurpleMediaStream *stream = purple_media_get_stream( | |
1155 media, sess_id, participant); | |
1156 return stream != NULL ? stream->initiator : FALSE; | |
1157 } | |
1158 #endif | |
1159 return FALSE; | |
1160 } | |
1161 | |
1162 gboolean | |
1163 purple_media_accepted(PurpleMedia *media, const gchar *sess_id, | |
1164 const gchar *participant) | |
1165 { | |
1166 #ifdef USE_VV | |
1167 gboolean accepted = TRUE; | |
1168 | |
1169 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1170 | |
1171 if (sess_id == NULL && participant == NULL) { | |
1172 GList *streams = media->priv->streams; | |
1173 | |
1174 for (; streams; streams = g_list_next(streams)) { | |
1175 PurpleMediaStream *stream = streams->data; | |
1176 if (stream->accepted == FALSE) { | |
1177 accepted = FALSE; | |
1178 break; | |
1179 } | |
1180 } | |
1181 } else if (sess_id != NULL && participant == NULL) { | |
1182 GList *streams = purple_media_get_streams( | |
1183 media, sess_id, NULL); | |
1184 for (; streams; streams = | |
1185 g_list_delete_link(streams, streams)) { | |
1186 PurpleMediaStream *stream = streams->data; | |
1187 if (stream->accepted == FALSE) { | |
1188 g_list_free(streams); | |
1189 accepted = FALSE; | |
1190 break; | |
1191 } | |
1192 } | |
1193 } else if (sess_id != NULL && participant != NULL) { | |
1194 PurpleMediaStream *stream = purple_media_get_stream( | |
1195 media, sess_id, participant); | |
1196 if (stream == NULL || stream->accepted == FALSE) | |
1197 accepted = FALSE; | |
1198 } | |
1199 | |
1200 return accepted; | |
1201 #else | |
1202 return FALSE; | |
1203 #endif | |
1204 } | |
1205 | |
1206 void purple_media_set_input_volume(PurpleMedia *media, | |
1207 const gchar *session_id, double level) | |
1208 { | |
1209 #ifdef USE_VV | |
1210 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
29191
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1211 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)); |
29140 | 1212 |
29191
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1213 purple_media_backend_fs2_set_input_volume( |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1214 PURPLE_MEDIA_BACKEND_FS2( |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1215 media->priv->backend), |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1216 session_id, level); |
29140 | 1217 #endif |
1218 } | |
1219 | |
1220 void purple_media_set_output_volume(PurpleMedia *media, | |
1221 const gchar *session_id, const gchar *participant, | |
1222 double level) | |
1223 { | |
1224 #ifdef USE_VV | |
1225 g_return_if_fail(PURPLE_IS_MEDIA(media)); | |
29191
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1226 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)); |
29140 | 1227 |
29191
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1228 purple_media_backend_fs2_set_output_volume( |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1229 PURPLE_MEDIA_BACKEND_FS2( |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1230 media->priv->backend), |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29190
diff
changeset
|
1231 session_id, participant, level); |
29140 | 1232 #endif |
1233 } | |
1234 | |
1235 gulong | |
1236 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, | |
1237 const gchar *participant, gulong window_id) | |
1238 { | |
1239 #ifdef USE_VV | |
1240 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | |
1241 | |
1242 return purple_media_manager_set_output_window(media->priv->manager, | |
1243 media, session_id, participant, window_id); | |
1244 #else | |
1245 return 0; | |
1246 #endif | |
1247 } | |
1248 | |
1249 void | |
1250 purple_media_remove_output_windows(PurpleMedia *media) | |
1251 { | |
1252 #ifdef USE_VV | |
1253 GList *iter = media->priv->streams; | |
1254 for (; iter; iter = g_list_next(iter)) { | |
1255 PurpleMediaStream *stream = iter->data; | |
1256 purple_media_manager_remove_output_windows( | |
1257 media->priv->manager, media, | |
1258 stream->session->id, stream->participant); | |
1259 } | |
1260 | |
1261 iter = purple_media_get_session_ids(media); | |
1262 for (; iter; iter = g_list_delete_link(iter, iter)) { | |
1263 gchar *session_name = iter->data; | |
1264 purple_media_manager_remove_output_windows( | |
1265 media->priv->manager, media, | |
1266 session_name, NULL); | |
1267 } | |
1268 #endif | |
1269 } | |
1270 | |
1271 #ifdef USE_GSTREAMER | |
1272 GstElement * | |
1273 purple_media_get_tee(PurpleMedia *media, | |
1274 const gchar *session_id, const gchar *participant) | |
1275 { | |
1276 #ifdef USE_VV | |
1277 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | |
1278 | |
29189
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
1279 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
1280 return purple_media_backend_fs2_get_tee( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
1281 PURPLE_MEDIA_BACKEND_FS2( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29188
diff
changeset
|
1282 media->priv->backend), |
29140 | 1283 session_id, participant); |
1284 g_return_val_if_reached(NULL); | |
1285 #else | |
1286 return NULL; | |
1287 #endif | |
1288 } | |
1289 #endif /* USE_GSTREAMER */ | |
1290 |