Mercurial > pidgin.yaz
annotate libpurple/media/backend-fs2.c @ 29554:2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
author | maiku@pidgin.im |
---|---|
date | Fri, 23 Oct 2009 22:20:45 +0000 |
parents | efeb21092ed2 |
children | cc978a1a4bd1 |
rev | line source |
---|---|
29540 | 1 /** |
2 * @file backend-fs2.c Farsight 2 backend for media API | |
3 * @ingroup core | |
4 */ | |
5 | |
6 /* purple | |
7 * | |
8 * Purple is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
25 */ | |
26 | |
27 #include "backend-fs2.h" | |
28 | |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
29 #include "internal.h" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
30 |
29540 | 31 #include "backend-iface.h" |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
32 #include "debug.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
33 #include "media-gst.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
34 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
35 #include <gst/farsight/fs-conference-iface.h> |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
36 #include <gst/farsight/fs-element-added-notifier.h> |
29540 | 37 |
38 /** @copydoc _PurpleMediaBackendFs2Class */ | |
39 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class; | |
40 /** @copydoc _PurpleMediaBackendFs2Private */ | |
41 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private; | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
42 /** @copydoc _PurpleMediaBackendFs2Session */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
43 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session; |
29540 | 44 |
45 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \ | |
46 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ | |
47 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private)) | |
48 | |
49 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface); | |
50 | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
51 static gboolean |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
52 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
53 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
54 _state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
55 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
56 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
57 _stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
58 gchar *sid, gchar *name, gboolean local, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
59 PurpleMediaBackendFs2 *self); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
60 |
29540 | 61 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
62 const gchar *sess_id, const gchar *who, | |
63 PurpleMediaSessionType type, gboolean initiator, | |
64 const gchar *transmitter, | |
65 guint num_params, GParameter *params); | |
66 static void purple_media_backend_fs2_add_remote_candidates( | |
67 PurpleMediaBackend *self, | |
68 const gchar *sess_id, const gchar *participant, | |
69 GList *remote_candidates); | |
70 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
71 const gchar *sess_id); | |
72 static GList *purple_media_backend_fs2_get_local_candidates( | |
73 PurpleMediaBackend *self, | |
74 const gchar *sess_id, const gchar *participant); | |
75 static void purple_media_backend_fs2_set_remote_codecs( | |
76 PurpleMediaBackend *self, | |
77 const gchar *sess_id, const gchar *participant, | |
78 GList *codecs); | |
79 static void purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, | |
80 const gchar *sess_id, PurpleMediaCodec *codec); | |
81 | |
82 struct _PurpleMediaBackendFs2Class | |
83 { | |
84 GObjectClass parent_class; | |
85 }; | |
86 | |
87 struct _PurpleMediaBackendFs2 | |
88 { | |
89 GObject parent; | |
90 }; | |
91 | |
92 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2, | |
93 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE( | |
94 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init)); | |
95 | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
96 struct _PurpleMediaBackendFs2Session |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
97 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
98 PurpleMediaBackendFs2 *backend; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
99 gchar *id; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
100 gboolean initiator; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
101 FsSession *session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
102 PurpleMediaSessionType type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
103 }; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
104 |
29540 | 105 struct _PurpleMediaBackendFs2Private |
106 { | |
107 PurpleMedia *media; | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
108 GstElement *confbin; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
109 FsConference *conference; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
110 gchar *conference_type; |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
111 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
112 GHashTable *sessions; |
29540 | 113 }; |
114 | |
115 enum { | |
116 PROP_0, | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
117 PROP_CONFERENCE_TYPE, |
29540 | 118 PROP_MEDIA, |
119 }; | |
120 | |
121 static void | |
122 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self) | |
123 { | |
124 } | |
125 | |
126 static void | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
127 purple_media_backend_fs2_dispose(GObject *obj) |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
128 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
129 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
130 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
131 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
132 purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n"); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
133 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
134 if (priv->confbin) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
135 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
136 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
137 pipeline = purple_media_manager_get_pipeline( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
138 purple_media_get_manager(priv->media)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
139 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
140 gst_element_set_locked_state(priv->confbin, TRUE); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
141 gst_element_set_state(GST_ELEMENT(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
142 GST_STATE_NULL); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
143 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
144 if (pipeline) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
145 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
146 gst_bin_remove(GST_BIN(pipeline), priv->confbin); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
147 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
148 g_signal_handlers_disconnect_matched(G_OBJECT(bus), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
149 G_SIGNAL_MATCH_FUNC | |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
150 G_SIGNAL_MATCH_DATA, |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
151 0, 0, 0, _gst_bus_cb, obj); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
152 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
153 } else { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
154 purple_debug_warning("backend-fs2", "Unable to " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
155 "properly dispose the conference. " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
156 "Couldn't get the pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
157 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
158 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
159 priv->confbin = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
160 priv->conference = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
161 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
162 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
163 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
164 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
165 GList *sessions = g_hash_table_get_values(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
166 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
167 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
168 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
169 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
170 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
171 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
172 if (session->session) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
173 g_object_unref(session->session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
174 session->session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
175 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
176 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
177 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
178 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
179 if (priv->media) { |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
180 g_object_remove_weak_pointer(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
181 (gpointer*)&priv->media); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
182 priv->media = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
183 } |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
184 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
185 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
186 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
187 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
188 static void |
29540 | 189 purple_media_backend_fs2_finalize(GObject *obj) |
190 { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
191 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
192 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
193 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
194 purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n"); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
195 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
196 g_free(priv->conference_type); |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
197 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
198 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
199 GList *sessions = g_hash_table_get_values(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
200 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
201 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
202 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
203 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
204 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
205 g_free(session->id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
206 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
207 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
208 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
209 g_hash_table_destroy(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
210 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
211 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
212 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj); |
29540 | 213 } |
214 | |
215 static void | |
216 purple_media_backend_fs2_set_property(GObject *object, guint prop_id, | |
217 const GValue *value, GParamSpec *pspec) | |
218 { | |
219 PurpleMediaBackendFs2Private *priv; | |
220 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
221 | |
222 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); | |
223 | |
224 switch (prop_id) { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
225 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
226 priv->conference_type = g_value_dup_string(value); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
227 break; |
29540 | 228 case PROP_MEDIA: |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
229 priv->media = g_value_get_object(value); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
230 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
231 if (priv->media == NULL) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
232 break; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
233 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
234 g_object_add_weak_pointer(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
235 (gpointer*)&priv->media); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
236 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
237 g_signal_connect(G_OBJECT(priv->media), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
238 "state-changed", |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
239 G_CALLBACK(_state_changed_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
240 PURPLE_MEDIA_BACKEND_FS2(object)); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
241 g_signal_connect(G_OBJECT(priv->media), "stream-info", |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
242 G_CALLBACK(_stream_info_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
243 PURPLE_MEDIA_BACKEND_FS2(object)); |
29540 | 244 break; |
245 default: | |
246 G_OBJECT_WARN_INVALID_PROPERTY_ID( | |
247 object, prop_id, pspec); | |
248 break; | |
249 } | |
250 } | |
251 | |
252 static void | |
253 purple_media_backend_fs2_get_property(GObject *object, guint prop_id, | |
254 GValue *value, GParamSpec *pspec) | |
255 { | |
256 PurpleMediaBackendFs2Private *priv; | |
257 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
258 | |
259 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); | |
260 | |
261 switch (prop_id) { | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
262 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
263 g_value_set_string(value, priv->conference_type); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
264 break; |
29540 | 265 case PROP_MEDIA: |
266 g_value_set_object(value, priv->media); | |
267 break; | |
268 default: | |
269 G_OBJECT_WARN_INVALID_PROPERTY_ID( | |
270 object, prop_id, pspec); | |
271 break; | |
272 } | |
273 } | |
274 | |
275 static void | |
276 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass) | |
277 { | |
278 GObjectClass *gobject_class = (GObjectClass*)klass; | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
279 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
280 gobject_class->dispose = purple_media_backend_fs2_dispose; |
29540 | 281 gobject_class->finalize = purple_media_backend_fs2_finalize; |
282 gobject_class->set_property = purple_media_backend_fs2_set_property; | |
283 gobject_class->get_property = purple_media_backend_fs2_get_property; | |
284 | |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
285 g_object_class_override_property(gobject_class, PROP_CONFERENCE_TYPE, |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
286 "conference-type"); |
29540 | 287 g_object_class_override_property(gobject_class, PROP_MEDIA, "media"); |
288 | |
289 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private)); | |
290 } | |
291 | |
292 static void | |
293 purple_media_backend_iface_init(PurpleMediaBackendIface *iface) | |
294 { | |
295 iface->add_stream = purple_media_backend_fs2_add_stream; | |
296 iface->add_remote_candidates = | |
297 purple_media_backend_fs2_add_remote_candidates; | |
298 iface->get_codecs = purple_media_backend_fs2_get_codecs; | |
299 iface->get_local_candidates = | |
300 purple_media_backend_fs2_get_local_candidates; | |
301 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs; | |
302 iface->set_send_codec = purple_media_backend_fs2_set_send_codec; | |
303 } | |
304 | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
305 static FsMediaType |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
306 _session_type_to_fs_media_type(PurpleMediaSessionType type) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
307 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
308 if (type & PURPLE_MEDIA_AUDIO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
309 return FS_MEDIA_TYPE_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
310 else if (type & PURPLE_MEDIA_VIDEO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
311 return FS_MEDIA_TYPE_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
312 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
313 return 0; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
314 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
315 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
316 #if 0 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
317 static FsStreamDirection |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
318 _session_type_to_fs_stream_direction(PurpleMediaSessionType type) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
319 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
320 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
321 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
322 return FS_DIRECTION_BOTH; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
323 else if ((type & PURPLE_MEDIA_SEND_AUDIO) || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
324 (type & PURPLE_MEDIA_SEND_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
325 return FS_DIRECTION_SEND; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
326 else if ((type & PURPLE_MEDIA_RECV_AUDIO) || |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
327 (type & PURPLE_MEDIA_RECV_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
328 return FS_DIRECTION_RECV; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
329 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
330 return FS_DIRECTION_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
331 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
332 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
333 static PurpleMediaSessionType |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
334 _session_type_from_fs(FsMediaType type, FsStreamDirection direction) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
335 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
336 PurpleMediaSessionType result = PURPLE_MEDIA_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
337 if (type == FS_MEDIA_TYPE_AUDIO) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
338 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
339 result |= PURPLE_MEDIA_SEND_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
340 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
341 result |= PURPLE_MEDIA_RECV_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
342 } else if (type == FS_MEDIA_TYPE_VIDEO) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
343 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
344 result |= PURPLE_MEDIA_SEND_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
345 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
346 result |= PURPLE_MEDIA_RECV_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
347 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
348 return result; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
349 } |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
350 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
351 static FsCandidate * |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
352 purple_media_candidate_to_fs(PurpleMediaCandidate *candidate) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
353 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
354 FsCandidate *fscandidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
355 gchar *foundation; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
356 guint component_id; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
357 gchar *ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
358 guint port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
359 gchar *base_ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
360 guint base_port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
361 PurpleMediaNetworkProtocol proto; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
362 guint32 priority; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
363 PurpleMediaCandidateType type; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
364 gchar *username; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
365 gchar *password; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
366 guint ttl; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
367 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
368 if (candidate == NULL) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
369 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
370 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
371 g_object_get(G_OBJECT(candidate), |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
372 "foundation", &foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
373 "component-id", &component_id, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
374 "ip", &ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
375 "port", &port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
376 "base-ip", &base_ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
377 "base-port", &base_port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
378 "protocol", &proto, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
379 "priority", &priority, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
380 "type", &type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
381 "username", &username, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
382 "password", &password, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
383 "ttl", &ttl, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
384 NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
385 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
386 fscandidate = fs_candidate_new(foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
387 component_id, type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
388 proto, ip, port); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
389 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
390 fscandidate->base_ip = base_ip; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
391 fscandidate->base_port = base_port; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
392 fscandidate->priority = priority; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
393 fscandidate->username = username; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
394 fscandidate->password = password; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
395 fscandidate->ttl = ttl; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
396 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
397 g_free(foundation); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
398 g_free(ip); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
399 return fscandidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
400 } |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
401 #endif |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
402 |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
403 static PurpleMediaCandidate * |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
404 purple_media_candidate_from_fs(FsCandidate *fscandidate) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
405 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
406 PurpleMediaCandidate *candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
407 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
408 if (fscandidate == NULL) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
409 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
410 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
411 candidate = purple_media_candidate_new(fscandidate->foundation, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
412 fscandidate->component_id, fscandidate->type, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
413 fscandidate->proto, fscandidate->ip, fscandidate->port); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
414 g_object_set(candidate, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
415 "base-ip", fscandidate->base_ip, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
416 "base-port", fscandidate->base_port, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
417 "priority", fscandidate->priority, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
418 "username", fscandidate->username, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
419 "password", fscandidate->password, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
420 "ttl", fscandidate->ttl, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
421 return candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
422 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
423 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
424 static PurpleMediaBackendFs2Session * |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
425 _get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
426 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
427 PurpleMediaBackendFs2Private *priv; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
428 PurpleMediaBackendFs2Session *session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
429 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
430 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
431 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
432 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
433 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
434 if (priv->sessions != NULL) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
435 session = g_hash_table_lookup(priv->sessions, sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
436 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
437 return session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
438 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
439 |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
440 static PurpleMediaBackendFs2Session * |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
441 _get_session_from_fs_stream(PurpleMediaBackendFs2 *self, FsStream *stream) |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
442 { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
443 PurpleMediaBackendFs2Private *priv = |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
444 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
445 FsSession *fssession; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
446 GList *values; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
447 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
448 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
449 g_return_val_if_fail(FS_IS_STREAM(stream), NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
450 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
451 g_object_get(stream, "session", &fssession, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
452 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
453 values = g_hash_table_get_values(priv->sessions); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
454 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
455 for (; values; values = g_list_delete_link(values, values)) { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
456 PurpleMediaBackendFs2Session *session = values->data; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
457 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
458 if (session->session == fssession) { |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
459 g_list_free(values); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
460 g_object_unref(fssession); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
461 return session; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
462 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
463 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
464 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
465 g_object_unref(fssession); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
466 return NULL; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
467 } |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
468 |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
469 static void |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
470 _gst_handle_message_element(GstBus *bus, GstMessage *msg, |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
471 PurpleMediaBackendFs2 *self) |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
472 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
473 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
474 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
475 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
476 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
477 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) || |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
478 priv->conference != FS_CONFERENCE(src)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
479 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
480 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
481 if (gst_structure_has_name(msg->structure, "farsight-error")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
482 FsError error_no; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
483 gst_structure_get_enum(msg->structure, "error-no", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
484 FS_TYPE_ERROR, (gint*)&error_no); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
485 switch (error_no) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
486 case FS_ERROR_NO_CODECS: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
487 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
488 " found. Install some" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
489 " GStreamer codecs found" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
490 " in GStreamer plugins" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
491 " packages.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
492 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
493 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
494 case FS_ERROR_NO_CODECS_LEFT: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
495 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
496 " left. Your codec" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
497 " preferences in" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
498 " fs-codecs.conf are too" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
499 " strict.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
500 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
501 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
502 case FS_ERROR_UNKNOWN_CNAME: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
503 /* |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
504 * Unknown CName is only a problem for the |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
505 * multicast transmitter which isn't used. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
506 * It is also deprecated. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
507 */ |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
508 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
509 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
510 purple_debug_error("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
511 "farsight-error: %i: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
512 error_no, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
513 gst_structure_get_string( |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
514 msg->structure, "error-msg")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
515 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
516 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
517 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
518 if (FS_ERROR_IS_FATAL(error_no)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
519 purple_media_error(priv->media, _("A non-recoverable " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
520 "Farsight2 error has occurred.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
521 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
522 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
523 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
524 "farsight-new-local-candidate")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
525 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
526 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
527 FsCandidate *local_candidate; |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
528 PurpleMediaCandidate *candidate; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
529 FsParticipant *participant; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
530 PurpleMediaBackendFs2Session *session; |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
531 gchar *name; |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
532 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
533 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
534 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
535 value = gst_structure_get_value(msg->structure, "candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
536 local_candidate = g_value_get_boxed(value); |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
537 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
538 session = _get_session_from_fs_stream(self, stream); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
539 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
540 purple_debug_info("backend-fs2", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
541 "got new local candidate: %s\n", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
542 local_candidate->foundation); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
543 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
544 g_object_get(stream, "participant", &participant, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
545 g_object_get(participant, "cname", &name, NULL); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
546 g_object_unref(participant); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
547 |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
548 #if 0 |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
549 purple_media_insert_local_candidate(session, name, |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
550 fs_candidate_copy(local_candidate)); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
551 #endif |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
552 |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
553 candidate = purple_media_candidate_from_fs(local_candidate); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
554 g_signal_emit_by_name(self, "new-candidate", |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
555 session->id, name, candidate); |
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
556 g_object_unref(candidate); |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
557 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
558 "farsight-local-candidates-prepared")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
559 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
560 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
561 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
562 PurpleMediaSession *session; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
563 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
564 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
565 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
566 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
567 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
568 session = purple_media_session_from_fs_stream(media, stream); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
569 _candidates_prepared_cb(stream, session); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
570 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
571 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
572 "farsight-new-active-candidate-pair")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
573 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
574 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
575 FsCandidate *local_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
576 FsCandidate *remote_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
577 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
578 PurpleMediaSession *session; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
579 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
580 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
581 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
582 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
583 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
584 "local-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
585 local_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
586 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
587 "remote-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
588 remote_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
589 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
590 session = purple_media_session_from_fs_stream(media, stream); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
591 _candidate_pair_established_cb(stream, local_candidate, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
592 remote_candidate, session); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
593 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
594 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
595 "farsight-recv-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
596 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
597 GList *codecs; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
598 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
599 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
600 value = gst_structure_get_value(msg->structure, "codecs"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
601 codecs = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
602 codec = codecs->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
603 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
604 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
605 "farsight-recv-codecs-changed: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
606 codec->encoding_name); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
607 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
608 "farsight-component-state-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
609 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
610 FsStreamState fsstate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
611 guint component; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
612 const gchar *state; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
613 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
614 value = gst_structure_get_value(msg->structure, "state"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
615 fsstate = g_value_get_enum(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
616 value = gst_structure_get_value(msg->structure, "component"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
617 component = g_value_get_uint(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
618 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
619 switch (fsstate) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
620 case FS_STREAM_STATE_FAILED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
621 state = "FAILED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
622 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
623 case FS_STREAM_STATE_DISCONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
624 state = "DISCONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
625 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
626 case FS_STREAM_STATE_GATHERING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
627 state = "GATHERING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
628 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
629 case FS_STREAM_STATE_CONNECTING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
630 state = "CONNECTING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
631 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
632 case FS_STREAM_STATE_CONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
633 state = "CONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
634 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
635 case FS_STREAM_STATE_READY: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
636 state = "READY"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
637 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
638 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
639 state = "UNKNOWN"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
640 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
641 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
642 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
643 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
644 "farsight-component-state-changed: " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
645 "component: %u state: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
646 component, state); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
647 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
648 "farsight-send-codec-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
649 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
650 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
651 gchar *codec_str; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
652 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
653 value = gst_structure_get_value(msg->structure, "codec"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
654 codec = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
655 codec_str = fs_codec_to_string(codec); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
656 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
657 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
658 "farsight-send-codec-changed: codec: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
659 codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
660 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
661 g_free(codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
662 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
663 "farsight-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
664 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
665 FsSession *fssession; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
666 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
667 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
668 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
669 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
670 value = gst_structure_get_value(msg->structure, "session"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
671 fssession = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
672 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
673 sessions = g_hash_table_get_values(priv->sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
674 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
675 for (; sessions; sessions = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
676 g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
677 PurpleMediaBackendFs2Session *session = sessions->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
678 gchar *session_id; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
679 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
680 if (session->session != fssession) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
681 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
682 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
683 session_id = g_strdup(session->id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
684 g_signal_emit(media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
685 purple_media_backend_fs2_signals[ |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
686 CODECS_CHANGED], 0, session_id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
687 g_free(session_id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
688 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
689 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
690 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
691 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
692 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
693 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
694 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
695 static void |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
696 _gst_handle_message_error(GstBus *bus, GstMessage *msg, |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
697 PurpleMediaBackendFs2 *self) |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
698 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
699 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
700 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
701 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
702 GstElement *lastElement = NULL; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
703 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
704 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
705 while (!GST_IS_PIPELINE(element)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
706 if (element == priv->confbin) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
707 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
708 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
709 lastElement = element; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
710 element = GST_ELEMENT_PARENT(element); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
711 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
712 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
713 if (!GST_IS_PIPELINE(element)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
714 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
715 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
716 sessions = purple_media_get_session_ids(priv->media); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
717 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
718 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
719 if (purple_media_get_src(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
720 != lastElement) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
721 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
722 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
723 if (purple_media_get_session_type(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
724 & PURPLE_MEDIA_AUDIO) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
725 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
726 _("Error with your microphone")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
727 else |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
728 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
729 _("Error with your webcam")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
730 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
731 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
732 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
733 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
734 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
735 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
736 purple_media_error(priv->media, _("Conference error")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
737 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
738 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
739 |
29540 | 740 static gboolean |
29554
2460e6774e08
Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents:
29553
diff
changeset
|
741 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self) |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
742 { |
29552
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
743 switch(GST_MESSAGE_TYPE(msg)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
744 case GST_MESSAGE_ELEMENT: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
745 _gst_handle_message_element(bus, msg, self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
746 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
747 case GST_MESSAGE_ERROR: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
748 _gst_handle_message_error(bus, msg, self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
749 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
750 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
751 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
752 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29548
diff
changeset
|
753 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
754 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
755 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
756 |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
757 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
758 _state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
759 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
760 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
761 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
762 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
763 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
764 _stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
765 gchar *sid, gchar *name, gboolean local, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
766 PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
767 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
768 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
769 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
770 static gboolean |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
771 _init_conference(PurpleMediaBackendFs2 *self) |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
772 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
773 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
774 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
775 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
776 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
777 gchar *name; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
778 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
779 priv->conference = FS_CONFERENCE( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
780 gst_element_factory_make(priv->conference_type, NULL)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
781 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
782 if (priv->conference == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
783 purple_debug_error("backend-fs2", "Conference == NULL\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
784 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
785 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
786 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
787 pipeline = purple_media_manager_get_pipeline( |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
788 purple_media_get_manager(priv->media)); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
789 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
790 if (pipeline == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
791 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
792 "Couldn't retrieve pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
793 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
794 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
795 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
796 name = g_strdup_printf("conf_%p", priv->conference); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
797 priv->confbin = gst_bin_new(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
798 if (priv->confbin == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
799 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
800 "Couldn't create confbin.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
801 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
802 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
803 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
804 g_free(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
805 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
806 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
807 if (bus == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
808 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
809 "Couldn't get the pipeline's bus.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
810 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
811 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
812 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
813 g_signal_connect(G_OBJECT(bus), "message", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
814 G_CALLBACK(_gst_bus_cb), self); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
815 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
816 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
817 if (!gst_bin_add(GST_BIN(pipeline), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
818 GST_ELEMENT(priv->confbin))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
819 purple_debug_error("backend-fs2", "Couldn't add confbin " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
820 "element to the pipeline\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
821 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
822 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
823 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
824 if (!gst_bin_add(GST_BIN(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
825 GST_ELEMENT(priv->conference))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
826 purple_debug_error("backend-fs2", "Couldn't add conference " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
827 "element to the confbin\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
828 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
829 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
830 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
831 if (gst_element_set_state(GST_ELEMENT(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
832 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
833 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
834 "Failed to start conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
835 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
836 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
837 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
838 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
839 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
840 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
841 static void |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
842 _gst_element_added_cb(FsElementAddedNotifier *self, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
843 GstBin *bin, GstElement *element, gpointer user_data) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
844 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
845 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
846 * Hack to make H264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
847 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
848 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
849 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
850 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
851 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
852 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
853 static gboolean |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
854 _create_session(PurpleMediaBackendFs2 *self, const gchar *sess_id, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
855 PurpleMediaSessionType type, gboolean initiator, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
856 const gchar *transmitter) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
857 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
858 PurpleMediaBackendFs2Private *priv = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
859 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
860 PurpleMediaBackendFs2Session *session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
861 GError *err = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
862 GList *codec_conf = NULL, *iter = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
863 gchar *filename = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
864 gboolean is_nice = !strcmp(transmitter, "nice"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
865 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
866 session = g_new0(PurpleMediaBackendFs2Session, 1); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
867 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
868 session->session = fs_conference_new_session(priv->conference, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
869 _session_type_to_fs_media_type(type), &err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
870 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
871 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
872 purple_media_error(priv->media, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
873 _("Error creating session: %s"), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
874 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
875 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
876 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
877 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
878 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
879 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
880 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
881 codec_conf = fs_codec_list_from_keyfile(filename, &err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
882 g_free(filename); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
883 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
884 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
885 if (err->code == 4) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
886 purple_debug_info("media", "Couldn't read " |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
887 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
888 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
889 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
890 purple_debug_error("media", "Error reading " |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
891 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
892 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
893 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
894 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
895 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
896 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
897 * Add SPEEX if the configuration file doesn't exist or |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
898 * there isn't a speex entry. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
899 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
900 for (iter = codec_conf; iter; iter = g_list_next(iter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
901 FsCodec *codec = iter->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
902 if (!g_ascii_strcasecmp(codec->encoding_name, "speex")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
903 break; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
904 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
905 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
906 if (iter == NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
907 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
908 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
909 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
910 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
911 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
912 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
913 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
914 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
915 fs_session_set_codec_preferences(session->session, codec_conf, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
916 fs_codec_list_destroy(codec_conf); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
917 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
918 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
919 * Removes a 5-7 second delay before |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
920 * receiving the src-pad-added signal. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
921 * Only works for non-multicast FsRtpSessions. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
922 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
923 if (is_nice || !strcmp(transmitter, "rawudp")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
924 g_object_set(G_OBJECT(session->session), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
925 "no-rtcp-timeout", 0, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
926 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
927 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
928 * Hack to make x264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
929 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
930 if (is_nice && !strcmp(sess_id, "google-video")) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
931 FsElementAddedNotifier *notifier = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
932 fs_element_added_notifier_new(); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
933 g_signal_connect(G_OBJECT(notifier), "element-added", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
934 G_CALLBACK(_gst_element_added_cb), NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
935 fs_element_added_notifier_add(notifier, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
936 GST_BIN(priv->conference)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
937 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
938 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
939 session->id = g_strdup(sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
940 session->backend = self; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
941 session->type = type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
942 session->initiator = initiator; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
943 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
944 if (!priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
945 purple_debug_info("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
946 "Creating hash table for sessions\n"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
947 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:
29552
diff
changeset
|
948 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
949 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
950 g_hash_table_insert(priv->sessions, g_strdup(session->id), session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
951 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
952 return TRUE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
953 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
954 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
955 static gboolean |
29540 | 956 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
957 const gchar *sess_id, const gchar *who, | |
958 PurpleMediaSessionType type, gboolean initiator, | |
959 const gchar *transmitter, | |
960 guint num_params, GParameter *params) | |
961 { | |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
962 PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
963 PurpleMediaBackendFs2Private *priv = |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
964 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend); |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
965 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
966 if (priv->conference == NULL && !_init_conference(backend)) { |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
967 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
968 "Error initializing the conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
969 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
970 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
971 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
972 if (_get_session(backend, sess_id) == NULL && |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
973 !_create_session(backend, sess_id, type, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
974 initiator, transmitter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
975 purple_debug_error("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
976 "Error creating the session.\n"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
977 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
978 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
979 |
29543
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29540
diff
changeset
|
980 return TRUE; |
29540 | 981 } |
982 | |
983 static void | |
984 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self, | |
985 const gchar *sess_id, const gchar *participant, | |
986 GList *remote_candidates) | |
987 { | |
988 } | |
989 | |
990 static GList * | |
991 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
992 const gchar *sess_id) | |
993 { | |
994 return NULL; | |
995 } | |
996 | |
997 static GList * | |
998 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self, | |
999 const gchar *sess_id, const gchar *participant) | |
1000 { | |
1001 return NULL; | |
1002 } | |
1003 | |
1004 static void | |
1005 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, | |
1006 const gchar *sess_id, const gchar *participant, | |
1007 GList *codecs) | |
1008 { | |
1009 } | |
1010 | |
1011 static void | |
1012 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, | |
1013 const gchar *sess_id, PurpleMediaCodec *codec) | |
1014 { | |
1015 } | |
1016 | |
29548
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1017 FsConference * |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1018 purple_media_backend_fs2_get_conference(PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1019 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1020 PurpleMediaBackendFs2Private *priv = |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1021 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1022 return priv->conference; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1023 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29543
diff
changeset
|
1024 |
29553
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1025 FsSession * |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1026 purple_media_backend_fs2_get_session(PurpleMediaBackendFs2 *self, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1027 const gchar *sess_id) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1028 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1029 PurpleMediaBackendFs2Session *session = _get_session(self, sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1030 return session != NULL? session->session : NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29552
diff
changeset
|
1031 } |