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