Mercurial > pidgin
annotate libpurple/media/backend-fs2.c @ 29154:2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
and created a temporary function to help test out integrating with PurpleMedia.
author | maiku@pidgin.im |
---|---|
date | Fri, 23 Oct 2009 01:55:39 +0000 |
parents | 4aa30863743b |
children | ae81f8baa148 |
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 | |
29 #include "backend-iface.h" | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
30 #include "debug.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
31 #include "media-gst.h" |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
32 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
33 #include <gst/farsight/fs-conference-iface.h> |
29146 | 34 |
35 /** @copydoc _PurpleMediaBackendFs2Class */ | |
36 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class; | |
37 /** @copydoc _PurpleMediaBackendFs2Private */ | |
38 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private; | |
39 | |
40 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \ | |
41 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ | |
42 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private)) | |
43 | |
44 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface); | |
45 | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
46 static gboolean |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
47 _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
|
48 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
49 _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
|
50 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
|
51 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
52 _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
|
53 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
|
54 PurpleMediaBackendFs2 *self); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
55 |
29146 | 56 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
57 const gchar *sess_id, const gchar *who, | |
58 PurpleMediaSessionType type, gboolean initiator, | |
59 const gchar *transmitter, | |
60 guint num_params, GParameter *params); | |
61 static void purple_media_backend_fs2_add_remote_candidates( | |
62 PurpleMediaBackend *self, | |
63 const gchar *sess_id, const gchar *participant, | |
64 GList *remote_candidates); | |
65 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
66 const gchar *sess_id); | |
67 static GList *purple_media_backend_fs2_get_local_candidates( | |
68 PurpleMediaBackend *self, | |
69 const gchar *sess_id, const gchar *participant); | |
70 static void purple_media_backend_fs2_set_remote_codecs( | |
71 PurpleMediaBackend *self, | |
72 const gchar *sess_id, const gchar *participant, | |
73 GList *codecs); | |
74 static void purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, | |
75 const gchar *sess_id, PurpleMediaCodec *codec); | |
76 | |
77 struct _PurpleMediaBackendFs2Class | |
78 { | |
79 GObjectClass parent_class; | |
80 }; | |
81 | |
82 struct _PurpleMediaBackendFs2 | |
83 { | |
84 GObject parent; | |
85 }; | |
86 | |
87 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2, | |
88 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE( | |
89 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init)); | |
90 | |
91 struct _PurpleMediaBackendFs2Private | |
92 { | |
93 PurpleMedia *media; | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
94 GstElement *confbin; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
95 FsConference *conference; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
96 gchar *conference_type; |
29146 | 97 }; |
98 | |
99 enum { | |
100 PROP_0, | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
101 PROP_CONFERENCE_TYPE, |
29146 | 102 PROP_MEDIA, |
103 }; | |
104 | |
105 static void | |
106 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self) | |
107 { | |
108 } | |
109 | |
110 static void | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
111 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
|
112 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
113 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
114 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
|
115 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
116 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
|
117 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
118 if (priv->confbin) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
119 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
120 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
121 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
|
122 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
|
123 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
124 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
|
125 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
|
126 GST_STATE_NULL); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
127 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
128 if (pipeline) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
129 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 G_SIGNAL_MATCH_FUNC | |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
134 G_SIGNAL_MATCH_DATA, |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
135 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
|
136 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
137 } else { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
138 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
|
139 "properly dispose the conference. " |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
140 "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
|
141 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
142 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
143 priv->confbin = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
144 priv->conference = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
145 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
146 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
147 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
148 if (priv->media) { |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
149 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
|
150 (gpointer*)&priv->media); |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
151 priv->media = NULL; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
152 } |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
153 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
154 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
|
155 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
156 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
157 static void |
29146 | 158 purple_media_backend_fs2_finalize(GObject *obj) |
159 { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
160 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
161 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
|
162 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
163 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
|
164 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
165 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
|
166 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
167 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj); |
29146 | 168 } |
169 | |
170 static void | |
171 purple_media_backend_fs2_set_property(GObject *object, guint prop_id, | |
172 const GValue *value, GParamSpec *pspec) | |
173 { | |
174 PurpleMediaBackendFs2Private *priv; | |
175 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
176 | |
177 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); | |
178 | |
179 switch (prop_id) { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
180 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
181 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
|
182 break; |
29146 | 183 case PROP_MEDIA: |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
184 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
|
185 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
186 if (priv->media == NULL) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
187 break; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
188 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
189 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
|
190 (gpointer*)&priv->media); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
191 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
192 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
|
193 "state-changed", |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
194 G_CALLBACK(_state_changed_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
195 PURPLE_MEDIA_BACKEND_FS2(object)); |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
196 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
|
197 G_CALLBACK(_stream_info_cb), |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
198 PURPLE_MEDIA_BACKEND_FS2(object)); |
29146 | 199 break; |
200 default: | |
201 G_OBJECT_WARN_INVALID_PROPERTY_ID( | |
202 object, prop_id, pspec); | |
203 break; | |
204 } | |
205 } | |
206 | |
207 static void | |
208 purple_media_backend_fs2_get_property(GObject *object, guint prop_id, | |
209 GValue *value, GParamSpec *pspec) | |
210 { | |
211 PurpleMediaBackendFs2Private *priv; | |
212 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object)); | |
213 | |
214 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object); | |
215 | |
216 switch (prop_id) { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
217 case PROP_CONFERENCE_TYPE: |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
218 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
|
219 break; |
29146 | 220 case PROP_MEDIA: |
221 g_value_set_object(value, priv->media); | |
222 break; | |
223 default: | |
224 G_OBJECT_WARN_INVALID_PROPERTY_ID( | |
225 object, prop_id, pspec); | |
226 break; | |
227 } | |
228 } | |
229 | |
230 static void | |
231 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass) | |
232 { | |
233 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
|
234 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
235 gobject_class->dispose = purple_media_backend_fs2_dispose; |
29146 | 236 gobject_class->finalize = purple_media_backend_fs2_finalize; |
237 gobject_class->set_property = purple_media_backend_fs2_set_property; | |
238 gobject_class->get_property = purple_media_backend_fs2_get_property; | |
239 | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
240 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
|
241 "conference-type"); |
29146 | 242 g_object_class_override_property(gobject_class, PROP_MEDIA, "media"); |
243 | |
244 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private)); | |
245 } | |
246 | |
247 static void | |
248 purple_media_backend_iface_init(PurpleMediaBackendIface *iface) | |
249 { | |
250 iface->add_stream = purple_media_backend_fs2_add_stream; | |
251 iface->add_remote_candidates = | |
252 purple_media_backend_fs2_add_remote_candidates; | |
253 iface->get_codecs = purple_media_backend_fs2_get_codecs; | |
254 iface->get_local_candidates = | |
255 purple_media_backend_fs2_get_local_candidates; | |
256 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs; | |
257 iface->set_send_codec = purple_media_backend_fs2_set_send_codec; | |
258 } | |
259 | |
260 static gboolean | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
261 _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
|
262 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
263 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
264 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
265 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
266 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
267 _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
|
268 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
|
269 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
270 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
271 |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
272 static void |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
273 _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
|
274 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
|
275 PurpleMediaBackendFs2 *self) |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
276 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
277 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
278 |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
279 static gboolean |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
280 _init_conference(PurpleMediaBackend *self) |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
281 { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
282 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
283 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
|
284 GstElement *pipeline; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
285 GstBus *bus; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
286 gchar *name; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
287 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
288 priv->conference = FS_CONFERENCE( |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
289 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
|
290 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
291 if (priv->conference == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
292 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
|
293 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
294 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
295 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
296 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
|
297 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
|
298 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
299 if (pipeline == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
300 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
301 "Couldn't retrieve pipeline.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
302 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
303 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
304 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
305 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
|
306 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
|
307 if (priv->confbin == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
308 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
309 "Couldn't create confbin.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
310 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
311 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
312 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
313 g_free(name); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
314 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
315 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
|
316 if (bus == NULL) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
317 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
318 "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
|
319 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
320 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
321 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
322 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
|
323 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
|
324 gst_object_unref(bus); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
325 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
326 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
|
327 GST_ELEMENT(priv->confbin))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
328 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
|
329 "element to the pipeline\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
330 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
331 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
332 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
333 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
|
334 GST_ELEMENT(priv->conference))) { |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
335 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
|
336 "element to the confbin\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
337 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
338 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
339 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
340 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
|
341 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
|
342 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
343 "Failed to start conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
344 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
345 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
346 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
347 return TRUE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
348 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
349 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
350 static gboolean |
29146 | 351 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self, |
352 const gchar *sess_id, const gchar *who, | |
353 PurpleMediaSessionType type, gboolean initiator, | |
354 const gchar *transmitter, | |
355 guint num_params, GParameter *params) | |
356 { | |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
357 PurpleMediaBackendFs2Private *priv = |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
358 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
|
359 |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
360 if (priv->conference == NULL && !_init_conference(self)) { |
29149
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
361 purple_debug_error("backend-fs2", |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
362 "Error initializing the conference.\n"); |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
363 return FALSE; |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
364 } |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
365 |
4aa30863743b
Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents:
29146
diff
changeset
|
366 return TRUE; |
29146 | 367 } |
368 | |
369 static void | |
370 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self, | |
371 const gchar *sess_id, const gchar *participant, | |
372 GList *remote_candidates) | |
373 { | |
374 } | |
375 | |
376 static GList * | |
377 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, | |
378 const gchar *sess_id) | |
379 { | |
380 return NULL; | |
381 } | |
382 | |
383 static GList * | |
384 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self, | |
385 const gchar *sess_id, const gchar *participant) | |
386 { | |
387 return NULL; | |
388 } | |
389 | |
390 static void | |
391 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, | |
392 const gchar *sess_id, const gchar *participant, | |
393 GList *codecs) | |
394 { | |
395 } | |
396 | |
397 static void | |
398 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, | |
399 const gchar *sess_id, PurpleMediaCodec *codec) | |
400 { | |
401 } | |
402 | |
29154
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
403 FsConference * |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
404 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
|
405 { |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
406 PurpleMediaBackendFs2Private *priv = |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
407 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
|
408 return priv->conference; |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
409 } |
2f8151fed0ae
Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents:
29149
diff
changeset
|
410 |