Mercurial > pidgin.yaz
annotate libpurple/media/backend-fs2.c @ 31817:f56b66606fd2
warnings -= 3;
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 08 Jan 2011 03:49:38 +0000 |
parents | 0485aed45f5b |
children | 66fe4bda9a85 |
rev | line source |
---|---|
29540 | 1 /** |
2 * @file backend-fs2.c Farsight 2 backend for 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 | |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
27 #include "internal.h" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
28 |
29719
858d1a47bf83
Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29714
diff
changeset
|
29 #include "backend-fs2.h" |
858d1a47bf83
Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29714
diff
changeset
|
30 |
29788
e75d6a51a5c4
Compile with --disable-vv. Without this change I get this error:
Mark Doliner <mark@kingant.net>
parents:
29744
diff
changeset
|
31 #ifdef USE_VV |
29540 | 32 #include "backend-iface.h" |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
33 #include "debug.h" |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
34 #include "network.h" |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
35 #include "media-gst.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
36 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
37 #include <gst/farsight/fs-conference-iface.h> |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
38 #include <gst/farsight/fs-element-added-notifier.h> |
29540 | 39 |
40 /** @copydoc _PurpleMediaBackendFs2Class */ | |
41 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class; | |
42 /** @copydoc _PurpleMediaBackendFs2Private */ | |
43 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private; | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
44 /** @copydoc _PurpleMediaBackendFs2Session */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
45 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session; |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
46 /** @copydoc _PurpleMediaBackendFs2Stream */ |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
47 typedef struct _PurpleMediaBackendFs2Stream PurpleMediaBackendFs2Stream; |
29540 | 48 |
49 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \ | |
50 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ | |
51 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private)) | |
52 | |
53 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface); | |
54 | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
55 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
56 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
57 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
58 state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
59 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
60 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
61 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
62 gchar *sid, gchar *name, gboolean local, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
63 PurpleMediaBackendFs2 *self); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
64 |
29540 | 65 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
66 const gchar *sess_id, const gchar *who, | |
67 PurpleMediaSessionType type, gboolean initiator, | |
68 const gchar *transmitter, | |
69 guint num_params, GParameter *params); | |
70 static void purple_media_backend_fs2_add_remote_candidates( | |
71 PurpleMediaBackend *self, | |
72 const gchar *sess_id, const gchar *participant, | |
73 GList *remote_candidates); | |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
74 static gboolean purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
75 const gchar *sess_id); |
29540 | 76 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, |
77 const gchar *sess_id); | |
78 static GList *purple_media_backend_fs2_get_local_candidates( | |
79 PurpleMediaBackend *self, | |
80 const gchar *sess_id, const gchar *participant); | |
29572
a7cad99144f0
Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents:
29571
diff
changeset
|
81 static gboolean purple_media_backend_fs2_set_remote_codecs( |
29540 | 82 PurpleMediaBackend *self, |
83 const gchar *sess_id, const gchar *participant, | |
84 GList *codecs); | |
29574
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29573
diff
changeset
|
85 static gboolean purple_media_backend_fs2_set_send_codec( |
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29573
diff
changeset
|
86 PurpleMediaBackend *self, const gchar *sess_id, |
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29573
diff
changeset
|
87 PurpleMediaCodec *codec); |
29540 | 88 |
89 struct _PurpleMediaBackendFs2Class | |
90 { | |
91 GObjectClass parent_class; | |
92 }; | |
93 | |
94 struct _PurpleMediaBackendFs2 | |
95 { | |
96 GObject parent; | |
97 }; | |
98 | |
99 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2, | |
100 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE( | |
101 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init)); | |
102 | |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
103 struct _PurpleMediaBackendFs2Stream |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
104 { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
105 PurpleMediaBackendFs2Session *session; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
106 gchar *participant; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
107 FsStream *stream; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
108 |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
109 GstElement *src; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
110 GstElement *tee; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
111 GstElement *volume; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
112 GstElement *level; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
113 |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
114 GList *local_candidates; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
115 GList *remote_candidates; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
116 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
117 guint connected_cb_id; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
118 }; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
119 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
120 struct _PurpleMediaBackendFs2Session |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
121 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
122 PurpleMediaBackendFs2 *backend; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
123 gchar *id; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
124 FsSession *session; |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
125 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
126 GstElement *src; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
127 GstElement *tee; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
128 |
31553 | 129 GstPad *srcpad; |
130 | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
131 PurpleMediaSessionType type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
132 }; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
133 |
29540 | 134 struct _PurpleMediaBackendFs2Private |
135 { | |
136 PurpleMedia *media; | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
137 GstElement *confbin; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
138 FsConference *conference; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
139 gchar *conference_type; |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
140 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
141 GHashTable *sessions; |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
142 GHashTable *participants; |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
143 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
144 GList *streams; |
29540 | 145 }; |
146 | |
147 enum { | |
148 PROP_0, | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
149 PROP_CONFERENCE_TYPE, |
29540 | 150 PROP_MEDIA, |
151 }; | |
152 | |
153 static void | |
154 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self) | |
155 { | |
156 } | |
157 | |
158 static void | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
159 purple_media_backend_fs2_dispose(GObject *obj) |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
160 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
161 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
162 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj); |
29577
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
163 GList *iter = NULL; |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
164 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
165 purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n"); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
166 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
167 if (priv->confbin) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
168 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
169 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
170 pipeline = purple_media_manager_get_pipeline( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
171 purple_media_get_manager(priv->media)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
172 |
31553 | 173 /* All connections to media sources should be blocked before confbin is |
174 * removed, to prevent freezing of any other simultaneously running | |
175 * media calls. */ | |
176 if (priv->sessions) { | |
177 GList *sessions = g_hash_table_get_values(priv->sessions); | |
178 for (; sessions; sessions = | |
179 g_list_delete_link(sessions, sessions)) { | |
180 PurpleMediaBackendFs2Session *session = sessions->data; | |
181 if (session->srcpad) { | |
182 gst_pad_set_blocked(session->srcpad, TRUE); | |
183 gst_object_unref(session->srcpad); | |
184 session->srcpad = NULL; | |
185 } | |
186 } | |
187 } | |
188 | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
189 gst_element_set_locked_state(priv->confbin, TRUE); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
190 gst_element_set_state(GST_ELEMENT(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
191 GST_STATE_NULL); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
192 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
193 if (pipeline) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
194 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
195 gst_bin_remove(GST_BIN(pipeline), priv->confbin); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
196 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
197 g_signal_handlers_disconnect_matched(G_OBJECT(bus), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
198 G_SIGNAL_MATCH_FUNC | |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
199 G_SIGNAL_MATCH_DATA, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
200 0, 0, 0, gst_bus_cb, obj); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
201 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
202 } else { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
203 purple_debug_warning("backend-fs2", "Unable to " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
204 "properly dispose the conference. " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
205 "Couldn't get the pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
206 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
207 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
208 priv->confbin = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
209 priv->conference = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
210 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
211 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
212 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
213 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
214 GList *sessions = g_hash_table_get_values(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
215 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
216 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
217 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
218 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
219 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
220 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
221 if (session->session) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
222 g_object_unref(session->session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
223 session->session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
224 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
225 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
226 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
227 |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
228 if (priv->participants) { |
30872 | 229 g_hash_table_destroy(priv->participants); |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
230 priv->participants = NULL; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
231 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
232 |
29577
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
233 for (iter = priv->streams; iter; iter = g_list_next(iter)) { |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
234 PurpleMediaBackendFs2Stream *stream = iter->data; |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
235 if (stream->stream) { |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
236 g_object_unref(stream->stream); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
237 stream->stream = NULL; |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
238 } |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
239 } |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
240 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
241 if (priv->media) { |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
242 g_object_remove_weak_pointer(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
243 (gpointer*)&priv->media); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
244 priv->media = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
245 } |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
246 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
247 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
248 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
249 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
250 static void |
29540 | 251 purple_media_backend_fs2_finalize(GObject *obj) |
252 { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
253 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
254 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
255 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
256 purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n"); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
257 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
258 g_free(priv->conference_type); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
259 |
29577
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
260 for (; priv->streams; priv->streams = |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
261 g_list_delete_link(priv->streams, priv->streams)) { |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
262 PurpleMediaBackendFs2Stream *stream = priv->streams->data; |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
263 |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
264 /* Remove the connected_cb timeout */ |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
265 if (stream->connected_cb_id != 0) |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
266 purple_timeout_remove(stream->connected_cb_id); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
267 |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
268 g_free(stream->participant); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
269 |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
270 if (stream->local_candidates) |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
271 fs_candidate_list_destroy(stream->local_candidates); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
272 |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
273 if (stream->remote_candidates) |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
274 fs_candidate_list_destroy(stream->remote_candidates); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
275 |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
276 g_free(stream); |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
277 } |
3bab2237724d
Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents:
29576
diff
changeset
|
278 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
279 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
280 GList *sessions = g_hash_table_get_values(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
281 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
282 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
283 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
284 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
285 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
286 g_free(session->id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
287 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
288 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
289 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
290 g_hash_table_destroy(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
291 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
292 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
293 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj); |
29540 | 294 } |
295 | |
296 static void | |
297 purple_media_backend_fs2_set_property(GObject *object, guint prop_id, | |
298 const GValue *value, GParamSpec *pspec) | |
299 { | |
300 PurpleMediaBackendFs2Private *priv; | |
301 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
302 | |
303 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); | |
304 | |
305 switch (prop_id) { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
306 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
307 priv->conference_type = g_value_dup_string(value); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
308 break; |
29540 | 309 case PROP_MEDIA: |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
310 priv->media = g_value_get_object(value); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
311 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
312 if (priv->media == NULL) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
313 break; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
314 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
315 g_object_add_weak_pointer(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
316 (gpointer*)&priv->media); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
317 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
318 g_signal_connect(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
319 "state-changed", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
320 G_CALLBACK(state_changed_cb), |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
321 PURPLE_MEDIA_BACKEND_FS2(object)); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
322 g_signal_connect(G_OBJECT(priv->media), "stream-info", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
323 G_CALLBACK(stream_info_cb), |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
324 PURPLE_MEDIA_BACKEND_FS2(object)); |
29540 | 325 break; |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
326 default: |
29540 | 327 G_OBJECT_WARN_INVALID_PROPERTY_ID( |
328 object, prop_id, pspec); | |
329 break; | |
330 } | |
331 } | |
332 | |
333 static void | |
334 purple_media_backend_fs2_get_property(GObject *object, guint prop_id, | |
335 GValue *value, GParamSpec *pspec) | |
336 { | |
337 PurpleMediaBackendFs2Private *priv; | |
338 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
339 |
29540 | 340 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); |
341 | |
342 switch (prop_id) { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
343 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
344 g_value_set_string(value, priv->conference_type); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
345 break; |
29540 | 346 case PROP_MEDIA: |
347 g_value_set_object(value, priv->media); | |
348 break; | |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
349 default: |
29540 | 350 G_OBJECT_WARN_INVALID_PROPERTY_ID( |
351 object, prop_id, pspec); | |
352 break; | |
353 } | |
354 } | |
355 | |
356 static void | |
357 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass) | |
358 { | |
359 GObjectClass *gobject_class = (GObjectClass*)klass; | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
360 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
361 gobject_class->dispose = purple_media_backend_fs2_dispose; |
29540 | 362 gobject_class->finalize = purple_media_backend_fs2_finalize; |
363 gobject_class->set_property = purple_media_backend_fs2_set_property; | |
364 gobject_class->get_property = purple_media_backend_fs2_get_property; | |
365 | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
366 g_object_class_override_property(gobject_class, PROP_CONFERENCE_TYPE, |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
367 "conference-type"); |
29540 | 368 g_object_class_override_property(gobject_class, PROP_MEDIA, "media"); |
369 | |
370 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private)); | |
371 } | |
372 | |
373 static void | |
374 purple_media_backend_iface_init(PurpleMediaBackendIface *iface) | |
375 { | |
376 iface->add_stream = purple_media_backend_fs2_add_stream; | |
377 iface->add_remote_candidates = | |
378 purple_media_backend_fs2_add_remote_candidates; | |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
379 iface->codecs_ready = purple_media_backend_fs2_codecs_ready; |
29540 | 380 iface->get_codecs = purple_media_backend_fs2_get_codecs; |
381 iface->get_local_candidates = | |
382 purple_media_backend_fs2_get_local_candidates; | |
383 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs; | |
384 iface->set_send_codec = purple_media_backend_fs2_set_send_codec; | |
385 } | |
386 | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
387 static FsMediaType |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
388 session_type_to_fs_media_type(PurpleMediaSessionType type) |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
389 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
390 if (type & PURPLE_MEDIA_AUDIO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
391 return FS_MEDIA_TYPE_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
392 else if (type & PURPLE_MEDIA_VIDEO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
393 return FS_MEDIA_TYPE_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
394 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
395 return 0; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
396 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
397 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
398 static FsStreamDirection |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
399 session_type_to_fs_stream_direction(PurpleMediaSessionType type) |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
400 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
401 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
402 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
403 return FS_DIRECTION_BOTH; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
404 else if ((type & PURPLE_MEDIA_SEND_AUDIO) || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
405 (type & PURPLE_MEDIA_SEND_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
406 return FS_DIRECTION_SEND; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
407 else if ((type & PURPLE_MEDIA_RECV_AUDIO) || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
408 (type & PURPLE_MEDIA_RECV_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
409 return FS_DIRECTION_RECV; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
410 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
411 return FS_DIRECTION_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
412 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
413 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
414 static PurpleMediaSessionType |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
415 session_type_from_fs(FsMediaType type, FsStreamDirection direction) |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
416 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
417 PurpleMediaSessionType result = PURPLE_MEDIA_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
418 if (type == FS_MEDIA_TYPE_AUDIO) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
419 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
420 result |= PURPLE_MEDIA_SEND_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
421 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
422 result |= PURPLE_MEDIA_RECV_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
423 } else if (type == FS_MEDIA_TYPE_VIDEO) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
424 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
425 result |= PURPLE_MEDIA_SEND_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
426 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
427 result |= PURPLE_MEDIA_RECV_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
428 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
429 return result; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
430 } |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
431 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
432 static FsCandidate * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
433 candidate_to_fs(PurpleMediaCandidate *candidate) |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
434 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
435 FsCandidate *fscandidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
436 gchar *foundation; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
437 guint component_id; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
438 gchar *ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
439 guint port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
440 gchar *base_ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
441 guint base_port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
442 PurpleMediaNetworkProtocol proto; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
443 guint32 priority; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
444 PurpleMediaCandidateType type; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
445 gchar *username; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
446 gchar *password; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
447 guint ttl; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
448 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
449 if (candidate == NULL) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
450 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
451 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
452 g_object_get(G_OBJECT(candidate), |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
453 "foundation", &foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
454 "component-id", &component_id, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
455 "ip", &ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
456 "port", &port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
457 "base-ip", &base_ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
458 "base-port", &base_port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
459 "protocol", &proto, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
460 "priority", &priority, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
461 "type", &type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
462 "username", &username, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
463 "password", &password, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
464 "ttl", &ttl, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
465 NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
466 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
467 fscandidate = fs_candidate_new(foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
468 component_id, type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
469 proto, ip, port); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
470 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
471 fscandidate->base_ip = base_ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
472 fscandidate->base_port = base_port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
473 fscandidate->priority = priority; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
474 fscandidate->username = username; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
475 fscandidate->password = password; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
476 fscandidate->ttl = ttl; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
477 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
478 g_free(foundation); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
479 g_free(ip); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
480 return fscandidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
481 } |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
482 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
483 static GList * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
484 candidate_list_to_fs(GList *candidates) |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
485 { |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
486 GList *new_list = NULL; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
487 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
488 for (; candidates; candidates = g_list_next(candidates)) { |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
489 new_list = g_list_prepend(new_list, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
490 candidate_to_fs(candidates->data)); |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
491 } |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
492 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
493 new_list = g_list_reverse(new_list); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
494 return new_list; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
495 } |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
496 |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
497 static PurpleMediaCandidate * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
498 candidate_from_fs(FsCandidate *fscandidate) |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
499 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
500 PurpleMediaCandidate *candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
501 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
502 if (fscandidate == NULL) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
503 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
504 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
505 candidate = purple_media_candidate_new(fscandidate->foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
506 fscandidate->component_id, fscandidate->type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
507 fscandidate->proto, fscandidate->ip, fscandidate->port); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
508 g_object_set(candidate, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
509 "base-ip", fscandidate->base_ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
510 "base-port", fscandidate->base_port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
511 "priority", fscandidate->priority, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
512 "username", fscandidate->username, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
513 "password", fscandidate->password, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
514 "ttl", fscandidate->ttl, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
515 return candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
516 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
517 |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
518 static GList * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
519 candidate_list_from_fs(GList *candidates) |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
520 { |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
521 GList *new_list = NULL; |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
522 |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
523 for (; candidates; candidates = g_list_next(candidates)) { |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
524 new_list = g_list_prepend(new_list, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
525 candidate_from_fs(candidates->data)); |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
526 } |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
527 |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
528 new_list = g_list_reverse(new_list); |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
529 return new_list; |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
530 } |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
531 |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
532 static FsCodec * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
533 codec_to_fs(const PurpleMediaCodec *codec) |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
534 { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
535 FsCodec *new_codec; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
536 gint id; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
537 char *encoding_name; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
538 PurpleMediaSessionType media_type; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
539 guint clock_rate; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
540 guint channels; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
541 GList *iter; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
542 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
543 if (codec == NULL) |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
544 return NULL; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
545 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
546 g_object_get(G_OBJECT(codec), |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
547 "id", &id, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
548 "encoding-name", &encoding_name, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
549 "media-type", &media_type, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
550 "clock-rate", &clock_rate, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
551 "channels", &channels, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
552 "optional-params", &iter, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
553 NULL); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
554 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
555 new_codec = fs_codec_new(id, encoding_name, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
556 session_type_to_fs_media_type(media_type), |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
557 clock_rate); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
558 new_codec->channels = channels; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
559 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
560 for (; iter; iter = g_list_next(iter)) { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
561 PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
562 fs_codec_add_optional_parameter(new_codec, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
563 param->key, param->value); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
564 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
565 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
566 g_free(encoding_name); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
567 return new_codec; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
568 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
569 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
570 static PurpleMediaCodec * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
571 codec_from_fs(const FsCodec *codec) |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
572 { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
573 PurpleMediaCodec *new_codec; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
574 GList *iter; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
575 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
576 if (codec == NULL) |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
577 return NULL; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
578 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
579 new_codec = purple_media_codec_new(codec->id, codec->encoding_name, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
580 session_type_from_fs(codec->media_type, |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
581 FS_DIRECTION_BOTH), codec->clock_rate); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
582 g_object_set(new_codec, "channels", codec->channels, NULL); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
583 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
584 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
585 FsCodecParameter *param = (FsCodecParameter*)iter->data; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
586 purple_media_codec_add_optional_parameter(new_codec, |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
587 param->name, param->value); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
588 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
589 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
590 return new_codec; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
591 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
592 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
593 static GList * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
594 codec_list_from_fs(GList *codecs) |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
595 { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
596 GList *new_list = NULL; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
597 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
598 for (; codecs; codecs = g_list_next(codecs)) { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
599 new_list = g_list_prepend(new_list, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
600 codec_from_fs(codecs->data)); |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
601 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
602 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
603 new_list = g_list_reverse(new_list); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
604 return new_list; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
605 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
606 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
607 static GList * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
608 codec_list_to_fs(GList *codecs) |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
609 { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
610 GList *new_list = NULL; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
611 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
612 for (; codecs; codecs = g_list_next(codecs)) { |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
613 new_list = g_list_prepend(new_list, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
614 codec_to_fs(codecs->data)); |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
615 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
616 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
617 new_list = g_list_reverse(new_list); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
618 return new_list; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
619 } |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
620 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
621 static PurpleMediaBackendFs2Session * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
622 get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id) |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
623 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
624 PurpleMediaBackendFs2Private *priv; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
625 PurpleMediaBackendFs2Session *session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
626 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
627 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
628 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
629 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
630 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
631 if (priv->sessions != NULL) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
632 session = g_hash_table_lookup(priv->sessions, sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
633 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
634 return session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
635 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
636 |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
637 static FsParticipant * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
638 get_participant(PurpleMediaBackendFs2 *self, const gchar *name) |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
639 { |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
640 PurpleMediaBackendFs2Private *priv; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
641 FsParticipant *participant = NULL; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
642 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
643 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
644 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
645 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
646 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
647 if (priv->participants != NULL) |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
648 participant = g_hash_table_lookup(priv->participants, name); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
649 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
650 return participant; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
651 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
652 |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
653 static PurpleMediaBackendFs2Stream * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
654 get_stream(PurpleMediaBackendFs2 *self, |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
655 const gchar *sess_id, const gchar *name) |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
656 { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
657 PurpleMediaBackendFs2Private *priv; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
658 GList *streams; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
659 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
660 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
661 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
662 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
663 streams = priv->streams; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
664 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
665 for (; streams; streams = g_list_next(streams)) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
666 PurpleMediaBackendFs2Stream *stream = streams->data; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
667 if (!strcmp(stream->session->id, sess_id) && |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
668 !strcmp(stream->participant, name)) |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
669 return stream; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
670 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
671 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
672 return NULL; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
673 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
674 |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
675 static GList * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
676 get_streams(PurpleMediaBackendFs2 *self, |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
677 const gchar *sess_id, const gchar *name) |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
678 { |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
679 PurpleMediaBackendFs2Private *priv; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
680 GList *streams, *ret = NULL; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
681 |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
682 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
683 |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
684 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
685 streams = priv->streams; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
686 |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
687 for (; streams; streams = g_list_next(streams)) { |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
688 PurpleMediaBackendFs2Stream *stream = streams->data; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
689 |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
690 if (sess_id != NULL && strcmp(stream->session->id, sess_id)) |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
691 continue; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
692 else if (name != NULL && strcmp(stream->participant, name)) |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
693 continue; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
694 else |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
695 ret = g_list_prepend(ret, stream); |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
696 } |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
697 |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
698 ret = g_list_reverse(ret); |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
699 return ret; |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
700 } |
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
701 |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
702 static PurpleMediaBackendFs2Session * |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
703 get_session_from_fs_stream(PurpleMediaBackendFs2 *self, FsStream *stream) |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
704 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
705 PurpleMediaBackendFs2Private *priv = |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
706 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
707 FsSession *fssession; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
708 GList *values; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
709 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
710 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
711 g_return_val_if_fail(FS_IS_STREAM(stream), NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
712 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
713 g_object_get(stream, "session", &fssession, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
714 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
715 values = g_hash_table_get_values(priv->sessions); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
716 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
717 for (; values; values = g_list_delete_link(values, values)) { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
718 PurpleMediaBackendFs2Session *session = values->data; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
719 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
720 if (session->session == fssession) { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
721 g_list_free(values); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
722 g_object_unref(fssession); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
723 return session; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
724 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
725 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
726 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
727 g_object_unref(fssession); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
728 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
729 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
730 |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
731 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
732 gst_handle_message_element(GstBus *bus, GstMessage *msg, |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
733 PurpleMediaBackendFs2 *self) |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
734 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
735 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
736 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
737 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
738 static guint level_id = 0; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
739 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
740 if (level_id == 0) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
741 level_id = g_signal_lookup("level", PURPLE_TYPE_MEDIA); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
742 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
743 if (g_signal_has_handler_pending(priv->media, level_id, 0, FALSE) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
744 && gst_structure_has_name( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
745 gst_message_get_structure(msg), "level")) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
746 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
747 gchar *name; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
748 gchar *participant = NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
749 PurpleMediaBackendFs2Session *session = NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
750 gdouble rms_db; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
751 gdouble percent; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
752 const GValue *list; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
753 const GValue *value; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
754 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
755 if (!PURPLE_IS_MEDIA(priv->media) || |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
756 GST_ELEMENT_PARENT(src) != priv->confbin) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
757 return; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
758 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
759 name = gst_element_get_name(src); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
760 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
761 if (!strncmp(name, "sendlevel_", 10)) { |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
762 session = get_session(self, name+10); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
763 } else { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
764 GList *iter = priv->streams; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
765 PurpleMediaBackendFs2Stream *stream; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
766 for (; iter; iter = g_list_next(iter)) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
767 stream = iter->data; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
768 if (stream->level == src) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
769 session = stream->session; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
770 participant = stream->participant; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
771 break; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
772 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
773 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
774 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
775 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
776 g_free(name); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
777 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
778 if (!session) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
779 return; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
780 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
781 list = gst_structure_get_value( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
782 gst_message_get_structure(msg), "rms"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
783 value = gst_value_list_get_value(list, 0); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
784 rms_db = g_value_get_double(value); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
785 percent = pow(10, rms_db / 20) * 5; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
786 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
787 if(percent > 1.0) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
788 percent = 1.0; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
789 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
790 g_signal_emit(priv->media, level_id, 0, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
791 session->id, participant, percent); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
792 return; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
793 } |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
794 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
795 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) || |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
796 priv->conference != FS_CONFERENCE(src)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
797 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
798 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
799 if (gst_structure_has_name(msg->structure, "farsight-error")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
800 FsError error_no; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
801 gst_structure_get_enum(msg->structure, "error-no", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
802 FS_TYPE_ERROR, (gint*)&error_no); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
803 switch (error_no) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
804 case FS_ERROR_NO_CODECS: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
805 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
806 " found. Install some" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
807 " GStreamer codecs found" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
808 " in GStreamer plugins" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
809 " packages.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
810 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
811 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
812 case FS_ERROR_NO_CODECS_LEFT: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
813 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
814 " left. Your codec" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
815 " preferences in" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
816 " fs-codecs.conf are too" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
817 " strict.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
818 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
819 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
820 case FS_ERROR_UNKNOWN_CNAME: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
821 /* |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
822 * Unknown CName is only a problem for the |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
823 * multicast transmitter which isn't used. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
824 * It is also deprecated. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
825 */ |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
826 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
827 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
828 purple_debug_error("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
829 "farsight-error: %i: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
830 error_no, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
831 gst_structure_get_string( |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
832 msg->structure, "error-msg")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
833 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
834 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
835 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
836 if (FS_ERROR_IS_FATAL(error_no)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
837 purple_media_error(priv->media, _("A non-recoverable " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
838 "Farsight2 error has occurred.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
839 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
840 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
841 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
842 "farsight-new-local-candidate")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
843 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
844 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
845 FsCandidate *local_candidate; |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
846 PurpleMediaCandidate *candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
847 FsParticipant *participant; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
848 PurpleMediaBackendFs2Session *session; |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
849 PurpleMediaBackendFs2Stream *media_stream; |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
850 gchar *name; |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
851 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
852 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
853 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
854 value = gst_structure_get_value(msg->structure, "candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
855 local_candidate = g_value_get_boxed(value); |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
856 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
857 session = get_session_from_fs_stream(self, stream); |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
858 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
859 purple_debug_info("backend-fs2", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
860 "got new local candidate: %s\n", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
861 local_candidate->foundation); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
862 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
863 g_object_get(stream, "participant", &participant, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
864 g_object_get(participant, "cname", &name, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
865 g_object_unref(participant); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
866 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
867 media_stream = get_stream(self, session->id, name); |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
868 media_stream->local_candidates = g_list_append( |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
869 media_stream->local_candidates, |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
870 fs_candidate_copy(local_candidate)); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
871 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
872 candidate = candidate_from_fs(local_candidate); |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
873 g_signal_emit_by_name(self, "new-candidate", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
874 session->id, name, candidate); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
875 g_object_unref(candidate); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
876 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
877 "farsight-local-candidates-prepared")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
878 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
879 FsStream *stream; |
29557
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
880 FsParticipant *participant; |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
881 PurpleMediaBackendFs2Session *session; |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
882 gchar *name; |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
883 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
884 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
885 stream = g_value_get_object(value); |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
886 session = get_session_from_fs_stream(self, stream); |
29557
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
887 |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
888 g_object_get(stream, "participant", &participant, NULL); |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
889 g_object_get(participant, "cname", &name, NULL); |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
890 g_object_unref(participant); |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
891 |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
892 g_signal_emit_by_name(self, "candidates-prepared", |
1fdc75c94c22
Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents:
29556
diff
changeset
|
893 session->id, name); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
894 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
895 "farsight-new-active-candidate-pair")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
896 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
897 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
898 FsCandidate *local_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
899 FsCandidate *remote_candidate; |
29556
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
900 FsParticipant *participant; |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
901 PurpleMediaBackendFs2Session *session; |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
902 PurpleMediaCandidate *lcandidate, *rcandidate; |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
903 gchar *name; |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
904 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
905 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
906 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
907 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
908 "local-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
909 local_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
910 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
911 "remote-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
912 remote_candidate = g_value_get_boxed(value); |
29556
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
913 |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
914 g_object_get(stream, "participant", &participant, NULL); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
915 g_object_get(participant, "cname", &name, NULL); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
916 g_object_unref(participant); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
917 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
918 session = get_session_from_fs_stream(self, stream); |
29556
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
919 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
920 lcandidate = candidate_from_fs(local_candidate); |
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
921 rcandidate = candidate_from_fs(remote_candidate); |
29556
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
922 |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
923 g_signal_emit_by_name(self, "active-candidate-pair", |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
924 session->id, name, lcandidate, rcandidate); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
925 |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
926 g_object_unref(lcandidate); |
74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents:
29555
diff
changeset
|
927 g_object_unref(rcandidate); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
928 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
929 "farsight-recv-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
930 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
931 GList *codecs; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
932 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
933 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
934 value = gst_structure_get_value(msg->structure, "codecs"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
935 codecs = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
936 codec = codecs->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
937 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
938 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
939 "farsight-recv-codecs-changed: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
940 codec->encoding_name); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
941 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
942 "farsight-component-state-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
943 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
944 FsStreamState fsstate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
945 guint component; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
946 const gchar *state; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
947 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
948 value = gst_structure_get_value(msg->structure, "state"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
949 fsstate = g_value_get_enum(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
950 value = gst_structure_get_value(msg->structure, "component"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
951 component = g_value_get_uint(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
952 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
953 switch (fsstate) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
954 case FS_STREAM_STATE_FAILED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
955 state = "FAILED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
956 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
957 case FS_STREAM_STATE_DISCONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
958 state = "DISCONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
959 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
960 case FS_STREAM_STATE_GATHERING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
961 state = "GATHERING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
962 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
963 case FS_STREAM_STATE_CONNECTING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
964 state = "CONNECTING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
965 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
966 case FS_STREAM_STATE_CONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
967 state = "CONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
968 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
969 case FS_STREAM_STATE_READY: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
970 state = "READY"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
971 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
972 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
973 state = "UNKNOWN"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
974 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
975 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
976 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
977 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
978 "farsight-component-state-changed: " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
979 "component: %u state: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
980 component, state); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
981 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
982 "farsight-send-codec-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
983 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
984 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
985 gchar *codec_str; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
986 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
987 value = gst_structure_get_value(msg->structure, "codec"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
988 codec = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
989 codec_str = fs_codec_to_string(codec); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
990 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
991 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
992 "farsight-send-codec-changed: codec: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
993 codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
994 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
995 g_free(codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
996 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
997 "farsight-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
998 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
999 FsSession *fssession; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1000 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1001 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1002 value = gst_structure_get_value(msg->structure, "session"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1003 fssession = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1004 sessions = g_hash_table_get_values(priv->sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1005 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1006 for (; sessions; sessions = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1007 g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1008 PurpleMediaBackendFs2Session *session = sessions->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1009 gchar *session_id; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1010 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1011 if (session->session != fssession) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1012 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1013 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1014 session_id = g_strdup(session->id); |
29555
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29554
diff
changeset
|
1015 g_signal_emit_by_name(self, "codecs-changed", |
cc978a1a4bd1
Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents:
29554
diff
changeset
|
1016 session_id); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1017 g_free(session_id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1018 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1019 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1020 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1021 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1022 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1023 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1024 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1025 gst_handle_message_error(GstBus *bus, GstMessage *msg, |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
1026 PurpleMediaBackendFs2 *self) |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1027 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1028 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1029 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1030 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1031 GstElement *lastElement = NULL; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1032 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1033 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1034 while (!GST_IS_PIPELINE(element)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1035 if (element == priv->confbin) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1036 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1037 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1038 lastElement = element; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1039 element = GST_ELEMENT_PARENT(element); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1040 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1041 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1042 if (!GST_IS_PIPELINE(element)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1043 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1044 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1045 sessions = purple_media_get_session_ids(priv->media); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1046 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1047 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1048 if (purple_media_get_src(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1049 != lastElement) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1050 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1051 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1052 if (purple_media_get_session_type(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1053 & PURPLE_MEDIA_AUDIO) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1054 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1055 _("Error with your microphone")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1056 else |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1057 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1058 _("Error with your webcam")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1059 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1060 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1061 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1062 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1063 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1064 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1065 purple_media_error(priv->media, _("Conference error")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1066 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1067 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1068 |
29540 | 1069 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1070 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self) |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1071 { |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1072 switch(GST_MESSAGE_TYPE(msg)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1073 case GST_MESSAGE_ELEMENT: |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1074 gst_handle_message_element(bus, msg, self); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1075 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1076 case GST_MESSAGE_ERROR: |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1077 gst_handle_message_error(bus, msg, self); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1078 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1079 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1080 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1081 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
1082 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1083 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1084 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1085 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1086 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1087 state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1088 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1089 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1090 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1091 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1092 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1093 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1094 gchar *sid, gchar *name, gboolean local, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1095 PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1096 { |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1097 if (type == PURPLE_MEDIA_INFO_ACCEPT && sid != NULL && name != NULL) { |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1098 PurpleMediaBackendFs2Stream *stream = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1099 get_stream(self, sid, name); |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1100 GError *err = NULL; |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1101 |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1102 g_object_set(G_OBJECT(stream->stream), "direction", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1103 session_type_to_fs_stream_direction( |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1104 stream->session->type), NULL); |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1105 |
29633
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1106 if (stream->remote_candidates == NULL || |
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1107 purple_media_is_initiator(media, sid, name)) |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1108 return; |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1109 |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1110 fs_stream_set_remote_candidates(stream->stream, |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1111 stream->remote_candidates, &err); |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1112 |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1113 if (err == NULL) |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1114 return; |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1115 |
29603
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1116 purple_debug_error("backend-fs2", "Error adding " |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1117 "remote candidates: %s\n", |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1118 err->message); |
d510b0324721
Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents:
29602
diff
changeset
|
1119 g_error_free(err); |
29587
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1120 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE || |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1121 type == PURPLE_MEDIA_INFO_UNMUTE)) { |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1122 PurpleMediaBackendFs2Private *priv = |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1123 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1124 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1125 GList *sessions; |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1126 |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1127 if (sid == NULL) |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1128 sessions = g_hash_table_get_values(priv->sessions); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1129 else |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1130 sessions = g_list_prepend(NULL, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1131 get_session(self, sid)); |
29587
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1132 |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1133 purple_debug_info("media", "Turning mute %s\n", |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1134 active ? "on" : "off"); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1135 |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1136 for (; sessions; sessions = g_list_delete_link( |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1137 sessions, sessions)) { |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1138 PurpleMediaBackendFs2Session *session = |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1139 sessions->data; |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1140 |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1141 if (session->type & PURPLE_MEDIA_SEND_AUDIO) { |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1142 gchar *name = g_strdup_printf("volume_%s", |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1143 session->id); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1144 GstElement *volume = gst_bin_get_by_name( |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1145 GST_BIN(priv->confbin), name); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1146 g_free(name); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1147 g_object_set(volume, "mute", active, NULL); |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1148 } |
bd6279df50de
Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents:
29585
diff
changeset
|
1149 } |
31523
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1150 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD || |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1151 type == PURPLE_MEDIA_INFO_UNHOLD)) { |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1152 gboolean active = (type == PURPLE_MEDIA_INFO_HOLD); |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1153 GList *streams = get_streams(self, sid, name); |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1154 for (; streams; streams = |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1155 g_list_delete_link(streams, streams)) { |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1156 PurpleMediaBackendFs2Stream *stream = streams->data; |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1157 if (stream->session->type & PURPLE_MEDIA_SEND_AUDIO) { |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1158 g_object_set(stream->stream, "direction", |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1159 session_type_to_fs_stream_direction( |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1160 stream->session->type & ((active) ? |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1161 ~PURPLE_MEDIA_SEND_AUDIO : |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1162 PURPLE_MEDIA_AUDIO)), NULL); |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1163 } |
a202f4dcbb96
Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents:
30961
diff
changeset
|
1164 } |
29578
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1165 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE || |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1166 type == PURPLE_MEDIA_INFO_UNPAUSE)) { |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1167 gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE); |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1168 GList *streams = get_streams(self, sid, name); |
29578
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1169 for (; streams; streams = |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1170 g_list_delete_link(streams, streams)) { |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1171 PurpleMediaBackendFs2Stream *stream = streams->data; |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1172 if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) { |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1173 g_object_set(stream->stream, "direction", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1174 session_type_to_fs_stream_direction( |
29578
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1175 stream->session->type & ((active) ? |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1176 ~PURPLE_MEDIA_SEND_VIDEO : |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1177 PURPLE_MEDIA_VIDEO)), NULL); |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1178 } |
dfc724880907
Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29577
diff
changeset
|
1179 } |
29576
a27e41f373db
Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents:
29575
diff
changeset
|
1180 } |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1181 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1182 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1183 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1184 init_conference(PurpleMediaBackendFs2 *self) |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1185 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1186 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1187 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1188 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1189 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1190 gchar *name; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1191 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1192 priv->conference = FS_CONFERENCE( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1193 gst_element_factory_make(priv->conference_type, NULL)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1194 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1195 if (priv->conference == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1196 purple_debug_error("backend-fs2", "Conference == NULL\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1197 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1198 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1199 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1200 pipeline = purple_media_manager_get_pipeline( |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1201 purple_media_get_manager(priv->media)); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1202 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1203 if (pipeline == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1204 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1205 "Couldn't retrieve pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1206 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1207 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1208 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1209 name = g_strdup_printf("conf_%p", priv->conference); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1210 priv->confbin = gst_bin_new(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1211 if (priv->confbin == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1212 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1213 "Couldn't create confbin.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1214 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1215 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1216 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1217 g_free(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1218 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1219 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1220 if (bus == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1221 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1222 "Couldn't get the pipeline's bus.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1223 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1224 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1225 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1226 g_signal_connect(G_OBJECT(bus), "message", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1227 G_CALLBACK(gst_bus_cb), self); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1228 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1229 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1230 if (!gst_bin_add(GST_BIN(pipeline), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1231 GST_ELEMENT(priv->confbin))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1232 purple_debug_error("backend-fs2", "Couldn't add confbin " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1233 "element to the pipeline\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1234 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1235 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1236 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1237 if (!gst_bin_add(GST_BIN(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1238 GST_ELEMENT(priv->conference))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1239 purple_debug_error("backend-fs2", "Couldn't add conference " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1240 "element to the confbin\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1241 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1242 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1243 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1244 if (gst_element_set_state(GST_ELEMENT(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1245 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1246 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1247 "Failed to start conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1248 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1249 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1250 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1251 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1252 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1253 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1254 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1255 gst_element_added_cb(FsElementAddedNotifier *self, |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1256 GstBin *bin, GstElement *element, gpointer user_data) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1257 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1258 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1259 * Hack to make H264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1260 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1261 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1262 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1263 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1264 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1265 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1266 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1267 create_src(PurpleMediaBackendFs2 *self, const gchar *sess_id, |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1268 PurpleMediaSessionType type) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1269 { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1270 PurpleMediaBackendFs2Private *priv = |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1271 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1272 PurpleMediaBackendFs2Session *session; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1273 PurpleMediaSessionType session_type; |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1274 FsMediaType media_type = session_type_to_fs_media_type(type); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1275 FsStreamDirection type_direction = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1276 session_type_to_fs_stream_direction(type); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1277 GstElement *src; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1278 GstPad *sinkpad, *srcpad; |
31553 | 1279 GstPad *ghost = NULL; |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1280 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1281 if ((type_direction & FS_DIRECTION_SEND) == 0) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1282 return TRUE; |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1283 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1284 session_type = session_type_from_fs( |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1285 media_type, FS_DIRECTION_SEND); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1286 src = purple_media_manager_get_element( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1287 purple_media_get_manager(priv->media), |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1288 session_type, priv->media, sess_id, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1289 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1290 if (!GST_IS_ELEMENT(src)) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1291 purple_debug_error("backend-fs2", |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1292 "Error creating src for session %s\n", |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1293 sess_id); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1294 return FALSE; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1295 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1296 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1297 session = get_session(self, sess_id); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1298 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1299 if (session == NULL) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1300 purple_debug_warning("backend-fs2", |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1301 "purple_media_set_src: trying to set" |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1302 " src on non-existent session\n"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1303 return FALSE; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1304 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1305 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1306 if (session->src) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1307 gst_object_unref(session->src); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1308 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1309 session->src = src; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1310 gst_element_set_locked_state(session->src, TRUE); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1311 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1312 session->tee = gst_element_factory_make("tee", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1313 gst_bin_add(GST_BIN(priv->confbin), session->tee); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1314 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1315 /* This supposedly isn't necessary, but it silences some warnings */ |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1316 if (GST_ELEMENT_PARENT(priv->confbin) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1317 == GST_ELEMENT_PARENT(session->src)) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1318 GstPad *pad = gst_element_get_static_pad(session->tee, "sink"); |
31553 | 1319 ghost = gst_ghost_pad_new(NULL, pad); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1320 gst_object_unref(pad); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1321 gst_pad_set_active(ghost, TRUE); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1322 gst_element_add_pad(priv->confbin, ghost); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1323 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1324 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1325 gst_element_set_state(session->tee, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1326 gst_element_link(session->src, priv->confbin); |
31553 | 1327 if (ghost) |
1328 session->srcpad = gst_pad_get_peer(ghost); | |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1329 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1330 g_object_get(session->session, "sink-pad", &sinkpad, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1331 if (session->type & PURPLE_MEDIA_SEND_AUDIO) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1332 gchar *name = g_strdup_printf("volume_%s", session->id); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1333 GstElement *level; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1334 GstElement *volume = gst_element_factory_make("volume", name); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1335 double input_volume = purple_prefs_get_int( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1336 "/purple/media/audio/volume/input")/10.0; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1337 g_free(name); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1338 name = g_strdup_printf("sendlevel_%s", session->id); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1339 level = gst_element_factory_make("level", name); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1340 g_free(name); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1341 gst_bin_add(GST_BIN(priv->confbin), volume); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1342 gst_bin_add(GST_BIN(priv->confbin), level); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1343 gst_element_set_state(level, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1344 gst_element_set_state(volume, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1345 gst_element_link(volume, level); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1346 gst_element_link(session->tee, volume); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1347 srcpad = gst_element_get_static_pad(level, "src"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1348 g_object_set(volume, "volume", input_volume, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1349 } else { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1350 srcpad = gst_element_get_request_pad(session->tee, "src%d"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1351 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1352 |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1353 purple_debug_info("backend-fs2", "connecting pad: %s\n", |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1354 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1355 ? "success" : "failure"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1356 gst_element_set_locked_state(session->src, FALSE); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1357 gst_object_unref(session->src); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1358 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1359 gst_element_set_state(session->src, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1360 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1361 purple_media_manager_create_output_window(purple_media_get_manager( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1362 priv->media), priv->media, sess_id, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1363 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1364 return TRUE; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1365 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1366 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1367 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1368 create_session(PurpleMediaBackendFs2 *self, const gchar *sess_id, |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1369 PurpleMediaSessionType type, gboolean initiator, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1370 const gchar *transmitter) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1371 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1372 PurpleMediaBackendFs2Private *priv = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1373 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1374 PurpleMediaBackendFs2Session *session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1375 GError *err = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1376 GList *codec_conf = NULL, *iter = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1377 gchar *filename = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1378 gboolean is_nice = !strcmp(transmitter, "nice"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1379 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1380 session = g_new0(PurpleMediaBackendFs2Session, 1); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1381 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1382 session->session = fs_conference_new_session(priv->conference, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1383 session_type_to_fs_media_type(type), &err); |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1384 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1385 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1386 purple_media_error(priv->media, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1387 _("Error creating session: %s"), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1388 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1389 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1390 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1391 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1392 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1393 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1394 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1395 codec_conf = fs_codec_list_from_keyfile(filename, &err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1396 g_free(filename); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1397 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1398 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1399 if (err->code == 4) |
29564 | 1400 purple_debug_info("backend-fs2", "Couldn't read " |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1401 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1402 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1403 else |
29564 | 1404 purple_debug_error("backend-fs2", "Error reading " |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1405 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1406 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1407 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1408 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1409 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1410 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1411 * Add SPEEX if the configuration file doesn't exist or |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1412 * there isn't a speex entry. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1413 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1414 for (iter = codec_conf; iter; iter = g_list_next(iter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1415 FsCodec *codec = iter->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1416 if (!g_ascii_strcasecmp(codec->encoding_name, "speex")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1417 break; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1418 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1419 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1420 if (iter == NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1421 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1422 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1423 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1424 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1425 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1426 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1427 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1428 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1429 fs_session_set_codec_preferences(session->session, codec_conf, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1430 fs_codec_list_destroy(codec_conf); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1431 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1432 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1433 * Removes a 5-7 second delay before |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1434 * receiving the src-pad-added signal. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1435 * Only works for non-multicast FsRtpSessions. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1436 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1437 if (is_nice || !strcmp(transmitter, "rawudp")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1438 g_object_set(G_OBJECT(session->session), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1439 "no-rtcp-timeout", 0, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1440 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1441 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1442 * Hack to make x264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1443 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1444 if (is_nice && !strcmp(sess_id, "google-video")) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1445 FsElementAddedNotifier *notifier = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1446 fs_element_added_notifier_new(); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1447 g_signal_connect(G_OBJECT(notifier), "element-added", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1448 G_CALLBACK(gst_element_added_cb), NULL); |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1449 fs_element_added_notifier_add(notifier, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1450 GST_BIN(priv->conference)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1451 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1452 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1453 session->id = g_strdup(sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1454 session->backend = self; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1455 session->type = type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1456 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1457 if (!priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1458 purple_debug_info("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1459 "Creating hash table for sessions\n"); |
30872 | 1460 priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal, |
1461 g_free, NULL); | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1462 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1463 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1464 g_hash_table_insert(priv->sessions, g_strdup(session->id), session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1465 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1466 if (!create_src(self, sess_id, type)) { |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1467 purple_debug_info("backend-fs2", "Error creating the src\n"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1468 return FALSE; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1469 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1470 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1471 return TRUE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1472 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1473 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1474 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1475 create_participant(PurpleMediaBackendFs2 *self, const gchar *name) |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1476 { |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1477 PurpleMediaBackendFs2Private *priv = |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1478 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1479 FsParticipant *participant; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1480 GError *err = NULL; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1481 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1482 participant = fs_conference_new_participant( |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1483 priv->conference, name, &err); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1484 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1485 if (err) { |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1486 purple_debug_error("backend-fs2", |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1487 "Error creating participant: %s\n", |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1488 err->message); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1489 g_error_free(err); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1490 return FALSE; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1491 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1492 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1493 if (!priv->participants) { |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1494 purple_debug_info("backend-fs2", |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1495 "Creating hash table for participants\n"); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1496 priv->participants = g_hash_table_new_full(g_str_hash, |
30872 | 1497 g_str_equal, g_free, g_object_unref); |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1498 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1499 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1500 g_hash_table_insert(priv->participants, g_strdup(name), participant); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1501 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1502 return TRUE; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1503 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1504 |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1505 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1506 src_pad_added_cb_cb(PurpleMediaBackendFs2Stream *stream) |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1507 { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1508 PurpleMediaBackendFs2Private *priv; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1509 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1510 g_return_val_if_fail(stream != NULL, FALSE); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1511 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1512 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1513 stream->connected_cb_id = 0; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1514 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1515 purple_media_manager_create_output_window( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1516 purple_media_get_manager(priv->media), priv->media, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1517 stream->session->id, stream->participant); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1518 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1519 g_signal_emit_by_name(priv->media, "state-changed", |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1520 PURPLE_MEDIA_STATE_CONNECTED, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1521 stream->session->id, stream->participant); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1522 return FALSE; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1523 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1524 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1525 static void |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1526 src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1527 FsCodec *codec, PurpleMediaBackendFs2Stream *stream) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1528 { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1529 PurpleMediaBackendFs2Private *priv; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1530 GstPad *sinkpad; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1531 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1532 g_return_if_fail(FS_IS_STREAM(fsstream)); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1533 g_return_if_fail(stream != NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1534 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1535 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1536 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1537 if (stream->src == NULL) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1538 GstElement *sink = NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1539 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1540 if (codec->media_type == FS_MEDIA_TYPE_AUDIO) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1541 GstElement *queue = NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1542 double output_volume = purple_prefs_get_int( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1543 "/purple/media/audio/volume/output")/10.0; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1544 /* |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1545 * Should this instead be: |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1546 * audioconvert ! audioresample ! liveadder ! |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1547 * audioresample ! audioconvert ! realsink |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1548 */ |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1549 queue = gst_element_factory_make("queue", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1550 stream->volume = gst_element_factory_make( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1551 "volume", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1552 g_object_set(stream->volume, "volume", |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1553 output_volume, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1554 stream->level = gst_element_factory_make( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1555 "level", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1556 stream->src = gst_element_factory_make( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1557 "liveadder", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1558 sink = purple_media_manager_get_element( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1559 purple_media_get_manager(priv->media), |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1560 PURPLE_MEDIA_RECV_AUDIO, priv->media, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1561 stream->session->id, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1562 stream->participant); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1563 gst_bin_add(GST_BIN(priv->confbin), queue); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1564 gst_bin_add(GST_BIN(priv->confbin), stream->volume); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1565 gst_bin_add(GST_BIN(priv->confbin), stream->level); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1566 gst_bin_add(GST_BIN(priv->confbin), sink); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1567 gst_element_set_state(sink, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1568 gst_element_set_state(stream->level, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1569 gst_element_set_state(stream->volume, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1570 gst_element_set_state(queue, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1571 gst_element_link(stream->level, sink); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1572 gst_element_link(stream->volume, stream->level); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1573 gst_element_link(queue, stream->volume); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1574 sink = queue; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1575 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1576 stream->src = gst_element_factory_make( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1577 "fsfunnel", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1578 sink = gst_element_factory_make( |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1579 "fakesink", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1580 g_object_set(G_OBJECT(sink), "async", FALSE, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1581 gst_bin_add(GST_BIN(priv->confbin), sink); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1582 gst_element_set_state(sink, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1583 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1584 stream->tee = gst_element_factory_make("tee", NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1585 gst_bin_add_many(GST_BIN(priv->confbin), |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1586 stream->src, stream->tee, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1587 gst_element_set_state(stream->tee, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1588 gst_element_set_state(stream->src, GST_STATE_PLAYING); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1589 gst_element_link_many(stream->src, stream->tee, sink, NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1590 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1591 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1592 sinkpad = gst_element_get_request_pad(stream->src, "sink%d"); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1593 gst_pad_link(srcpad, sinkpad); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1594 gst_object_unref(sinkpad); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1595 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1596 stream->connected_cb_id = purple_timeout_add(0, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1597 (GSourceFunc)src_pad_added_cb_cb, stream); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1598 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1599 |
30875
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1600 static GValueArray * |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1601 append_relay_info(GValueArray *relay_info, const gchar *ip, gint port, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1602 const gchar *username, const gchar *password, const gchar *type) |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1603 { |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1604 GValue value; |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1605 GstStructure *turn_setup = gst_structure_new("relay-info", |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1606 "ip", G_TYPE_STRING, ip, |
30875
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1607 "port", G_TYPE_UINT, port, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1608 "username", G_TYPE_STRING, username, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1609 "password", G_TYPE_STRING, password, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1610 "relay-type", G_TYPE_STRING, type, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1611 NULL); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1612 |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1613 if (turn_setup) { |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1614 memset(&value, 0, sizeof(GValue)); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1615 g_value_init(&value, GST_TYPE_STRUCTURE); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1616 gst_value_set_structure(&value, turn_setup); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1617 relay_info = g_value_array_append(relay_info, &value); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1618 gst_structure_free(turn_setup); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1619 } |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1620 |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1621 return relay_info; |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1622 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1623 |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1624 static gboolean |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1625 create_stream(PurpleMediaBackendFs2 *self, |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1626 const gchar *sess_id, const gchar *who, |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1627 PurpleMediaSessionType type, gboolean initiator, |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1628 const gchar *transmitter, |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1629 guint num_params, GParameter *params) |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1630 { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1631 PurpleMediaBackendFs2Private *priv = |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1632 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1633 GError *err = NULL; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1634 FsStream *fsstream = NULL; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1635 const gchar *stun_ip = purple_network_get_stun_ip(); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1636 const gchar *turn_ip = purple_network_get_turn_ip(); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1637 guint _num_params = num_params; |
29744
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1638 GParameter *_params = g_new0(GParameter, num_params + 3); |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1639 FsStreamDirection type_direction = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1640 session_type_to_fs_stream_direction(type); |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1641 PurpleMediaBackendFs2Session *session; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1642 PurpleMediaBackendFs2Stream *stream; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1643 FsParticipant *participant; |
30958
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1644 /* check if the prpl has already specified a relay-info |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1645 we need to do this to allow them to override when using non-standard |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1646 TURN modes, like Google f.ex. */ |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1647 gboolean got_turn_from_prpl = FALSE; |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1648 int i; |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1649 |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1650 for (i = 0 ; i < num_params ; i++) { |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1651 if (purple_strequal(params[i].name, "relay-info")) { |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1652 got_turn_from_prpl = TRUE; |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1653 break; |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1654 } |
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1655 } |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1656 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1657 memcpy(_params, params, sizeof(GParameter) * num_params); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1658 |
29744
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1659 /* set the controlling mode parameter */ |
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1660 _params[_num_params].name = "controlling-mode"; |
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1661 g_value_init(&_params[_num_params].value, G_TYPE_BOOLEAN); |
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1662 g_value_set_boolean(&_params[_num_params].value, initiator); |
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1663 ++_num_params; |
1876a447db11
media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents:
29719
diff
changeset
|
1664 |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1665 if (stun_ip) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1666 purple_debug_info("backend-fs2", |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1667 "Setting stun-ip on new stream: %s\n", stun_ip); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1668 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1669 _params[_num_params].name = "stun-ip"; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1670 g_value_init(&_params[_num_params].value, G_TYPE_STRING); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1671 g_value_set_string(&_params[_num_params].value, stun_ip); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1672 ++_num_params; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1673 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1674 |
30958
3d08b59ebf59
Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1675 if (turn_ip && !strcmp("nice", transmitter) && !got_turn_from_prpl) { |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1676 GValueArray *relay_info = g_value_array_new(0); |
30875
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1677 gint port; |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1678 const gchar *username = purple_prefs_get_string( |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1679 "/purple/network/turn_username"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1680 const gchar *password = purple_prefs_get_string( |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1681 "/purple/network/turn_password"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1682 |
30875
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1683 /* UDP */ |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1684 port = purple_prefs_get_int("/purple/network/turn_port"); |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1685 if (port > 0) { |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1686 relay_info = append_relay_info(relay_info, turn_ip, port, username, |
603638fad2f1
Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents:
30600
diff
changeset
|
1687 password, "udp"); |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1688 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1689 |
30902
195d034b6cfe
Removed the TCP and TLS TURN relaying options since libnice currently only supports these in Google mode. Added a note about this in fs-backend.c and changed the prefs label to read "UDP Port"
Marcus Lundblad <ml@update.uu.se>
parents:
30877
diff
changeset
|
1690 /* should add TCP and perhaps TLS relaying options when these are |
195d034b6cfe
Removed the TCP and TLS TURN relaying options since libnice currently only supports these in Google mode. Added a note about this in fs-backend.c and changed the prefs label to read "UDP Port"
Marcus Lundblad <ml@update.uu.se>
parents:
30877
diff
changeset
|
1691 supported by libnice using non-google mode */ |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1692 |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1693 purple_debug_info("backend-fs2", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1694 "Setting relay-info on new stream\n"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1695 _params[_num_params].name = "relay-info"; |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31523
diff
changeset
|
1696 g_value_init(&_params[_num_params].value, |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1697 G_TYPE_VALUE_ARRAY); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1698 g_value_set_boxed(&_params[_num_params].value, |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1699 relay_info); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1700 g_value_array_free(relay_info); |
30600
8cb39e235f39
media: Fix the TURN server setting to actually work again (it was apparently
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
1701 _num_params++; |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1702 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1703 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1704 session = get_session(self, sess_id); |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1705 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1706 if (session == NULL) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1707 purple_debug_error("backend-fs2", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1708 "Couldn't find session to create stream.\n"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1709 return FALSE; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1710 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1711 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1712 participant = get_participant(self, who); |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1713 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1714 if (participant == NULL) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1715 purple_debug_error("backend-fs2", "Couldn't find " |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1716 "participant to create stream.\n"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1717 return FALSE; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1718 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1719 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1720 fsstream = fs_session_new_stream(session->session, participant, |
29633
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1721 initiator == TRUE ? type_direction : |
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1722 (type_direction & FS_DIRECTION_RECV), transmitter, |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1723 _num_params, _params, &err); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1724 g_free(_params); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1725 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1726 if (fsstream == NULL) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1727 if (err) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1728 purple_debug_error("backend-fs2", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1729 "Error creating stream: %s\n", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1730 err && err->message ? |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1731 err->message : "NULL"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1732 g_error_free(err); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1733 } else |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1734 purple_debug_error("backend-fs2", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1735 "Error creating stream\n"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1736 return FALSE; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1737 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1738 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1739 stream = g_new0(PurpleMediaBackendFs2Stream, 1); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1740 stream->participant = g_strdup(who); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1741 stream->session = session; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1742 stream->stream = fsstream; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1743 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1744 priv->streams = g_list_append(priv->streams, stream); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1745 |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1746 g_signal_connect(G_OBJECT(fsstream), "src-pad-added", |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1747 G_CALLBACK(src_pad_added_cb), stream); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
1748 |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1749 return TRUE; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1750 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1751 |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1752 static gboolean |
29540 | 1753 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
1754 const gchar *sess_id, const gchar *who, | |
1755 PurpleMediaSessionType type, gboolean initiator, | |
1756 const gchar *transmitter, | |
1757 guint num_params, GParameter *params) | |
1758 { | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1759 PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1760 PurpleMediaBackendFs2Private *priv = |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1761 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend); |
29579
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1762 PurpleMediaBackendFs2Stream *stream; |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1763 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1764 if (priv->conference == NULL && !init_conference(backend)) { |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1765 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1766 "Error initializing the conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1767 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1768 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1769 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1770 if (get_session(backend, sess_id) == NULL && |
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1771 !create_session(backend, sess_id, type, |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1772 initiator, transmitter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1773 purple_debug_error("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1774 "Error creating the session.\n"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1775 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1776 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1777 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1778 if (get_participant(backend, who) == NULL && |
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1779 !create_participant(backend, who)) { |
29563
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1780 purple_debug_error("backend-fs2", |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1781 "Error creating the participant.\n"); |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1782 return FALSE; |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1783 } |
98a1b62a0f7e
Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents:
29557
diff
changeset
|
1784 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1785 stream = get_stream(backend, sess_id, who); |
29579
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1786 |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1787 if (stream != NULL) { |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1788 FsStreamDirection type_direction = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1789 session_type_to_fs_stream_direction(type); |
29579
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1790 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1791 if (session_type_to_fs_stream_direction( |
29579
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1792 stream->session->type) != type_direction) { |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1793 /* change direction */ |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1794 g_object_set(stream->stream, "direction", |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1795 type_direction, NULL); |
f65689100cfe
Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29578
diff
changeset
|
1796 } |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1797 } else if (!create_stream(backend, sess_id, who, type, |
29566
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1798 initiator, transmitter, num_params, params)) { |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1799 purple_debug_error("backend-fs2", |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1800 "Error creating the stream.\n"); |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1801 return FALSE; |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1802 } |
f600903f7811
Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents:
29564
diff
changeset
|
1803 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
1804 return TRUE; |
29540 | 1805 } |
1806 | |
1807 static void | |
1808 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self, | |
1809 const gchar *sess_id, const gchar *participant, | |
1810 GList *remote_candidates) | |
1811 { | |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1812 PurpleMediaBackendFs2Private *priv; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1813 PurpleMediaBackendFs2Stream *stream; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1814 GError *err = NULL; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1815 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1816 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self)); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1817 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1818 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1819 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self), |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1820 sess_id, participant); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1821 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1822 if (stream == NULL) { |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1823 purple_debug_error("backend-fs2", |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1824 "purple_media_add_remote_candidates: " |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1825 "couldn't find stream %s %s.\n", |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1826 sess_id ? sess_id : "(null)", |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1827 participant ? participant : "(null)"); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1828 return; |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1829 } |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1830 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1831 stream->remote_candidates = g_list_concat(stream->remote_candidates, |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1832 candidate_list_to_fs(remote_candidates)); |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1833 |
29633
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1834 if (purple_media_is_initiator(priv->media, sess_id, participant) || |
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1835 purple_media_accepted( |
9da83d5f48c3
Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents:
29607
diff
changeset
|
1836 priv->media, sess_id, participant)) { |
29567
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1837 fs_stream_set_remote_candidates(stream->stream, |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1838 stream->remote_candidates, &err); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1839 |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1840 if (err) { |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1841 purple_debug_error("backend-fs2", "Error adding remote" |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1842 " candidates: %s\n", err->message); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1843 g_error_free(err); |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1844 } |
983af0970bb2
Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents:
29566
diff
changeset
|
1845 } |
29540 | 1846 } |
1847 | |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1848 static gboolean |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1849 purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1850 const gchar *sess_id) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1851 { |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1852 PurpleMediaBackendFs2Private *priv; |
30847
77449a80fef2
Fix a possible Garbage return value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30600
diff
changeset
|
1853 gboolean ret = FALSE; |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1854 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1855 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1856 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1857 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1858 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1859 if (sess_id != NULL) { |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1860 PurpleMediaBackendFs2Session *session = get_session( |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1861 PURPLE_MEDIA_BACKEND_FS2(self), sess_id); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1862 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1863 if (session == NULL) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1864 return FALSE; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1865 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1866 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1867 PURPLE_MEDIA_SEND_VIDEO)) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1868 g_object_get(session->session, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1869 "codecs-ready", &ret, NULL); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1870 else |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1871 ret = TRUE; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1872 } else { |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1873 GList *values = g_hash_table_get_values(priv->sessions); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1874 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1875 for (; values; values = g_list_delete_link(values, values)) { |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1876 PurpleMediaBackendFs2Session *session = values->data; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1877 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1878 PURPLE_MEDIA_SEND_VIDEO)) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1879 g_object_get(session->session, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1880 "codecs-ready", &ret, NULL); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1881 else |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1882 ret = TRUE; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1883 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1884 if (ret == FALSE) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1885 break; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1886 } |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1887 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1888 if (values != NULL) |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1889 g_list_free(values); |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1890 } |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1891 |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1892 return ret; |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1893 } |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29579
diff
changeset
|
1894 |
29540 | 1895 static GList * |
1896 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
1897 const gchar *sess_id) | |
1898 { | |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1899 PurpleMediaBackendFs2Session *session; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1900 GList *fscodecs; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1901 GList *codecs; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1902 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1903 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1904 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1905 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id); |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1906 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1907 if (session == NULL) |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1908 return NULL; |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1909 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1910 g_object_get(G_OBJECT(session->session), |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1911 "codecs", &fscodecs, NULL); |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1912 codecs = codec_list_from_fs(fscodecs); |
29569
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1913 fs_codec_list_destroy(fscodecs); |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1914 |
9c1810122f21
Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29567
diff
changeset
|
1915 return codecs; |
29540 | 1916 } |
1917 | |
1918 static GList * | |
1919 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self, | |
1920 const gchar *sess_id, const gchar *participant) | |
1921 { | |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1922 PurpleMediaBackendFs2Stream *stream; |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1923 GList *candidates = NULL; |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1924 |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1925 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1926 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1927 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self), |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1928 sess_id, participant); |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1929 |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1930 if (stream != NULL) |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1931 candidates = candidate_list_from_fs( |
29571
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1932 stream->local_candidates); |
f0966e90ec44
Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents:
29570
diff
changeset
|
1933 return candidates; |
29540 | 1934 } |
1935 | |
29572
a7cad99144f0
Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents:
29571
diff
changeset
|
1936 static gboolean |
29540 | 1937 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, |
1938 const gchar *sess_id, const gchar *participant, | |
1939 GList *codecs) | |
1940 { | |
29573
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1941 PurpleMediaBackendFs2Stream *stream; |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1942 GList *fscodecs; |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1943 GError *err = NULL; |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1944 |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1945 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE); |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1946 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self), |
29573
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1947 sess_id, participant); |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1948 |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1949 if (stream == NULL) |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1950 return FALSE; |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1951 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1952 fscodecs = codec_list_to_fs(codecs); |
29573
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1953 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err); |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1954 fs_codec_list_destroy(fscodecs); |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1955 |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1956 if (err) { |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1957 purple_debug_error("backend-fs2", |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1958 "Error setting remote codecs: %s\n", |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1959 err->message); |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1960 g_error_free(err); |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1961 return FALSE; |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1962 } |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1963 |
a39696686dd6
Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29572
diff
changeset
|
1964 return TRUE; |
29540 | 1965 } |
1966 | |
29574
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29573
diff
changeset
|
1967 static gboolean |
29540 | 1968 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, |
1969 const gchar *sess_id, PurpleMediaCodec *codec) | |
1970 { | |
29575
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1971 PurpleMediaBackendFs2Session *session; |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1972 FsCodec *fscodec; |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1973 GError *err = NULL; |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1974 |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1975 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE); |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1976 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1977 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id); |
29575
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1978 |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1979 if (session == NULL) |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1980 return FALSE; |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1981 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
1982 fscodec = codec_to_fs(codec); |
29575
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1983 fs_session_set_send_codec(session->session, fscodec, &err); |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1984 fs_codec_destroy(fscodec); |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1985 |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1986 if (err) { |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1987 purple_debug_error("media", "Error setting send codec\n"); |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1988 g_error_free(err); |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1989 return FALSE; |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1990 } |
ec5ed142f551
Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29574
diff
changeset
|
1991 |
29574
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29573
diff
changeset
|
1992 return TRUE; |
29540 | 1993 } |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1994 #else |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1995 GType |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1996 purple_media_backend_fs2_get_type(void) |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1997 { |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1998 return G_TYPE_NONE; |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
1999 } |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2000 #endif /* USE_VV */ |
29540 | 2001 |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2002 #ifdef USE_GSTREAMER |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2003 GstElement * |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2004 purple_media_backend_fs2_get_src(PurpleMediaBackendFs2 *self, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2005 const gchar *sess_id) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2006 { |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2007 #ifdef USE_VV |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
2008 PurpleMediaBackendFs2Session *session = get_session(self, sess_id); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2009 return session != NULL ? session->src : NULL; |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2010 #else |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2011 return NULL; |
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2012 #endif |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2013 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2014 |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2015 GstElement * |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2016 purple_media_backend_fs2_get_tee(PurpleMediaBackendFs2 *self, |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2017 const gchar *sess_id, const gchar *who) |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2018 { |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2019 #ifdef USE_VV |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2020 if (sess_id != NULL && who == NULL) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2021 PurpleMediaBackendFs2Session *session = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
2022 get_session(self, sess_id); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2023 return (session != NULL) ? session->tee : NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2024 } else if (sess_id != NULL && who != NULL) { |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2025 PurpleMediaBackendFs2Stream *stream = |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
2026 get_stream(self, sess_id, who); |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2027 return (stream != NULL) ? stream->tee : NULL; |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2028 } |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2029 |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2030 #endif /* USE_VV */ |
29583
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2031 g_return_val_if_reached(NULL); |
eadb9e309b87
Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents:
29582
diff
changeset
|
2032 } |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2033 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2034 void |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2035 purple_media_backend_fs2_set_input_volume(PurpleMediaBackendFs2 *self, |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2036 const gchar *sess_id, double level) |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2037 { |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2038 #ifdef USE_VV |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2039 PurpleMediaBackendFs2Private *priv; |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2040 GList *sessions; |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2041 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2042 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self)); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2043 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2044 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2045 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2046 purple_prefs_set_int("/purple/media/audio/volume/input", level); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2047 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2048 if (sess_id == NULL) |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2049 sessions = g_hash_table_get_values(priv->sessions); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2050 else |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
2051 sessions = g_list_append(NULL, get_session(self, sess_id)); |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2052 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2053 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2054 PurpleMediaBackendFs2Session *session = sessions->data; |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2055 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2056 if (session->type & PURPLE_MEDIA_SEND_AUDIO) { |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2057 gchar *name = g_strdup_printf("volume_%s", |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2058 session->id); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2059 GstElement *volume = gst_bin_get_by_name( |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2060 GST_BIN(priv->confbin), name); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2061 g_free(name); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2062 g_object_set(volume, "volume", level/10.0, NULL); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2063 } |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2064 } |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2065 #endif /* USE_VV */ |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2066 } |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2067 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2068 void |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2069 purple_media_backend_fs2_set_output_volume(PurpleMediaBackendFs2 *self, |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2070 const gchar *sess_id, const gchar *who, double level) |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2071 { |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2072 #ifdef USE_VV |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2073 GList *streams; |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2074 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2075 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self)); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2076 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2077 purple_prefs_set_int("/purple/media/audio/volume/output", level); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2078 |
29607
85a7a93cd19a
Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents:
29603
diff
changeset
|
2079 streams = get_streams(self, sess_id, who); |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2080 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2081 for (; streams; streams = g_list_delete_link(streams, streams)) { |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2082 PurpleMediaBackendFs2Stream *stream = streams->data; |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2083 |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2084 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2085 && GST_IS_ELEMENT(stream->volume)) { |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2086 g_object_set(stream->volume, "volume", |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2087 level/10.0, NULL); |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2088 } |
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2089 } |
29714
bd7159aeabc0
Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents:
29633
diff
changeset
|
2090 #endif /* USE_VV */ |
29585
95f918df7f09
Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents:
29584
diff
changeset
|
2091 } |
29719
858d1a47bf83
Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29714
diff
changeset
|
2092 #endif /* USE_GSTREAMER */ |