annotate libpurple/media/backend-fs2.c @ 29179:a39696686dd6

Move set_remote_codecs functionality to the Fs2 media backend.
author maiku@pidgin.im
date Mon, 26 Oct 2009 23:10:53 +0000
parents a7cad99144f0
children 90c48f1e479a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1 /**
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2 * @file backend-fs2.c Farsight 2 backend for media API
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
3 * @ingroup core
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
4 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
5
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
6 /* purple
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
7 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
10 * source distribution.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
11 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
15 * (at your option) any later version.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
16 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
20 * GNU General Public License for more details.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
21 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
25 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
26
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
27 #include "backend-fs2.h"
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
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
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
31 #include "backend-iface.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
32 #include "debug.h"
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
33 #include "network.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
34 #include "media-gst.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
35
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
36 #include <gst/farsight/fs-conference-iface.h>
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
37 #include <gst/farsight/fs-element-added-notifier.h>
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
38
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
39 /** @copydoc _PurpleMediaBackendFs2Class */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
40 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
41 /** @copydoc _PurpleMediaBackendFs2Private */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
42 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private;
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
43 /** @copydoc _PurpleMediaBackendFs2Session */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
44 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
45 /** @copydoc _PurpleMediaBackendFs2Stream */
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
46 typedef struct _PurpleMediaBackendFs2Stream PurpleMediaBackendFs2Stream;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
47
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
48 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
49 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
50 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private))
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
51
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
52 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
53
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
54 static gboolean
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
55 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
56 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
57 _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
58 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
59 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
60 _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
61 gchar *sid, gchar *name, gboolean local,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
62 PurpleMediaBackendFs2 *self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
63
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
64 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
65 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
66 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
67 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
68 guint num_params, GParameter *params);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
69 static void purple_media_backend_fs2_add_remote_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
70 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
71 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
72 GList *remote_candidates);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
73 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
74 const gchar *sess_id);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
75 static GList *purple_media_backend_fs2_get_local_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
76 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
77 const gchar *sess_id, const gchar *participant);
29178
a7cad99144f0 Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents: 29177
diff changeset
78 static gboolean purple_media_backend_fs2_set_remote_codecs(
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
79 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
80 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
81 GList *codecs);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
82 static void purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
83 const gchar *sess_id, PurpleMediaCodec *codec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
84
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
85 struct _PurpleMediaBackendFs2Class
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
86 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
87 GObjectClass parent_class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
88 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
89
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
90 struct _PurpleMediaBackendFs2
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
91 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
92 GObject parent;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
93 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
94
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
95 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
96 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
97 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
98
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
99 struct _PurpleMediaBackendFs2Stream
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
100 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
101 PurpleMediaBackendFs2Session *session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
102 gchar *participant;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
103 FsStream *stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
104
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
105 GList *local_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
106 GList *remote_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
107
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
108 GList *active_local_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
109 GList *active_remote_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
110
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
111 guint connected_cb_id;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
112
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
113 gboolean initiator;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
114 gboolean accepted;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
115 gboolean candidates_prepared;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
116 };
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
117
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
118 struct _PurpleMediaBackendFs2Session
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
119 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
120 PurpleMediaBackendFs2 *backend;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
121 gchar *id;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
122 gboolean initiator;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
123 FsSession *session;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
124 PurpleMediaSessionType type;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
125 };
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
126
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
127 struct _PurpleMediaBackendFs2Private
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
128 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
129 PurpleMedia *media;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
130 GstElement *confbin;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
131 FsConference *conference;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
132 gchar *conference_type;
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
133
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
134 GHashTable *sessions;
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
135 GHashTable *participants;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
136
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
137 GList *streams;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
138 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
139
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
140 enum {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
141 PROP_0,
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
142 PROP_CONFERENCE_TYPE,
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
143 PROP_MEDIA,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
144 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
145
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
146 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
147 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
148 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
149 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
150
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
151 static void
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
152 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
153 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
154 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
155 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
156
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
157 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
158
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
159 if (priv->confbin) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
160 GstElement *pipeline;
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 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
163 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
164
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
165 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
166 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
167 GST_STATE_NULL);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
168
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
169 if (pipeline) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
170 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
171 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
172 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
173 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
174 G_SIGNAL_MATCH_FUNC |
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
175 G_SIGNAL_MATCH_DATA,
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
176 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
177 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
178 } else {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
179 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
180 "properly dispose the conference. "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
181 "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
182 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
183
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
184 priv->confbin = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
185 priv->conference = NULL;
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
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
189 if (priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
190 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
191
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
192 for (; sessions; sessions =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
193 g_list_delete_link(sessions, sessions)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
194 PurpleMediaBackendFs2Session *session =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
195 sessions->data;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
196
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
197 if (session->session) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
198 g_object_unref(session->session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
199 session->session = NULL;
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 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
202 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
203
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
204 if (priv->participants) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
205 GList *participants =
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
206 g_hash_table_get_values(priv->participants);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
207 for (; participants; participants = g_list_delete_link(
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
208 participants, participants))
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
209 g_object_unref(participants->data);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
210 priv->participants = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
211 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
212
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
213 if (priv->media) {
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
214 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
215 (gpointer*)&priv->media);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
216 priv->media = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
217 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
218
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
219 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
220 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
221
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
222 static void
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
223 purple_media_backend_fs2_finalize(GObject *obj)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
224 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
225 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
226 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
227
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
228 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
229
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
230 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
231
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
232 if (priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
233 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
234
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
235 for (; sessions; sessions =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
236 g_list_delete_link(sessions, sessions)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
237 PurpleMediaBackendFs2Session *session =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
238 sessions->data;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
239 g_free(session->id);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
240 g_free(session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
241 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
242
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
243 g_hash_table_destroy(priv->sessions);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
244 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
245
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
246 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj);
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
247 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
248
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
249 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
250 purple_media_backend_fs2_set_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
251 const GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
252 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
253 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
254 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
255
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
256 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
257
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
258 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
259 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
260 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
261 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
262 case PROP_MEDIA:
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
263 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
264
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
265 if (priv->media == NULL)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
266 break;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
267
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
268 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
269 (gpointer*)&priv->media);
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 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
272 "state-changed",
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
273 G_CALLBACK(_state_changed_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
274 PURPLE_MEDIA_BACKEND_FS2(object));
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
275 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
276 G_CALLBACK(_stream_info_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
277 PURPLE_MEDIA_BACKEND_FS2(object));
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
278 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
279 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
280 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
281 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
282 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
283 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
284 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
285
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
286 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
287 purple_media_backend_fs2_get_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
288 GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
289 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
290 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
291 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
292
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
293 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
294
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
295 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
296 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
297 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
298 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
299 case PROP_MEDIA:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
300 g_value_set_object(value, priv->media);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
301 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
302 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
303 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
304 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
305 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
306 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
307 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
308
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
309 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
310 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
311 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
312 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
313
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
314 gobject_class->dispose = purple_media_backend_fs2_dispose;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
315 gobject_class->finalize = purple_media_backend_fs2_finalize;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
316 gobject_class->set_property = purple_media_backend_fs2_set_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
317 gobject_class->get_property = purple_media_backend_fs2_get_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
318
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
319 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
320 "conference-type");
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
321 g_object_class_override_property(gobject_class, PROP_MEDIA, "media");
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
322
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
323 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
324 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
325
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
326 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
327 purple_media_backend_iface_init(PurpleMediaBackendIface *iface)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
328 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
329 iface->add_stream = purple_media_backend_fs2_add_stream;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
330 iface->add_remote_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
331 purple_media_backend_fs2_add_remote_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
332 iface->get_codecs = purple_media_backend_fs2_get_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
333 iface->get_local_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
334 purple_media_backend_fs2_get_local_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
335 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
336 iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
337 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
338
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
339 static FsMediaType
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
340 _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
341 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
342 if (type & PURPLE_MEDIA_AUDIO)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
343 return FS_MEDIA_TYPE_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
344 else if (type & PURPLE_MEDIA_VIDEO)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
345 return FS_MEDIA_TYPE_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
346 else
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
347 return 0;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
348 }
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 static FsStreamDirection
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
351 _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
352 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
353 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
354 (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
355 return FS_DIRECTION_BOTH;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
356 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
357 (type & PURPLE_MEDIA_SEND_VIDEO))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
358 return FS_DIRECTION_SEND;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
359 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
360 (type & PURPLE_MEDIA_RECV_VIDEO))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
361 return FS_DIRECTION_RECV;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
362 else
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
363 return FS_DIRECTION_NONE;
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
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
366 static PurpleMediaSessionType
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
367 _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
368 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
369 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
370 if (type == FS_MEDIA_TYPE_AUDIO) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
371 if (direction & FS_DIRECTION_SEND)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
372 result |= PURPLE_MEDIA_SEND_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
373 if (direction & FS_DIRECTION_RECV)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
374 result |= PURPLE_MEDIA_RECV_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
375 } 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
376 if (direction & FS_DIRECTION_SEND)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
377 result |= PURPLE_MEDIA_SEND_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
378 if (direction & FS_DIRECTION_RECV)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
379 result |= PURPLE_MEDIA_RECV_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
380 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
381 return result;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
382 }
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
383
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
384 static FsCandidate *
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
385 _candidate_to_fs(PurpleMediaCandidate *candidate)
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
386 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
387 FsCandidate *fscandidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
388 gchar *foundation;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
389 guint component_id;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
390 gchar *ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
391 guint port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
392 gchar *base_ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
393 guint base_port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
394 PurpleMediaNetworkProtocol proto;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
395 guint32 priority;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
396 PurpleMediaCandidateType type;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
397 gchar *username;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
398 gchar *password;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
399 guint ttl;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
400
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
401 if (candidate == NULL)
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
402 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
403
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
404 g_object_get(G_OBJECT(candidate),
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
405 "foundation", &foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
406 "component-id", &component_id,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
407 "ip", &ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
408 "port", &port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
409 "base-ip", &base_ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
410 "base-port", &base_port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
411 "protocol", &proto,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
412 "priority", &priority,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
413 "type", &type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
414 "username", &username,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
415 "password", &password,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
416 "ttl", &ttl,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
417 NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
418
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
419 fscandidate = fs_candidate_new(foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
420 component_id, type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
421 proto, ip, port);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
422
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
423 fscandidate->base_ip = base_ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
424 fscandidate->base_port = base_port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
425 fscandidate->priority = priority;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
426 fscandidate->username = username;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
427 fscandidate->password = password;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
428 fscandidate->ttl = ttl;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
429
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
430 g_free(foundation);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
431 g_free(ip);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
432 return fscandidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
433 }
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
434
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
435 static GList *
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
436 _candidate_list_to_fs(GList *candidates)
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
437 {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
438 GList *new_list = NULL;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
439
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
440 for (; candidates; candidates = g_list_next(candidates)) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
441 new_list = g_list_prepend(new_list,
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
442 _candidate_to_fs(candidates->data));
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
443 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
444
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
445 new_list = g_list_reverse(new_list);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
446 return new_list;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
447 }
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
448
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
449 static PurpleMediaCandidate *
29176
cc0d1fbe9c71 Rename purple_media_candidate_from_fs to _candidate_from_fs for consistency.
maiku@pidgin.im
parents: 29175
diff changeset
450 _candidate_from_fs(FsCandidate *fscandidate)
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
451 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
452 PurpleMediaCandidate *candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
453
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
454 if (fscandidate == NULL)
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
455 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
456
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
457 candidate = purple_media_candidate_new(fscandidate->foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
458 fscandidate->component_id, fscandidate->type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
459 fscandidate->proto, fscandidate->ip, fscandidate->port);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
460 g_object_set(candidate,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
461 "base-ip", fscandidate->base_ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
462 "base-port", fscandidate->base_port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
463 "priority", fscandidate->priority,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
464 "username", fscandidate->username,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
465 "password", fscandidate->password,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
466 "ttl", fscandidate->ttl, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
467 return candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
468 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
469
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
470 static GList *
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
471 _candidate_list_from_fs(GList *candidates)
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
472 {
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
473 GList *new_list = NULL;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
474
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
475 for (; candidates; candidates = g_list_next(candidates)) {
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
476 new_list = g_list_prepend(new_list,
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
477 _candidate_from_fs(candidates->data));
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
478 }
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
479
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
480 new_list = g_list_reverse(new_list);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
481 return new_list;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
482 }
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
483
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
484 static FsCodec *
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
485 _codec_to_fs(const PurpleMediaCodec *codec)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
486 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
487 FsCodec *new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
488 gint id;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
489 char *encoding_name;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
490 PurpleMediaSessionType media_type;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
491 guint clock_rate;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
492 guint channels;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
493 GList *iter;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
494
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
495 if (codec == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
496 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
497
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
498 g_object_get(G_OBJECT(codec),
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
499 "id", &id,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
500 "encoding-name", &encoding_name,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
501 "media-type", &media_type,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
502 "clock-rate", &clock_rate,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
503 "channels", &channels,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
504 "optional-params", &iter,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
505 NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
506
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
507 new_codec = fs_codec_new(id, encoding_name,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
508 _session_type_to_fs_media_type(media_type),
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
509 clock_rate);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
510 new_codec->channels = channels;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
511
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
512 for (; iter; iter = g_list_next(iter)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
513 PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
514 fs_codec_add_optional_parameter(new_codec,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
515 param->key, param->value);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
516 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
517
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
518 g_free(encoding_name);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
519 return new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
520 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
521
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
522 static PurpleMediaCodec *
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
523 _codec_from_fs(const FsCodec *codec)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
524 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
525 PurpleMediaCodec *new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
526 GList *iter;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
527
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
528 if (codec == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
529 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
530
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
531 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
532 _session_type_from_fs(codec->media_type,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
533 FS_DIRECTION_BOTH), codec->clock_rate);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
534 g_object_set(new_codec, "channels", codec->channels, NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
535
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
536 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
537 FsCodecParameter *param = (FsCodecParameter*)iter->data;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
538 purple_media_codec_add_optional_parameter(new_codec,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
539 param->name, param->value);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
540 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
541
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
542 return new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
543 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
544
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
545 static GList *
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
546 _codec_list_from_fs(GList *codecs)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
547 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
548 GList *new_list = NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
549
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
550 for (; codecs; codecs = g_list_next(codecs)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
551 new_list = g_list_prepend(new_list,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
552 _codec_from_fs(codecs->data));
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
553 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
554
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
555 new_list = g_list_reverse(new_list);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
556 return new_list;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
557 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
558
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
559 static GList *
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
560 _codec_list_to_fs(GList *codecs)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
561 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
562 GList *new_list = NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
563
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
564 for (; codecs; codecs = g_list_next(codecs)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
565 new_list = g_list_prepend(new_list,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
566 _codec_to_fs(codecs->data));
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
567 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
568
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
569 new_list = g_list_reverse(new_list);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
570 return new_list;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
571 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
572
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
573 static PurpleMediaBackendFs2Session *
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
574 _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
575 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
576 PurpleMediaBackendFs2Private *priv;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
577 PurpleMediaBackendFs2Session *session = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
578
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
579 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
580
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
581 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
582
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
583 if (priv->sessions != NULL)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
584 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
585
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
586 return session;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
587 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
588
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
589 static FsParticipant *
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
590 _get_participant(PurpleMediaBackendFs2 *self, const gchar *name)
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
591 {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
592 PurpleMediaBackendFs2Private *priv;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
593 FsParticipant *participant = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
594
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
595 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
596
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
597 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
598
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
599 if (priv->participants != NULL)
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
600 participant = g_hash_table_lookup(priv->participants, name);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
601
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
602 return participant;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
603 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
604
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
605 static PurpleMediaBackendFs2Stream *
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
606 _get_stream(PurpleMediaBackendFs2 *self,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
607 const gchar *sess_id, const gchar *name)
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
608 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
609 PurpleMediaBackendFs2Private *priv;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
610 GList *streams;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
611
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
612 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
613
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
614 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
615 streams = priv->streams;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
616
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
617 for (; streams; streams = g_list_next(streams)) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
618 PurpleMediaBackendFs2Stream *stream = streams->data;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
619 if (!strcmp(stream->session->id, sess_id) &&
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
620 !strcmp(stream->participant, name))
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
621 return stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
622 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
623
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
624 return NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
625 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
626
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
627 static PurpleMediaBackendFs2Session *
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
628 _get_session_from_fs_stream(PurpleMediaBackendFs2 *self, FsStream *stream)
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
629 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
630 PurpleMediaBackendFs2Private *priv =
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
631 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
632 FsSession *fssession;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
633 GList *values;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
634
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
635 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
636 g_return_val_if_fail(FS_IS_STREAM(stream), NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
637
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
638 g_object_get(stream, "session", &fssession, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
639
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
640 values = g_hash_table_get_values(priv->sessions);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
641
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
642 for (; values; values = g_list_delete_link(values, values)) {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
643 PurpleMediaBackendFs2Session *session = values->data;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
644
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
645 if (session->session == fssession) {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
646 g_list_free(values);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
647 g_object_unref(fssession);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
648 return session;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
649 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
650 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
651
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
652 g_object_unref(fssession);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
653 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
654 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
655
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
656 static void
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
657 _gst_handle_message_element(GstBus *bus, GstMessage *msg,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
658 PurpleMediaBackendFs2 *self)
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
659 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
660 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
661 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
662 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
663
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
664 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
665 priv->conference != FS_CONFERENCE(src))
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
666 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
667
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
668 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
669 FsError error_no;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
670 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
671 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
672 switch (error_no) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
673 case FS_ERROR_NO_CODECS:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
674 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
675 " found. Install some"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
676 " GStreamer codecs found"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
677 " in GStreamer plugins"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
678 " packages."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
679 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
680 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
681 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
682 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
683 " left. Your codec"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
684 " preferences in"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
685 " fs-codecs.conf are too"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
686 " strict."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
687 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
688 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
689 case FS_ERROR_UNKNOWN_CNAME:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
690 /*
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
691 * 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
692 * 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
693 * It is also deprecated.
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
694 */
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
695 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
696 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
697 purple_debug_error("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
698 "farsight-error: %i: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
699 error_no,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
700 gst_structure_get_string(
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
701 msg->structure, "error-msg"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
702 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
703 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
704
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
705 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
706 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
707 "Farsight2 error has occurred."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
708 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
709 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
710 } 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
711 "farsight-new-local-candidate")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
712 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
713 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
714 FsCandidate *local_candidate;
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
715 PurpleMediaCandidate *candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
716 FsParticipant *participant;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
717 PurpleMediaBackendFs2Session *session;
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
718 PurpleMediaBackendFs2Stream *media_stream;
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
719 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
720
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
721 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
722 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
723 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
724 local_candidate = g_value_get_boxed(value);
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
725
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
726 session = _get_session_from_fs_stream(self, stream);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
727
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
728 purple_debug_info("backend-fs2",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
729 "got new local candidate: %s\n",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
730 local_candidate->foundation);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
731
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
732 g_object_get(stream, "participant", &participant, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
733 g_object_get(participant, "cname", &name, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
734 g_object_unref(participant);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
735
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
736 media_stream = _get_stream(self, session->id, name);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
737 media_stream->local_candidates = g_list_append(
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
738 media_stream->local_candidates,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
739 fs_candidate_copy(local_candidate));
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
740
29176
cc0d1fbe9c71 Rename purple_media_candidate_from_fs to _candidate_from_fs for consistency.
maiku@pidgin.im
parents: 29175
diff changeset
741 candidate = _candidate_from_fs(local_candidate);
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
742 g_signal_emit_by_name(self, "new-candidate",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
743 session->id, name, candidate);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
744 g_object_unref(candidate);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
745 } 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
746 "farsight-local-candidates-prepared")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
747 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
748 FsStream *stream;
29163
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
749 FsParticipant *participant;
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
750 PurpleMediaBackendFs2Session *session;
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
751 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
752
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
753 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
754 stream = g_value_get_object(value);
29163
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
755 session = _get_session_from_fs_stream(self, stream);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
756
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
757 g_object_get(stream, "participant", &participant, NULL);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
758 g_object_get(participant, "cname", &name, NULL);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
759 g_object_unref(participant);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
760
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
761 g_signal_emit_by_name(self, "candidates-prepared",
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
762 session->id, name);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
763 } 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
764 "farsight-new-active-candidate-pair")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
765 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
766 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
767 FsCandidate *local_candidate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
768 FsCandidate *remote_candidate;
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
769 FsParticipant *participant;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
770 PurpleMediaBackendFs2Session *session;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
771 PurpleMediaCandidate *lcandidate, *rcandidate;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
772 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
773
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
774 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
775 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
776 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
777 "local-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
778 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
779 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
780 "remote-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
781 remote_candidate = g_value_get_boxed(value);
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
782
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
783 g_object_get(stream, "participant", &participant, NULL);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
784 g_object_get(participant, "cname", &name, NULL);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
785 g_object_unref(participant);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
786
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
787 session = _get_session_from_fs_stream(self, stream);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
788
29176
cc0d1fbe9c71 Rename purple_media_candidate_from_fs to _candidate_from_fs for consistency.
maiku@pidgin.im
parents: 29175
diff changeset
789 lcandidate = _candidate_from_fs(local_candidate);
cc0d1fbe9c71 Rename purple_media_candidate_from_fs to _candidate_from_fs for consistency.
maiku@pidgin.im
parents: 29175
diff changeset
790 rcandidate = _candidate_from_fs(remote_candidate);
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
791
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
792 g_signal_emit_by_name(self, "active-candidate-pair",
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
793 session->id, name, lcandidate, rcandidate);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
794
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
795 g_object_unref(lcandidate);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
796 g_object_unref(rcandidate);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
797 } 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
798 "farsight-recv-codecs-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
799 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
800 GList *codecs;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
801 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
802
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
803 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
804 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
805 codec = codecs->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
806
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
807 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
808 "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
809 codec->encoding_name);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
810 } 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
811 "farsight-component-state-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
812 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
813 FsStreamState fsstate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
814 guint component;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
815 const gchar *state;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
816
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
817 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
818 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
819 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
820 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
821
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
822 switch (fsstate) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
823 case FS_STREAM_STATE_FAILED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
824 state = "FAILED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
825 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
826 case FS_STREAM_STATE_DISCONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
827 state = "DISCONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
828 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
829 case FS_STREAM_STATE_GATHERING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
830 state = "GATHERING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
831 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
832 case FS_STREAM_STATE_CONNECTING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
833 state = "CONNECTING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
834 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
835 case FS_STREAM_STATE_CONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
836 state = "CONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
837 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
838 case FS_STREAM_STATE_READY:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
839 state = "READY";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
840 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
841 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
842 state = "UNKNOWN";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
843 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
844 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
845
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
846 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
847 "farsight-component-state-changed: "
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
848 "component: %u state: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
849 component, state);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
850 } 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
851 "farsight-send-codec-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
852 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
853 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
854 gchar *codec_str;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
855
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
856 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
857 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
858 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
859
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
860 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
861 "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
862 codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
863
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
864 g_free(codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
865 } 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
866 "farsight-codecs-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
867 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
868 FsSession *fssession;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
869 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
870
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
871 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
872 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
873 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
874
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
875 for (; sessions; sessions =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
876 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
877 PurpleMediaBackendFs2Session *session = sessions->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
878 gchar *session_id;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
879
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
880 if (session->session != fssession)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
881 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
882
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
883 session_id = g_strdup(session->id);
29161
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29160
diff changeset
884 g_signal_emit_by_name(self, "codecs-changed",
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29160
diff changeset
885 session_id);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
886 g_free(session_id);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
887 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
888 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
889 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
890 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
891 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
892
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
893 static void
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
894 _gst_handle_message_error(GstBus *bus, GstMessage *msg,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
895 PurpleMediaBackendFs2 *self)
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
896 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
897 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
898 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
899 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
900 GstElement *lastElement = NULL;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
901 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
902
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
903 while (!GST_IS_PIPELINE(element)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
904 if (element == priv->confbin)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
905 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
906
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
907 lastElement = element;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
908 element = GST_ELEMENT_PARENT(element);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
909 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
910
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
911 if (!GST_IS_PIPELINE(element))
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
912 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
913
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
914 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
915
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
916 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
917 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
918 != lastElement)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
919 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
920
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
921 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
922 & PURPLE_MEDIA_AUDIO)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
923 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
924 _("Error with your microphone"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
925 else
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
926 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
927 _("Error with your webcam"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
928
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
929 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
930 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
931
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
932 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
933
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
934 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
935 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
936 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
937
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
938 static gboolean
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
939 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self)
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
940 {
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
941 switch(GST_MESSAGE_TYPE(msg)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
942 case GST_MESSAGE_ELEMENT:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
943 _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
944 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
945 case GST_MESSAGE_ERROR:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
946 _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
947 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
948 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
949 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
950 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
951
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
952 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
953 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
954
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
955 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
956 _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
957 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
958 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
959 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
960
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
961 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
962 _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
963 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
964 PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
965 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
966 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
967
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
968 static gboolean
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
969 _init_conference(PurpleMediaBackendFs2 *self)
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
970 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
971 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
972 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
973 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
974 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
975 gchar *name;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
976
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
977 priv->conference = FS_CONFERENCE(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
978 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
979
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
980 if (priv->conference == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
981 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
982 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
983 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
984
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
985 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
986 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
987
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
988 if (pipeline == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
989 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
990 "Couldn't retrieve pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
991 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
992 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
993
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
994 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
995 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
996 if (priv->confbin == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
997 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
998 "Couldn't create confbin.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
999 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1000 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1001
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1002 g_free(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1003
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1004 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
1005 if (bus == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1006 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1007 "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
1008 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1009 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1010
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1011 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
1012 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
1013 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1014
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1015 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
1016 GST_ELEMENT(priv->confbin))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1017 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
1018 "element to the pipeline\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1019 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1020 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1021
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1022 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
1023 GST_ELEMENT(priv->conference))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1024 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
1025 "element to the confbin\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1026 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1027 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1028
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1029 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
1030 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
1031 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1032 "Failed to start conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1033 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1034 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1035
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1036 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1037 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1038
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1039 static void
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1040 _gst_element_added_cb(FsElementAddedNotifier *self,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1041 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
1042 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1043 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1044 * 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
1045 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1046 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
1047 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
1048 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1049 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1050
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1051 static gboolean
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1052 _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
1053 PurpleMediaSessionType type, gboolean initiator,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1054 const gchar *transmitter)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1055 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1056 PurpleMediaBackendFs2Private *priv =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1057 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
1058 PurpleMediaBackendFs2Session *session;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1059 GError *err = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1060 GList *codec_conf = NULL, *iter = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1061 gchar *filename = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1062 gboolean is_nice = !strcmp(transmitter, "nice");
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1063
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1064 session = g_new0(PurpleMediaBackendFs2Session, 1);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1065
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1066 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
1067 _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
1068
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1069 if (err != NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1070 purple_media_error(priv->media,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1071 _("Error creating session: %s"),
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1072 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1073 g_error_free(err);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1074 g_free(session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1075 return FALSE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1076 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1077
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1078 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
1079 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
1080 g_free(filename);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1081
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1082 if (err != NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1083 if (err->code == 4)
29170
7b0931b3e060 Correct some debug categories.
maiku@pidgin.im
parents: 29169
diff changeset
1084 purple_debug_info("backend-fs2", "Couldn't read "
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1085 "fs-codec.conf: %s\n",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1086 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1087 else
29170
7b0931b3e060 Correct some debug categories.
maiku@pidgin.im
parents: 29169
diff changeset
1088 purple_debug_error("backend-fs2", "Error reading "
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1089 "fs-codec.conf: %s\n",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1090 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1091 g_error_free(err);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1092 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1093
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1094 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1095 * 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
1096 * there isn't a speex entry.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1097 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1098 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
1099 FsCodec *codec = iter->data;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1100 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
1101 break;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1102 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1103
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1104 if (iter == NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1105 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
1106 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
1107 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1108 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
1109 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
1110 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1111 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1112
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1113 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
1114 fs_codec_list_destroy(codec_conf);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1115
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1116 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1117 * 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
1118 * receiving the src-pad-added signal.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1119 * Only works for non-multicast FsRtpSessions.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1120 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1121 if (is_nice || !strcmp(transmitter, "rawudp"))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1122 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
1123 "no-rtcp-timeout", 0, NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1124
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1125 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1126 * 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
1127 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1128 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
1129 FsElementAddedNotifier *notifier =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1130 fs_element_added_notifier_new();
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1131 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
1132 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
1133 fs_element_added_notifier_add(notifier,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1134 GST_BIN(priv->conference));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1135 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1136
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1137 session->id = g_strdup(sess_id);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1138 session->backend = self;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1139 session->type = type;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1140 session->initiator = initiator;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1141
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1142 if (!priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1143 purple_debug_info("backend-fs2",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1144 "Creating hash table for sessions\n");
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1145 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
1146 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1147
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1148 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
1149
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1150 return TRUE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1151 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1152
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1153 static gboolean
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1154 _create_participant(PurpleMediaBackendFs2 *self, const gchar *name)
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1155 {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1156 PurpleMediaBackendFs2Private *priv =
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1157 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1158 FsParticipant *participant;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1159 GError *err = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1160
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1161 participant = fs_conference_new_participant(
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1162 priv->conference, name, &err);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1163
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1164 if (err) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1165 purple_debug_error("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1166 "Error creating participant: %s\n",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1167 err->message);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1168 g_error_free(err);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1169 return FALSE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1170 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1171
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1172 if (!priv->participants) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1173 purple_debug_info("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1174 "Creating hash table for participants\n");
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1175 priv->participants = g_hash_table_new_full(g_str_hash,
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1176 g_str_equal, g_free, NULL);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1177 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1178
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1179 g_hash_table_insert(priv->participants, g_strdup(name), participant);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1180
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1181 g_signal_emit_by_name(priv->media, "state-changed",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1182 PURPLE_MEDIA_STATE_NEW, NULL, name);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1183
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1184 return TRUE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1185 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1186
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1187 static gboolean
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1188 _create_stream(PurpleMediaBackendFs2 *self,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1189 const gchar *sess_id, const gchar *who,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1190 PurpleMediaSessionType type, gboolean initiator,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1191 const gchar *transmitter,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1192 guint num_params, GParameter *params)
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1193 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1194 PurpleMediaBackendFs2Private *priv =
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1195 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1196 GError *err = NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1197 FsStream *fsstream = NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1198 const gchar *stun_ip = purple_network_get_stun_ip();
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1199 const gchar *turn_ip = purple_network_get_turn_ip();
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1200 guint _num_params = num_params;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1201 GParameter *_params = g_new0(GParameter, num_params + 2);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1202 FsStreamDirection type_direction =
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1203 _session_type_to_fs_stream_direction(type);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1204 PurpleMediaBackendFs2Session *session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1205 PurpleMediaBackendFs2Stream *stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1206 FsParticipant *participant;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1207
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1208 memcpy(_params, params, sizeof(GParameter) * num_params);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1209
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1210 if (stun_ip) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1211 purple_debug_info("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1212 "Setting stun-ip on new stream: %s\n", stun_ip);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1213
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1214 _params[_num_params].name = "stun-ip";
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1215 g_value_init(&_params[_num_params].value, G_TYPE_STRING);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1216 g_value_set_string(&_params[_num_params].value, stun_ip);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1217 ++_num_params;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1218 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1219
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1220 if (turn_ip && !strcmp("nice", transmitter)) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1221 GValueArray *relay_info = g_value_array_new(0);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1222 GValue value;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1223 gint turn_port = purple_prefs_get_int(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1224 "/purple/network/turn_port");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1225 const gchar *username = purple_prefs_get_string(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1226 "/purple/network/turn_username");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1227 const gchar *password = purple_prefs_get_string(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1228 "/purple/network/turn_password");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1229 GstStructure *turn_setup = gst_structure_new("relay-info",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1230 "ip", G_TYPE_STRING, turn_ip,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1231 "port", G_TYPE_UINT, turn_port,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1232 "username", G_TYPE_STRING, username,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1233 "password", G_TYPE_STRING, password,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1234 NULL);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1235
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1236 if (!turn_setup) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1237 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1238 "Error creating relay info structure");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1239 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1240 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1241
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1242 memset(&value, 0, sizeof(GValue));
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1243 g_value_init(&value, GST_TYPE_STRUCTURE);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1244 gst_value_set_structure(&value, turn_setup);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1245 relay_info = g_value_array_append(relay_info, &value);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1246 gst_structure_free(turn_setup);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1247
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1248 purple_debug_info("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1249 "Setting relay-info on new stream\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1250 _params[_num_params].name = "relay-info";
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1251 g_value_init(&_params[_num_params].value,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1252 G_TYPE_VALUE_ARRAY);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1253 g_value_set_boxed(&_params[_num_params].value,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1254 relay_info);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1255 g_value_array_free(relay_info);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1256 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1257
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1258 session = _get_session(self, sess_id);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1259
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1260 if (session == NULL) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1261 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1262 "Couldn't find session to create stream.\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1263 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1264 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1265
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1266 participant = _get_participant(self, who);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1267
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1268 if (participant == NULL) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1269 purple_debug_error("backend-fs2", "Couldn't find "
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1270 "participant to create stream.\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1271 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1272 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1273
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1274 fsstream = fs_session_new_stream(session->session, participant,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1275 type_direction & FS_DIRECTION_RECV, transmitter,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1276 _num_params, _params, &err);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1277 g_free(_params);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1278
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1279 if (fsstream == NULL) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1280 if (err) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1281 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1282 "Error creating stream: %s\n",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1283 err && err->message ?
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1284 err->message : "NULL");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1285 g_error_free(err);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1286 } else
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1287 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1288 "Error creating stream\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1289 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1290 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1291
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1292 stream = g_new0(PurpleMediaBackendFs2Stream, 1);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1293 stream->initiator = initiator;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1294 stream->participant = g_strdup(who);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1295 stream->session = session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1296 stream->stream = fsstream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1297
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1298 priv->streams = g_list_append(priv->streams, stream);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1299
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1300 return TRUE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1301 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1302
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1303 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1304 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1305 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1306 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1307 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1308 guint num_params, GParameter *params)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1309 {
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1310 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
1311 PurpleMediaBackendFs2Private *priv =
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1312 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
1313
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1314 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
1315 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1316 "Error initializing the conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1317 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1318 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1319
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1320 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
1321 !_create_session(backend, sess_id, type,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1322 initiator, transmitter)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1323 purple_debug_error("backend-fs2",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1324 "Error creating the session.\n");
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1325 return FALSE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1326 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1327
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1328 if (_get_participant(backend, who) == NULL &&
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1329 !_create_participant(backend, who)) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1330 purple_debug_error("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1331 "Error creating the participant.\n");
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1332 return FALSE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1333 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1334
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1335 if (_get_stream(backend, sess_id, who) == NULL &&
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1336 !_create_stream(backend, sess_id, who, type,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1337 initiator, transmitter, num_params, params)) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1338 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1339 "Error creating the stream.\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1340 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1341 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1342
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1343 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1344 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1345
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1346 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1347 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1348 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1349 GList *remote_candidates)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1350 {
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1351 PurpleMediaBackendFs2Private *priv;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1352 PurpleMediaBackendFs2Stream *stream;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1353 GError *err = NULL;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1354
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1355 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1356
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1357 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1358 stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1359 sess_id, participant);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1360
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1361 if (stream == NULL) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1362 purple_debug_error("backend-fs2",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1363 "purple_media_add_remote_candidates: "
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1364 "couldn't find stream %s %s.\n",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1365 sess_id ? sess_id : "(null)",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1366 participant ? participant : "(null)");
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1367 return;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1368 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1369
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1370 stream->remote_candidates = g_list_concat(stream->remote_candidates,
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1371 _candidate_list_to_fs(remote_candidates));
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1372
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1373 if (purple_media_accepted(priv->media, sess_id, participant)) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1374 fs_stream_set_remote_candidates(stream->stream,
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1375 stream->remote_candidates, &err);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1376
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1377 if (err) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1378 purple_debug_error("backend-fs2", "Error adding remote"
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1379 " candidates: %s\n", err->message);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1380 g_error_free(err);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1381 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
1382 }
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1383 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1384
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1385 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1386 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1387 const gchar *sess_id)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1388 {
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1389 PurpleMediaBackendFs2Private *priv;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1390 PurpleMediaBackendFs2Session *session;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1391 GList *fscodecs;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1392 GList *codecs;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1393
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1394 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1395
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1396 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1397
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1398 session = _get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1399
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1400 if (session == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1401 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1402
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1403 g_object_get(G_OBJECT(session->session),
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1404 "codecs", &fscodecs, NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1405 codecs = _codec_list_from_fs(fscodecs);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1406 fs_codec_list_destroy(fscodecs);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1407
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
1408 return codecs;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1409 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1410
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1411 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1412 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1413 const gchar *sess_id, const gchar *participant)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1414 {
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1415 PurpleMediaBackendFs2Stream *stream;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1416 GList *candidates = NULL;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1417
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1418 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1419
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1420 stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1421 sess_id, participant);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1422
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1423 if (stream != NULL)
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1424 candidates = _candidate_list_from_fs(
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1425 stream->local_candidates);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
1426 return candidates;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1427 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1428
29178
a7cad99144f0 Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents: 29177
diff changeset
1429 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1430 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1431 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1432 GList *codecs)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1433 {
29179
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1434 PurpleMediaBackendFs2Stream *stream;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1435 GList *fscodecs;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1436 GError *err = NULL;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1437
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1438 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1439 stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1440 sess_id, participant);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1441
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1442 if (stream == NULL)
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1443 return FALSE;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1444
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1445 fscodecs = _codec_list_to_fs(codecs);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1446 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1447 fs_codec_list_destroy(fscodecs);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1448
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1449 if (err) {
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1450 purple_debug_error("backend-fs2",
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1451 "Error setting remote codecs: %s\n",
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1452 err->message);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1453 g_error_free(err);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1454 return FALSE;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1455 }
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1456
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
1457 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1458 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1459
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1460 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1461 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1462 const gchar *sess_id, PurpleMediaCodec *codec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1463 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1464 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1465
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1466 FsConference *
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1467 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
1468 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1469 PurpleMediaBackendFs2Private *priv =
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1470 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
1471 return priv->conference;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1472 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1473
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1474 FsSession *
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1475 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
1476 const gchar *sess_id)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1477 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1478 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
1479 return session != NULL? session->session : NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1480 }
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1481
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1482 FsParticipant *
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1483 purple_media_backend_fs2_get_participant(PurpleMediaBackendFs2 *self,
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1484 const gchar *name)
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1485 {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1486 return _get_participant(self, name);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1487 }
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1488
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1489 FsStream *
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1490 purple_media_backend_fs2_get_stream(PurpleMediaBackendFs2 *self,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1491 const gchar *sess_id, const gchar *who)
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1492 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1493 PurpleMediaBackendFs2Stream *stream =
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1494 _get_stream(self, sess_id, who);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1495 return stream != NULL? stream->stream : NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1496 }