Mercurial > pidgin
annotate libpurple/media/backend-fs2.c @ 29159:efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
author | maiku@pidgin.im |
---|---|
date | Fri, 23 Oct 2009 21:40:38 +0000 |
parents | ae81f8baa148 |
children | 2460e6774e08 |
rev | line source |
---|---|
29146 | 1 /** |
2 * @file backend-fs2.c Farsight 2 backend for media API | |
3 * @ingroup core | |
4 */ | |
5 | |
6 /* purple | |
7 * | |
8 * Purple is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
25 */ | |
26 | |
27 #include "backend-fs2.h" | |
28 | |
29158
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
29 #include "internal.h" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
30 |
29146 | 31 #include "backend-iface.h" |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
32 #include "debug.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
33 #include "media-gst.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
34 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
35 #include <gst/farsight/fs-conference-iface.h> |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
36 #include <gst/farsight/fs-element-added-notifier.h> |
29146 | 37 |
38 /** @copydoc _PurpleMediaBackendFs2Class */ | |
39 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class; | |
40 /** @copydoc _PurpleMediaBackendFs2Private */ | |
41 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private; | |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
42 /** @copydoc _PurpleMediaBackendFs2Session */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
43 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session; |
29146 | 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 | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
51 static gboolean |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
52 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackend *self); |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
53 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
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:
29149
diff
changeset
|
56 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
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:
29149
diff
changeset
|
59 PurpleMediaBackendFs2 *self); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
60 |
29146 | 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 | |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
96 struct _PurpleMediaBackendFs2Session |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
97 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
98 PurpleMediaBackendFs2 *backend; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
99 gchar *id; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
100 gboolean initiator; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
101 FsSession *session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
102 PurpleMediaSessionType type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
103 }; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
104 |
29146 | 105 struct _PurpleMediaBackendFs2Private |
106 { | |
107 PurpleMedia *media; | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
108 GstElement *confbin; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
109 FsConference *conference; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
110 gchar *conference_type; |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
111 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
112 GHashTable *sessions; |
29146 | 113 }; |
114 | |
115 enum { | |
116 PROP_0, | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
117 PROP_CONFERENCE_TYPE, |
29146 | 118 PROP_MEDIA, |
119 }; | |
120 | |
121 static void | |
122 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self) | |
123 { | |
124 } | |
125 | |
126 static void | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
128 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
129 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
131 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
133 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
134 if (priv->confbin) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
135 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
136 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
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:
29146
diff
changeset
|
139 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
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:
29146
diff
changeset
|
142 GST_STATE_NULL); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
143 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
144 if (pipeline) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
145 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
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:
29146
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:
29146
diff
changeset
|
149 G_SIGNAL_MATCH_FUNC | |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
150 G_SIGNAL_MATCH_DATA, |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
152 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
153 } else { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
155 "properly dispose the conference. " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
157 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
158 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
159 priv->confbin = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
160 priv->conference = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
161 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
162 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
163 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
164 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
166 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
167 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
168 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
169 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
170 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
171 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
172 if (session->session) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
173 g_object_unref(session->session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
174 session->session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
175 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
176 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
177 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
178 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
179 if (priv->media) { |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
181 (gpointer*)&priv->media); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
182 priv->media = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
183 } |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
184 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
185 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
186 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
187 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
188 static void |
29146 | 189 purple_media_backend_fs2_finalize(GObject *obj) |
190 { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
191 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
192 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj); |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
193 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
195 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
196 g_free(priv->conference_type); |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
197 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
198 if (priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
200 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
201 for (; sessions; sessions = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
202 g_list_delete_link(sessions, sessions)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
203 PurpleMediaBackendFs2Session *session = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
204 sessions->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
205 g_free(session->id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
206 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
207 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
208 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
209 g_hash_table_destroy(priv->sessions); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
210 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
211 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
212 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj); |
29146 | 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) { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
225 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
227 break; |
29146 | 228 case PROP_MEDIA: |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
230 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
231 if (priv->media == NULL) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
232 break; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
233 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
235 (gpointer*)&priv->media); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
236 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
238 "state-changed", |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
239 G_CALLBACK(_state_changed_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
240 PURPLE_MEDIA_BACKEND_FS2(object)); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
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:
29149
diff
changeset
|
242 G_CALLBACK(_stream_info_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
243 PURPLE_MEDIA_BACKEND_FS2(object)); |
29146 | 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) { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
262 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
264 break; |
29146 | 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; | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
279 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
280 gobject_class->dispose = purple_media_backend_fs2_dispose; |
29146 | 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 | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
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:
29146
diff
changeset
|
286 "conference-type"); |
29146 | 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 | |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
305 static FsMediaType |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
307 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
308 if (type & PURPLE_MEDIA_AUDIO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
309 return FS_MEDIA_TYPE_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
310 else if (type & PURPLE_MEDIA_VIDEO) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
311 return FS_MEDIA_TYPE_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
312 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
313 return 0; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
314 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
315 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
316 #if 0 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
317 static FsStreamDirection |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
319 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
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:
29158
diff
changeset
|
322 return FS_DIRECTION_BOTH; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
324 (type & PURPLE_MEDIA_SEND_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
325 return FS_DIRECTION_SEND; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
327 (type & PURPLE_MEDIA_RECV_VIDEO)) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
328 return FS_DIRECTION_RECV; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
329 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
330 return FS_DIRECTION_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
331 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
332 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
333 static PurpleMediaSessionType |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
335 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
336 PurpleMediaSessionType result = PURPLE_MEDIA_NONE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
337 if (type == FS_MEDIA_TYPE_AUDIO) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
338 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
339 result |= PURPLE_MEDIA_SEND_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
340 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
341 result |= PURPLE_MEDIA_RECV_AUDIO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
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:
29158
diff
changeset
|
343 if (direction & FS_DIRECTION_SEND) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
344 result |= PURPLE_MEDIA_SEND_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
345 if (direction & FS_DIRECTION_RECV) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
346 result |= PURPLE_MEDIA_RECV_VIDEO; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
347 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
348 return result; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
349 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
350 #endif |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
351 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
352 static PurpleMediaBackendFs2Session * |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
353 _get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
354 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
355 PurpleMediaBackendFs2Private *priv; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
356 PurpleMediaBackendFs2Session *session = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
357 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
358 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
359 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
360 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
361 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
362 if (priv->sessions != NULL) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
363 session = g_hash_table_lookup(priv->sessions, sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
364 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
365 return session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
366 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
367 |
29158
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
368 static void |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
369 _gst_handle_message_element(GstBus *bus, GstMessage *msg, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
370 PurpleMediaBackend *self) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
371 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
372 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
373 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
374 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
375 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
376 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) || |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
377 priv->conference != FS_CONFERENCE(src)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
378 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
379 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
380 if (gst_structure_has_name(msg->structure, "farsight-error")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
381 FsError error_no; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
382 gst_structure_get_enum(msg->structure, "error-no", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
383 FS_TYPE_ERROR, (gint*)&error_no); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
384 switch (error_no) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
385 case FS_ERROR_NO_CODECS: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
386 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
387 " found. Install some" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
388 " GStreamer codecs found" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
389 " in GStreamer plugins" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
390 " packages.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
391 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
392 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
393 case FS_ERROR_NO_CODECS_LEFT: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
394 purple_media_error(priv->media, _("No codecs" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
395 " left. Your codec" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
396 " preferences in" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
397 " fs-codecs.conf are too" |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
398 " strict.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
399 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
400 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
401 case FS_ERROR_UNKNOWN_CNAME: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
402 /* |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
403 * Unknown CName is only a problem for the |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
404 * multicast transmitter which isn't used. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
405 * It is also deprecated. |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
406 */ |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
407 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
408 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
409 purple_debug_error("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
410 "farsight-error: %i: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
411 error_no, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
412 gst_structure_get_string( |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
413 msg->structure, "error-msg")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
414 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
415 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
416 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
417 if (FS_ERROR_IS_FATAL(error_no)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
418 purple_media_error(priv->media, _("A non-recoverable " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
419 "Farsight2 error has occurred.")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
420 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
421 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
422 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
423 "farsight-new-local-candidate")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
424 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
425 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
426 FsCandidate *local_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
427 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
428 PurpleMediaSession *session; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
429 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
430 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
431 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
432 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
433 value = gst_structure_get_value(msg->structure, "candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
434 local_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
435 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
436 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:
29154
diff
changeset
|
437 _new_local_candidate_cb(stream, local_candidate, session); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
438 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
439 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
440 "farsight-local-candidates-prepared")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
441 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
442 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
443 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
444 PurpleMediaSession *session; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
445 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
446 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
447 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
448 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
449 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
450 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:
29154
diff
changeset
|
451 _candidates_prepared_cb(stream, session); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
452 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
453 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
454 "farsight-new-active-candidate-pair")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
455 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
456 FsStream *stream; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
457 FsCandidate *local_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
458 FsCandidate *remote_candidate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
459 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
460 PurpleMediaSession *session; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
461 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
462 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
463 value = gst_structure_get_value(msg->structure, "stream"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
464 stream = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
465 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
466 "local-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
467 local_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
468 value = gst_structure_get_value(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
469 "remote-candidate"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
470 remote_candidate = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
471 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
472 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:
29154
diff
changeset
|
473 _candidate_pair_established_cb(stream, local_candidate, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
474 remote_candidate, session); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
475 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
476 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
477 "farsight-recv-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
478 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
479 GList *codecs; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
480 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
481 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
482 value = gst_structure_get_value(msg->structure, "codecs"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
483 codecs = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
484 codec = codecs->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
485 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
486 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
487 "farsight-recv-codecs-changed: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
488 codec->encoding_name); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
489 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
490 "farsight-component-state-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
491 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
492 FsStreamState fsstate; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
493 guint component; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
494 const gchar *state; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
495 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
496 value = gst_structure_get_value(msg->structure, "state"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
497 fsstate = g_value_get_enum(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
498 value = gst_structure_get_value(msg->structure, "component"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
499 component = g_value_get_uint(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
500 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
501 switch (fsstate) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
502 case FS_STREAM_STATE_FAILED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
503 state = "FAILED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
504 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
505 case FS_STREAM_STATE_DISCONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
506 state = "DISCONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
507 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
508 case FS_STREAM_STATE_GATHERING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
509 state = "GATHERING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
510 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
511 case FS_STREAM_STATE_CONNECTING: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
512 state = "CONNECTING"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
513 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
514 case FS_STREAM_STATE_CONNECTED: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
515 state = "CONNECTED"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
516 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
517 case FS_STREAM_STATE_READY: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
518 state = "READY"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
519 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
520 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
521 state = "UNKNOWN"; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
522 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
523 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
524 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
525 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
526 "farsight-component-state-changed: " |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
527 "component: %u state: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
528 component, state); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
529 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
530 "farsight-send-codec-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
531 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
532 FsCodec *codec; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
533 gchar *codec_str; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
534 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
535 value = gst_structure_get_value(msg->structure, "codec"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
536 codec = g_value_get_boxed(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
537 codec_str = fs_codec_to_string(codec); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
538 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
539 purple_debug_info("backend-fs2", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
540 "farsight-send-codec-changed: codec: %s\n", |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
541 codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
542 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
543 g_free(codec_str); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
544 } else if (gst_structure_has_name(msg->structure, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
545 "farsight-codecs-changed")) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
546 const GValue *value; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
547 FsSession *fssession; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
548 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
549 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
550 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
551 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
552 value = gst_structure_get_value(msg->structure, "session"); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
553 fssession = g_value_get_object(value); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
554 #if 0 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
555 sessions = g_hash_table_get_values(priv->sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
556 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
557 for (; sessions; sessions = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
558 g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
559 PurpleMediaBackendFs2Session *session = sessions->data; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
560 gchar *session_id; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
561 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
562 if (session->session != fssession) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
563 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
564 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
565 session_id = g_strdup(session->id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
566 g_signal_emit(media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
567 purple_media_backend_fs2_signals[ |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
568 CODECS_CHANGED], 0, session_id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
569 g_free(session_id); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
570 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
571 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
572 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
573 #endif |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
574 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
575 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
576 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
577 static void |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
578 _gst_handle_message_error(GstBus *bus, GstMessage *msg, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
579 PurpleMediaBackend *self) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
580 { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
581 PurpleMediaBackendFs2Private *priv = |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
582 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
583 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg)); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
584 GstElement *lastElement = NULL; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
585 GList *sessions; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
586 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
587 while (!GST_IS_PIPELINE(element)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
588 if (element == priv->confbin) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
589 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
590 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
591 lastElement = element; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
592 element = GST_ELEMENT_PARENT(element); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
593 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
594 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
595 if (!GST_IS_PIPELINE(element)) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
596 return; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
597 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
598 sessions = purple_media_get_session_ids(priv->media); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
599 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
600 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
601 if (purple_media_get_src(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
602 != lastElement) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
603 continue; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
604 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
605 if (purple_media_get_session_type(priv->media, sessions->data) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
606 & PURPLE_MEDIA_AUDIO) |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
607 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
608 _("Error with your microphone")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
609 else |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
610 purple_media_error(priv->media, |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
611 _("Error with your webcam")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
612 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
613 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
614 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
615 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
616 g_list_free(sessions); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
617 |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
618 purple_media_error(priv->media, _("Conference error")); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
619 purple_media_end(priv->media, NULL, NULL); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
620 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
621 |
29146 | 622 static gboolean |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
623 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackend *self) |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
624 { |
29158
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
625 switch(GST_MESSAGE_TYPE(msg)) { |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
626 case GST_MESSAGE_ELEMENT: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
627 _gst_handle_message_element(bus, msg, self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
628 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
629 case GST_MESSAGE_ERROR: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
630 _gst_handle_message_error(bus, msg, self); |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
631 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
632 default: |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
633 break; |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
634 } |
ae81f8baa148
Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29154
diff
changeset
|
635 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
636 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
637 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
638 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
639 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
640 _state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
641 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
642 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
643 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
644 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
645 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
646 _stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
647 gchar *sid, gchar *name, gboolean local, |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
648 PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
649 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
650 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
651 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
652 static gboolean |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
653 _init_conference(PurpleMediaBackendFs2 *self) |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
654 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
655 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
656 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
657 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
658 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
659 gchar *name; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
660 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
661 priv->conference = FS_CONFERENCE( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
662 gst_element_factory_make(priv->conference_type, NULL)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
663 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
664 if (priv->conference == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
665 purple_debug_error("backend-fs2", "Conference == NULL\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
666 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
667 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
668 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
669 pipeline = purple_media_manager_get_pipeline( |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
670 purple_media_get_manager(priv->media)); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
671 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
672 if (pipeline == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
673 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
674 "Couldn't retrieve pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
675 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
676 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
677 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
678 name = g_strdup_printf("conf_%p", priv->conference); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
679 priv->confbin = gst_bin_new(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
680 if (priv->confbin == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
681 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
682 "Couldn't create confbin.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
683 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
684 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
685 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
686 g_free(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
687 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
688 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
689 if (bus == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
690 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
691 "Couldn't get the pipeline's bus.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
692 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
693 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
694 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
695 g_signal_connect(G_OBJECT(bus), "message", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
696 G_CALLBACK(_gst_bus_cb), self); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
697 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
698 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
699 if (!gst_bin_add(GST_BIN(pipeline), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
700 GST_ELEMENT(priv->confbin))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
701 purple_debug_error("backend-fs2", "Couldn't add confbin " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
702 "element to the pipeline\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
703 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
704 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
705 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
706 if (!gst_bin_add(GST_BIN(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
707 GST_ELEMENT(priv->conference))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
708 purple_debug_error("backend-fs2", "Couldn't add conference " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
709 "element to the confbin\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
710 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
711 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
712 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
713 if (gst_element_set_state(GST_ELEMENT(priv->confbin), |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
714 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
715 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
716 "Failed to start conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
717 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
718 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
719 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
720 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
721 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
722 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
723 static void |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
724 _gst_element_added_cb(FsElementAddedNotifier *self, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
725 GstBin *bin, GstElement *element, gpointer user_data) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
726 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
727 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
728 * Hack to make H264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
729 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
730 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
731 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
732 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
733 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
734 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
735 static gboolean |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
736 _create_session(PurpleMediaBackendFs2 *self, const gchar *sess_id, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
737 PurpleMediaSessionType type, gboolean initiator, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
738 const gchar *transmitter) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
739 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
740 PurpleMediaBackendFs2Private *priv = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
741 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
742 PurpleMediaBackendFs2Session *session; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
743 GError *err = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
744 GList *codec_conf = NULL, *iter = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
745 gchar *filename = NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
746 gboolean is_nice = !strcmp(transmitter, "nice"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
747 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
748 session = g_new0(PurpleMediaBackendFs2Session, 1); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
749 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
750 session->session = fs_conference_new_session(priv->conference, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
751 _session_type_to_fs_media_type(type), &err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
752 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
753 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
754 purple_media_error(priv->media, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
755 _("Error creating session: %s"), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
756 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
757 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
758 g_free(session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
759 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
760 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
761 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
762 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
763 codec_conf = fs_codec_list_from_keyfile(filename, &err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
764 g_free(filename); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
765 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
766 if (err != NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
767 if (err->code == 4) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
768 purple_debug_info("media", "Couldn't read " |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
769 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
770 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
771 else |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
772 purple_debug_error("media", "Error reading " |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
773 "fs-codec.conf: %s\n", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
774 err->message); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
775 g_error_free(err); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
776 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
777 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
778 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
779 * Add SPEEX if the configuration file doesn't exist or |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
780 * there isn't a speex entry. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
781 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
782 for (iter = codec_conf; iter; iter = g_list_next(iter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
783 FsCodec *codec = iter->data; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
784 if (!g_ascii_strcasecmp(codec->encoding_name, "speex")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
785 break; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
786 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
787 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
788 if (iter == NULL) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
789 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
790 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
791 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
792 codec_conf = g_list_prepend(codec_conf, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
793 fs_codec_new(FS_CODEC_ID_ANY, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
794 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
795 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
796 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
797 fs_session_set_codec_preferences(session->session, codec_conf, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
798 fs_codec_list_destroy(codec_conf); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
799 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
800 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
801 * Removes a 5-7 second delay before |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
802 * receiving the src-pad-added signal. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
803 * Only works for non-multicast FsRtpSessions. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
804 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
805 if (is_nice || !strcmp(transmitter, "rawudp")) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
806 g_object_set(G_OBJECT(session->session), |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
807 "no-rtcp-timeout", 0, NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
808 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
809 /* |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
810 * Hack to make x264 work with Gmail video. |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
811 */ |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
812 if (is_nice && !strcmp(sess_id, "google-video")) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
813 FsElementAddedNotifier *notifier = |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
814 fs_element_added_notifier_new(); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
815 g_signal_connect(G_OBJECT(notifier), "element-added", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
816 G_CALLBACK(_gst_element_added_cb), NULL); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
817 fs_element_added_notifier_add(notifier, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
818 GST_BIN(priv->conference)); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
819 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
820 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
821 session->id = g_strdup(sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
822 session->backend = self; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
823 session->type = type; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
824 session->initiator = initiator; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
825 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
826 if (!priv->sessions) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
827 purple_debug_info("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
828 "Creating hash table for sessions\n"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
829 priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
830 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
831 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
832 g_hash_table_insert(priv->sessions, g_strdup(session->id), session); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
833 |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
834 return TRUE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
835 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
836 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
837 static gboolean |
29146 | 838 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
839 const gchar *sess_id, const gchar *who, | |
840 PurpleMediaSessionType type, gboolean initiator, | |
841 const gchar *transmitter, | |
842 guint num_params, GParameter *params) | |
843 { | |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
844 PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
845 PurpleMediaBackendFs2Private *priv = |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
846 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
847 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
848 if (priv->conference == NULL && !_init_conference(backend)) { |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
849 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
850 "Error initializing the conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
851 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
852 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
853 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
854 if (_get_session(backend, sess_id) == NULL && |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
855 !_create_session(backend, sess_id, type, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
856 initiator, transmitter)) { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
857 purple_debug_error("backend-fs2", |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
858 "Error creating the session.\n"); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
859 return FALSE; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
860 } |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
861 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
862 return TRUE; |
29146 | 863 } |
864 | |
865 static void | |
866 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self, | |
867 const gchar *sess_id, const gchar *participant, | |
868 GList *remote_candidates) | |
869 { | |
870 } | |
871 | |
872 static GList * | |
873 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
874 const gchar *sess_id) | |
875 { | |
876 return NULL; | |
877 } | |
878 | |
879 static GList * | |
880 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self, | |
881 const gchar *sess_id, const gchar *participant) | |
882 { | |
883 return NULL; | |
884 } | |
885 | |
886 static void | |
887 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, | |
888 const gchar *sess_id, const gchar *participant, | |
889 GList *codecs) | |
890 { | |
891 } | |
892 | |
893 static void | |
894 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, | |
895 const gchar *sess_id, PurpleMediaCodec *codec) | |
896 { | |
897 } | |
898 | |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
899 FsConference * |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
900 purple_media_backend_fs2_get_conference(PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
901 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
902 PurpleMediaBackendFs2Private *priv = |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
903 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
904 return priv->conference; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
905 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
906 |
29159
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
907 FsSession * |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
908 purple_media_backend_fs2_get_session(PurpleMediaBackendFs2 *self, |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
909 const gchar *sess_id) |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
910 { |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
911 PurpleMediaBackendFs2Session *session = _get_session(self, sess_id); |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
912 return session != NULL? session->session : NULL; |
efeb21092ed2
Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents:
29158
diff
changeset
|
913 } |