annotate libpurple/media/backend-fs2.c @ 29184:dfc724880907

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