libpurple/media/backend-fs2.c

Tue, 28 Dec 2010 11:03:37 +0000

author
Jakub Adam <jakub.adam@ktknet.cz>
date
Tue, 28 Dec 2010 11:03:37 +0000
changeset 31278
3314c614763c
parent 30769
9d5a0d01b443
child 31294
73607ab89c6f
permissions
-rw-r--r--

Stop sending audio when placing a call on hold. Fixes #13032.


committer: John Bailey <rekkanoryo@rekkanoryo.org>

29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1 /**
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
2 * @file backend-fs2.c Farsight 2 backend for media API
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
3 * @ingroup core
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
4 */
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
5
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
6 /* purple
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
7 *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * source distribution.
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
11 *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * (at your option) any later version.
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
16 *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20 * GNU General Public License for more details.
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
21 *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
25 */
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
26
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
27 #include "internal.h"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
28
29661
ae75a0a4d399 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29657
diff changeset
29 #include "backend-fs2.h"
ae75a0a4d399 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29657
diff changeset
30
29723
d20be93c4c8d Compile with --disable-vv. Without this change I get this error:
Mark Doliner <markdoliner@pidgin.im>
parents: 29688
diff changeset
31 #ifdef USE_VV
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 #include "backend-iface.h"
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
33 #include "debug.h"
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
34 #include "network.h"
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
35 #include "media-gst.h"
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
36
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
37 #include <gst/farsight/fs-conference-iface.h>
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
38 #include <gst/farsight/fs-element-added-notifier.h>
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
39
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 /** @copydoc _PurpleMediaBackendFs2Class */
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
42 /** @copydoc _PurpleMediaBackendFs2Private */
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
43 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private;
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
44 /** @copydoc _PurpleMediaBackendFs2Session */
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
45 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session;
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
46 /** @copydoc _PurpleMediaBackendFs2Stream */
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
47 typedef struct _PurpleMediaBackendFs2Stream PurpleMediaBackendFs2Stream;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
48
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
49 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
51 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private))
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
52
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
53 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
54
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
55 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
56 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self);
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
57 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
58 state_changed_cb(PurpleMedia *media, PurpleMediaState state,
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
59 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self);
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
60 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
61 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
62 gchar *sid, gchar *name, gboolean local,
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
63 PurpleMediaBackendFs2 *self);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
64
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
65 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
66 const gchar *sess_id, const gchar *who,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
67 PurpleMediaSessionType type, gboolean initiator,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
68 const gchar *transmitter,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
69 guint num_params, GParameter *params);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
70 static void purple_media_backend_fs2_add_remote_candidates(
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
71 PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
72 const gchar *sess_id, const gchar *participant,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
73 GList *remote_candidates);
29597
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
74 static gboolean purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self,
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
75 const gchar *sess_id);
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
76 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
77 const gchar *sess_id);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
78 static GList *purple_media_backend_fs2_get_local_candidates(
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
79 PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
80 const gchar *sess_id, const gchar *participant);
29588
a3fef46ce04a Make the backend interface's set_remote_codecs function return gboolean.
Michael Ruprecht <maiku@pidgin.im>
parents: 29587
diff changeset
81 static gboolean purple_media_backend_fs2_set_remote_codecs(
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
82 PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
83 const gchar *sess_id, const gchar *participant,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
84 GList *codecs);
29590
bec92b90acc9 Change the media backend interface's set_send_codec to return gboolean to
Michael Ruprecht <maiku@pidgin.im>
parents: 29589
diff changeset
85 static gboolean purple_media_backend_fs2_set_send_codec(
bec92b90acc9 Change the media backend interface's set_send_codec to return gboolean to
Michael Ruprecht <maiku@pidgin.im>
parents: 29589
diff changeset
86 PurpleMediaBackend *self, const gchar *sess_id,
bec92b90acc9 Change the media backend interface's set_send_codec to return gboolean to
Michael Ruprecht <maiku@pidgin.im>
parents: 29589
diff changeset
87 PurpleMediaCodec *codec);
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
88
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
89 struct _PurpleMediaBackendFs2Class
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
90 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
91 GObjectClass parent_class;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
92 };
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
93
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
94 struct _PurpleMediaBackendFs2
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
95 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
96 GObject parent;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
97 };
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
98
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
99 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
100 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
101 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init));
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
102
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
103 struct _PurpleMediaBackendFs2Stream
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
104 {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
105 PurpleMediaBackendFs2Session *session;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
106 gchar *participant;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
107 FsStream *stream;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
108
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
109 GstElement *src;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
110 GstElement *tee;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
111 GstElement *volume;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
112 GstElement *level;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
113
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
114 GList *local_candidates;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
115 GList *remote_candidates;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
116
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
117 guint connected_cb_id;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
118 };
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
119
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
120 struct _PurpleMediaBackendFs2Session
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
121 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
122 PurpleMediaBackendFs2 *backend;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
123 gchar *id;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
124 FsSession *session;
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
125
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
126 GstElement *src;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
127 GstElement *tee;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
128
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
129 PurpleMediaSessionType type;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
130 };
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
131
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
132 struct _PurpleMediaBackendFs2Private
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
133 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
134 PurpleMedia *media;
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
135 GstElement *confbin;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
136 FsConference *conference;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
137 gchar *conference_type;
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
138
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
139 GHashTable *sessions;
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
140 GHashTable *participants;
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
141
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
142 GList *streams;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
143 };
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
144
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
145 enum {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
146 PROP_0,
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
147 PROP_CONFERENCE_TYPE,
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
148 PROP_MEDIA,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
149 };
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
150
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
151 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
152 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
153 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
154 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
155
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
156 static void
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
157 purple_media_backend_fs2_dispose(GObject *obj)
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
158 {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
159 PurpleMediaBackendFs2Private *priv =
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
160 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
29593
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
161 GList *iter = NULL;
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
162
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
163 purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
164
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
165 if (priv->confbin) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
166 GstElement *pipeline;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
167
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
168 pipeline = purple_media_manager_get_pipeline(
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
169 purple_media_get_manager(priv->media));
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
170
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
171 gst_element_set_locked_state(priv->confbin, TRUE);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
172 gst_element_set_state(GST_ELEMENT(priv->confbin),
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
173 GST_STATE_NULL);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
174
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
175 if (pipeline) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
176 GstBus *bus;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
177 gst_bin_remove(GST_BIN(pipeline), priv->confbin);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
178 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
179 g_signal_handlers_disconnect_matched(G_OBJECT(bus),
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
180 G_SIGNAL_MATCH_FUNC |
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
181 G_SIGNAL_MATCH_DATA,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
182 0, 0, 0, gst_bus_cb, obj);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
183 gst_object_unref(bus);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
184 } else {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
185 purple_debug_warning("backend-fs2", "Unable to "
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
186 "properly dispose the conference. "
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
187 "Couldn't get the pipeline.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
188 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
189
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
190 priv->confbin = NULL;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
191 priv->conference = NULL;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
192
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
193 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
194
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
195 if (priv->sessions) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
196 GList *sessions = g_hash_table_get_values(priv->sessions);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
197
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
198 for (; sessions; sessions =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
199 g_list_delete_link(sessions, sessions)) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
200 PurpleMediaBackendFs2Session *session =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
201 sessions->data;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
202
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
203 if (session->session) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
204 g_object_unref(session->session);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
205 session->session = NULL;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
206 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
207 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
208 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
209
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
210 if (priv->participants) {
30715
61a0bd743512 Fix some media code leaks.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30706
diff changeset
211 g_hash_table_destroy(priv->participants);
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
212 priv->participants = NULL;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
213 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
214
29593
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
215 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
216 PurpleMediaBackendFs2Stream *stream = iter->data;
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
217 if (stream->stream) {
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
218 g_object_unref(stream->stream);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
219 stream->stream = NULL;
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
220 }
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
221 }
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
222
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
223 if (priv->media) {
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
224 g_object_remove_weak_pointer(G_OBJECT(priv->media),
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
225 (gpointer*)&priv->media);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
226 priv->media = NULL;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
227 }
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
228
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
229 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
230 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
231
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
232 static void
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
233 purple_media_backend_fs2_finalize(GObject *obj)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
234 {
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
235 PurpleMediaBackendFs2Private *priv =
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
236 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
237
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
238 purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n");
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
239
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
240 g_free(priv->conference_type);
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
241
29593
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
242 for (; priv->streams; priv->streams =
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
243 g_list_delete_link(priv->streams, priv->streams)) {
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
244 PurpleMediaBackendFs2Stream *stream = priv->streams->data;
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
245
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
246 /* Remove the connected_cb timeout */
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
247 if (stream->connected_cb_id != 0)
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
248 purple_timeout_remove(stream->connected_cb_id);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
249
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
250 g_free(stream->participant);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
251
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
252 if (stream->local_candidates)
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
253 fs_candidate_list_destroy(stream->local_candidates);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
254
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
255 if (stream->remote_candidates)
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
256 fs_candidate_list_destroy(stream->remote_candidates);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
257
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
258 g_free(stream);
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
259 }
5274ab2ae88c Properly free PurpleMediaBackendFs2Stream's.
Michael Ruprecht <maiku@pidgin.im>
parents: 29592
diff changeset
260
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
261 if (priv->sessions) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
262 GList *sessions = g_hash_table_get_values(priv->sessions);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
263
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
264 for (; sessions; sessions =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
265 g_list_delete_link(sessions, sessions)) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
266 PurpleMediaBackendFs2Session *session =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
267 sessions->data;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
268 g_free(session->id);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
269 g_free(session);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
270 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
271
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
272 g_hash_table_destroy(priv->sessions);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
273 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
274
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
275 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj);
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
276 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
277
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
278 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
279 purple_media_backend_fs2_set_property(GObject *object, guint prop_id,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
280 const GValue *value, GParamSpec *pspec)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
281 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
282 PurpleMediaBackendFs2Private *priv;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
283 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
284
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
285 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
286
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
287 switch (prop_id) {
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
288 case PROP_CONFERENCE_TYPE:
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
289 priv->conference_type = g_value_dup_string(value);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
290 break;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
291 case PROP_MEDIA:
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
292 priv->media = g_value_get_object(value);
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
293
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
294 if (priv->media == NULL)
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
295 break;
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
296
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
297 g_object_add_weak_pointer(G_OBJECT(priv->media),
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
298 (gpointer*)&priv->media);
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
299
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
300 g_signal_connect(G_OBJECT(priv->media),
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
301 "state-changed",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
302 G_CALLBACK(state_changed_cb),
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
303 PURPLE_MEDIA_BACKEND_FS2(object));
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
304 g_signal_connect(G_OBJECT(priv->media), "stream-info",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
305 G_CALLBACK(stream_info_cb),
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
306 PURPLE_MEDIA_BACKEND_FS2(object));
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
307 break;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
308 default:
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
309 G_OBJECT_WARN_INVALID_PROPERTY_ID(
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
310 object, prop_id, pspec);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
311 break;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
312 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
313 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
314
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
315 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
316 purple_media_backend_fs2_get_property(GObject *object, guint prop_id,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
317 GValue *value, GParamSpec *pspec)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
318 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
319 PurpleMediaBackendFs2Private *priv;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
320 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
321
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
322 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
323
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
324 switch (prop_id) {
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
325 case PROP_CONFERENCE_TYPE:
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
326 g_value_set_string(value, priv->conference_type);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
327 break;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
328 case PROP_MEDIA:
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
329 g_value_set_object(value, priv->media);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
330 break;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
331 default:
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
332 G_OBJECT_WARN_INVALID_PROPERTY_ID(
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
333 object, prop_id, pspec);
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
334 break;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
335 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
336 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
337
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
338 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
339 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
340 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
341 GObjectClass *gobject_class = (GObjectClass*)klass;
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
342
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
343 gobject_class->dispose = purple_media_backend_fs2_dispose;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
344 gobject_class->finalize = purple_media_backend_fs2_finalize;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
345 gobject_class->set_property = purple_media_backend_fs2_set_property;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
346 gobject_class->get_property = purple_media_backend_fs2_get_property;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
347
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
348 g_object_class_override_property(gobject_class, PROP_CONFERENCE_TYPE,
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
349 "conference-type");
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
350 g_object_class_override_property(gobject_class, PROP_MEDIA, "media");
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
351
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
352 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private));
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
353 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
354
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
355 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
356 purple_media_backend_iface_init(PurpleMediaBackendIface *iface)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
357 {
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
358 iface->add_stream = purple_media_backend_fs2_add_stream;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
359 iface->add_remote_candidates =
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
360 purple_media_backend_fs2_add_remote_candidates;
29597
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
361 iface->codecs_ready = purple_media_backend_fs2_codecs_ready;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
362 iface->get_codecs = purple_media_backend_fs2_get_codecs;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
363 iface->get_local_candidates =
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
364 purple_media_backend_fs2_get_local_candidates;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
365 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
366 iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
367 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
368
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
369 static FsMediaType
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
370 session_type_to_fs_media_type(PurpleMediaSessionType type)
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
371 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
372 if (type & PURPLE_MEDIA_AUDIO)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
373 return FS_MEDIA_TYPE_AUDIO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
374 else if (type & PURPLE_MEDIA_VIDEO)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
375 return FS_MEDIA_TYPE_VIDEO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
376 else
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
377 return 0;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
378 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
379
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
380 static FsStreamDirection
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
381 session_type_to_fs_stream_direction(PurpleMediaSessionType type)
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
382 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
383 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
384 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
385 return FS_DIRECTION_BOTH;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
386 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
387 (type & PURPLE_MEDIA_SEND_VIDEO))
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
388 return FS_DIRECTION_SEND;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
389 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
390 (type & PURPLE_MEDIA_RECV_VIDEO))
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
391 return FS_DIRECTION_RECV;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
392 else
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
393 return FS_DIRECTION_NONE;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
394 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
395
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
396 static PurpleMediaSessionType
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
397 session_type_from_fs(FsMediaType type, FsStreamDirection direction)
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
398 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
399 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
400 if (type == FS_MEDIA_TYPE_AUDIO) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
401 if (direction & FS_DIRECTION_SEND)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
402 result |= PURPLE_MEDIA_SEND_AUDIO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
403 if (direction & FS_DIRECTION_RECV)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
404 result |= PURPLE_MEDIA_RECV_AUDIO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
405 } else if (type == FS_MEDIA_TYPE_VIDEO) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
406 if (direction & FS_DIRECTION_SEND)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
407 result |= PURPLE_MEDIA_SEND_VIDEO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
408 if (direction & FS_DIRECTION_RECV)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
409 result |= PURPLE_MEDIA_RECV_VIDEO;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
410 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
411 return result;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
412 }
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
413
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
414 static FsCandidate *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
415 candidate_to_fs(PurpleMediaCandidate *candidate)
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
416 {
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
417 FsCandidate *fscandidate;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
418 gchar *foundation;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
419 guint component_id;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
420 gchar *ip;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
421 guint port;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
422 gchar *base_ip;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
423 guint base_port;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
424 PurpleMediaNetworkProtocol proto;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
425 guint32 priority;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
426 PurpleMediaCandidateType type;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
427 gchar *username;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
428 gchar *password;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
429 guint ttl;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
430
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
431 if (candidate == NULL)
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
432 return NULL;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
433
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
434 g_object_get(G_OBJECT(candidate),
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
435 "foundation", &foundation,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
436 "component-id", &component_id,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
437 "ip", &ip,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
438 "port", &port,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
439 "base-ip", &base_ip,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
440 "base-port", &base_port,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
441 "protocol", &proto,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
442 "priority", &priority,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
443 "type", &type,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
444 "username", &username,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
445 "password", &password,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
446 "ttl", &ttl,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
447 NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
448
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
449 fscandidate = fs_candidate_new(foundation,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
450 component_id, type,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
451 proto, ip, port);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
452
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
453 fscandidate->base_ip = base_ip;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
454 fscandidate->base_port = base_port;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
455 fscandidate->priority = priority;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
456 fscandidate->username = username;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
457 fscandidate->password = password;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
458 fscandidate->ttl = ttl;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
459
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
460 g_free(foundation);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
461 g_free(ip);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
462 return fscandidate;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
463 }
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
464
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
465 static GList *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
466 candidate_list_to_fs(GList *candidates)
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
467 {
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
468 GList *new_list = NULL;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
469
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
470 for (; candidates; candidates = g_list_next(candidates)) {
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
471 new_list = g_list_prepend(new_list,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
472 candidate_to_fs(candidates->data));
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
473 }
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
474
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
475 new_list = g_list_reverse(new_list);
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
476 return new_list;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
477 }
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
478
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
479 static PurpleMediaCandidate *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
480 candidate_from_fs(FsCandidate *fscandidate)
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
481 {
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
482 PurpleMediaCandidate *candidate;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
483
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
484 if (fscandidate == NULL)
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
485 return NULL;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
486
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
487 candidate = purple_media_candidate_new(fscandidate->foundation,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
488 fscandidate->component_id, fscandidate->type,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
489 fscandidate->proto, fscandidate->ip, fscandidate->port);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
490 g_object_set(candidate,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
491 "base-ip", fscandidate->base_ip,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
492 "base-port", fscandidate->base_port,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
493 "priority", fscandidate->priority,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
494 "username", fscandidate->username,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
495 "password", fscandidate->password,
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
496 "ttl", fscandidate->ttl, NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
497 return candidate;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
498 }
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
499
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
500 static GList *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
501 candidate_list_from_fs(GList *candidates)
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
502 {
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
503 GList *new_list = NULL;
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
504
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
505 for (; candidates; candidates = g_list_next(candidates)) {
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
506 new_list = g_list_prepend(new_list,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
507 candidate_from_fs(candidates->data));
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
508 }
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
509
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
510 new_list = g_list_reverse(new_list);
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
511 return new_list;
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
512 }
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
513
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
514 static FsCodec *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
515 codec_to_fs(const PurpleMediaCodec *codec)
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
516 {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
517 FsCodec *new_codec;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
518 gint id;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
519 char *encoding_name;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
520 PurpleMediaSessionType media_type;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
521 guint clock_rate;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
522 guint channels;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
523 GList *iter;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
524
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
525 if (codec == NULL)
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
526 return NULL;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
527
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
528 g_object_get(G_OBJECT(codec),
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
529 "id", &id,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
530 "encoding-name", &encoding_name,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
531 "media-type", &media_type,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
532 "clock-rate", &clock_rate,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
533 "channels", &channels,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
534 "optional-params", &iter,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
535 NULL);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
536
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
537 new_codec = fs_codec_new(id, encoding_name,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
538 session_type_to_fs_media_type(media_type),
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
539 clock_rate);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
540 new_codec->channels = channels;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
541
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
542 for (; iter; iter = g_list_next(iter)) {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
543 PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
544 fs_codec_add_optional_parameter(new_codec,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
545 param->key, param->value);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
546 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
547
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
548 g_free(encoding_name);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
549 return new_codec;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
550 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
551
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
552 static PurpleMediaCodec *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
553 codec_from_fs(const FsCodec *codec)
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
554 {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
555 PurpleMediaCodec *new_codec;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
556 GList *iter;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
557
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
558 if (codec == NULL)
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
559 return NULL;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
560
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
561 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
562 session_type_from_fs(codec->media_type,
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
563 FS_DIRECTION_BOTH), codec->clock_rate);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
564 g_object_set(new_codec, "channels", codec->channels, NULL);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
565
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
566 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
567 FsCodecParameter *param = (FsCodecParameter*)iter->data;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
568 purple_media_codec_add_optional_parameter(new_codec,
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
569 param->name, param->value);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
570 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
571
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
572 return new_codec;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
573 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
574
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
575 static GList *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
576 codec_list_from_fs(GList *codecs)
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
577 {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
578 GList *new_list = NULL;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
579
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
580 for (; codecs; codecs = g_list_next(codecs)) {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
581 new_list = g_list_prepend(new_list,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
582 codec_from_fs(codecs->data));
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
583 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
584
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
585 new_list = g_list_reverse(new_list);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
586 return new_list;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
587 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
588
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
589 static GList *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
590 codec_list_to_fs(GList *codecs)
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
591 {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
592 GList *new_list = NULL;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
593
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
594 for (; codecs; codecs = g_list_next(codecs)) {
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
595 new_list = g_list_prepend(new_list,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
596 codec_to_fs(codecs->data));
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
597 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
598
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
599 new_list = g_list_reverse(new_list);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
600 return new_list;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
601 }
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
602
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
603 static PurpleMediaBackendFs2Session *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
604 get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id)
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
605 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
606 PurpleMediaBackendFs2Private *priv;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
607 PurpleMediaBackendFs2Session *session = NULL;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
608
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
609 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
610
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
611 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
612
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
613 if (priv->sessions != NULL)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
614 session = g_hash_table_lookup(priv->sessions, sess_id);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
615
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
616 return session;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
617 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
618
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
619 static FsParticipant *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
620 get_participant(PurpleMediaBackendFs2 *self, const gchar *name)
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
621 {
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
622 PurpleMediaBackendFs2Private *priv;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
623 FsParticipant *participant = NULL;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
624
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
625 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
626
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
627 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
628
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
629 if (priv->participants != NULL)
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
630 participant = g_hash_table_lookup(priv->participants, name);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
631
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
632 return participant;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
633 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
634
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
635 static PurpleMediaBackendFs2Stream *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
636 get_stream(PurpleMediaBackendFs2 *self,
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
637 const gchar *sess_id, const gchar *name)
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
638 {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
639 PurpleMediaBackendFs2Private *priv;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
640 GList *streams;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
641
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
642 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
643
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
644 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
645 streams = priv->streams;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
646
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
647 for (; streams; streams = g_list_next(streams)) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
648 PurpleMediaBackendFs2Stream *stream = streams->data;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
649 if (!strcmp(stream->session->id, sess_id) &&
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
650 !strcmp(stream->participant, name))
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
651 return stream;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
652 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
653
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
654 return NULL;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
655 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
656
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
657 static GList *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
658 get_streams(PurpleMediaBackendFs2 *self,
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
659 const gchar *sess_id, const gchar *name)
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
660 {
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
661 PurpleMediaBackendFs2Private *priv;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
662 GList *streams, *ret = NULL;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
663
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
664 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
665
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
666 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
667 streams = priv->streams;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
668
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
669 for (; streams; streams = g_list_next(streams)) {
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
670 PurpleMediaBackendFs2Stream *stream = streams->data;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
671
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
672 if (sess_id != NULL && strcmp(stream->session->id, sess_id))
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
673 continue;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
674 else if (name != NULL && strcmp(stream->participant, name))
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
675 continue;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
676 else
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
677 ret = g_list_prepend(ret, stream);
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
678 }
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
679
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
680 ret = g_list_reverse(ret);
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
681 return ret;
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
682 }
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
683
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
684 static PurpleMediaBackendFs2Session *
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
685 get_session_from_fs_stream(PurpleMediaBackendFs2 *self, FsStream *stream)
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
686 {
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
687 PurpleMediaBackendFs2Private *priv =
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
688 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
689 FsSession *fssession;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
690 GList *values;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
691
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
692 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
693 g_return_val_if_fail(FS_IS_STREAM(stream), NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
694
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
695 g_object_get(stream, "session", &fssession, NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
696
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
697 values = g_hash_table_get_values(priv->sessions);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
698
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
699 for (; values; values = g_list_delete_link(values, values)) {
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
700 PurpleMediaBackendFs2Session *session = values->data;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
701
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
702 if (session->session == fssession) {
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
703 g_list_free(values);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
704 g_object_unref(fssession);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
705 return session;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
706 }
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
707 }
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
708
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
709 g_object_unref(fssession);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
710 return NULL;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
711 }
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
712
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
713 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
714 gst_handle_message_element(GstBus *bus, GstMessage *msg,
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
715 PurpleMediaBackendFs2 *self)
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
716 {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
717 PurpleMediaBackendFs2Private *priv =
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
718 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
719 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
720 static guint level_id = 0;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
721
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
722 if (level_id == 0)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
723 level_id = g_signal_lookup("level", PURPLE_TYPE_MEDIA);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
724
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
725 if (g_signal_has_handler_pending(priv->media, level_id, 0, FALSE)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
726 && gst_structure_has_name(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
727 gst_message_get_structure(msg), "level")) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
728 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
729 gchar *name;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
730 gchar *participant = NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
731 PurpleMediaBackendFs2Session *session = NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
732 gdouble rms_db;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
733 gdouble percent;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
734 const GValue *list;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
735 const GValue *value;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
736
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
737 if (!PURPLE_IS_MEDIA(priv->media) ||
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
738 GST_ELEMENT_PARENT(src) != priv->confbin)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
739 return;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
740
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
741 name = gst_element_get_name(src);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
742
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
743 if (!strncmp(name, "sendlevel_", 10)) {
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
744 session = get_session(self, name+10);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
745 } else {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
746 GList *iter = priv->streams;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
747 PurpleMediaBackendFs2Stream *stream;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
748 for (; iter; iter = g_list_next(iter)) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
749 stream = iter->data;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
750 if (stream->level == src) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
751 session = stream->session;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
752 participant = stream->participant;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
753 break;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
754 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
755 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
756 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
757
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
758 g_free(name);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
759
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
760 if (!session)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
761 return;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
762
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
763 list = gst_structure_get_value(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
764 gst_message_get_structure(msg), "rms");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
765 value = gst_value_list_get_value(list, 0);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
766 rms_db = g_value_get_double(value);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
767 percent = pow(10, rms_db / 20) * 5;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
768
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
769 if(percent > 1.0)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
770 percent = 1.0;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
771
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
772 g_signal_emit(priv->media, level_id, 0,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
773 session->id, participant, percent);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
774 return;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
775 }
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
776
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
777 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) ||
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
778 priv->conference != FS_CONFERENCE(src))
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
779 return;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
780
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
781 if (gst_structure_has_name(msg->structure, "farsight-error")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
782 FsError error_no;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
783 gst_structure_get_enum(msg->structure, "error-no",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
784 FS_TYPE_ERROR, (gint*)&error_no);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
785 switch (error_no) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
786 case FS_ERROR_NO_CODECS:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
787 purple_media_error(priv->media, _("No codecs"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
788 " found. Install some"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
789 " GStreamer codecs found"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
790 " in GStreamer plugins"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
791 " packages."));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
792 purple_media_end(priv->media, NULL, NULL);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
793 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
794 case FS_ERROR_NO_CODECS_LEFT:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
795 purple_media_error(priv->media, _("No codecs"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
796 " left. Your codec"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
797 " preferences in"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
798 " fs-codecs.conf are too"
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
799 " strict."));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
800 purple_media_end(priv->media, NULL, NULL);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
801 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
802 case FS_ERROR_UNKNOWN_CNAME:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
803 /*
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
804 * Unknown CName is only a problem for the
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
805 * multicast transmitter which isn't used.
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
806 * It is also deprecated.
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
807 */
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
808 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
809 default:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
810 purple_debug_error("backend-fs2",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
811 "farsight-error: %i: %s\n",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
812 error_no,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
813 gst_structure_get_string(
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
814 msg->structure, "error-msg"));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
815 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
816 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
817
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
818 if (FS_ERROR_IS_FATAL(error_no)) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
819 purple_media_error(priv->media, _("A non-recoverable "
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
820 "Farsight2 error has occurred."));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
821 purple_media_end(priv->media, NULL, NULL);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
822 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
823 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
824 "farsight-new-local-candidate")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
825 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
826 FsStream *stream;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
827 FsCandidate *local_candidate;
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
828 PurpleMediaCandidate *candidate;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
829 FsParticipant *participant;
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
830 PurpleMediaBackendFs2Session *session;
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
831 PurpleMediaBackendFs2Stream *media_stream;
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
832 gchar *name;
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
833
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
834 value = gst_structure_get_value(msg->structure, "stream");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
835 stream = g_value_get_object(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
836 value = gst_structure_get_value(msg->structure, "candidate");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
837 local_candidate = g_value_get_boxed(value);
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
838
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
839 session = get_session_from_fs_stream(self, stream);
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
840
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
841 purple_debug_info("backend-fs2",
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
842 "got new local candidate: %s\n",
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
843 local_candidate->foundation);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
844
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
845 g_object_get(stream, "participant", &participant, NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
846 g_object_get(participant, "cname", &name, NULL);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
847 g_object_unref(participant);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
848
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
849 media_stream = get_stream(self, session->id, name);
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
850 media_stream->local_candidates = g_list_append(
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
851 media_stream->local_candidates,
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
852 fs_candidate_copy(local_candidate));
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
853
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
854 candidate = candidate_from_fs(local_candidate);
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
855 g_signal_emit_by_name(self, "new-candidate",
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
856 session->id, name, candidate);
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
857 g_object_unref(candidate);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
858 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
859 "farsight-local-candidates-prepared")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
860 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
861 FsStream *stream;
29573
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
862 FsParticipant *participant;
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
863 PurpleMediaBackendFs2Session *session;
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
864 gchar *name;
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
865
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
866 value = gst_structure_get_value(msg->structure, "stream");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
867 stream = g_value_get_object(value);
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
868 session = get_session_from_fs_stream(self, stream);
29573
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
869
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
870 g_object_get(stream, "participant", &participant, NULL);
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
871 g_object_get(participant, "cname", &name, NULL);
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
872 g_object_unref(participant);
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
873
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
874 g_signal_emit_by_name(self, "candidates-prepared",
2377156c8bed Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29572
diff changeset
875 session->id, name);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
876 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
877 "farsight-new-active-candidate-pair")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
878 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
879 FsStream *stream;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
880 FsCandidate *local_candidate;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
881 FsCandidate *remote_candidate;
29572
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
882 FsParticipant *participant;
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
883 PurpleMediaBackendFs2Session *session;
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
884 PurpleMediaCandidate *lcandidate, *rcandidate;
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
885 gchar *name;
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
886
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
887 value = gst_structure_get_value(msg->structure, "stream");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
888 stream = g_value_get_object(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
889 value = gst_structure_get_value(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
890 "local-candidate");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
891 local_candidate = g_value_get_boxed(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
892 value = gst_structure_get_value(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
893 "remote-candidate");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
894 remote_candidate = g_value_get_boxed(value);
29572
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
895
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
896 g_object_get(stream, "participant", &participant, NULL);
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
897 g_object_get(participant, "cname", &name, NULL);
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
898 g_object_unref(participant);
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
899
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
900 session = get_session_from_fs_stream(self, stream);
29572
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
901
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
902 lcandidate = candidate_from_fs(local_candidate);
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
903 rcandidate = candidate_from_fs(remote_candidate);
29572
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
904
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
905 g_signal_emit_by_name(self, "active-candidate-pair",
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
906 session->id, name, lcandidate, rcandidate);
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
907
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
908 g_object_unref(lcandidate);
4e4dbdcf5281 Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29571
diff changeset
909 g_object_unref(rcandidate);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
910 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
911 "farsight-recv-codecs-changed")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
912 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
913 GList *codecs;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
914 FsCodec *codec;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
915
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
916 value = gst_structure_get_value(msg->structure, "codecs");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
917 codecs = g_value_get_boxed(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
918 codec = codecs->data;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
919
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
920 purple_debug_info("backend-fs2",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
921 "farsight-recv-codecs-changed: %s\n",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
922 codec->encoding_name);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
923 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
924 "farsight-component-state-changed")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
925 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
926 FsStreamState fsstate;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
927 guint component;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
928 const gchar *state;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
929
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
930 value = gst_structure_get_value(msg->structure, "state");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
931 fsstate = g_value_get_enum(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
932 value = gst_structure_get_value(msg->structure, "component");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
933 component = g_value_get_uint(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
934
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
935 switch (fsstate) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
936 case FS_STREAM_STATE_FAILED:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
937 state = "FAILED";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
938 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
939 case FS_STREAM_STATE_DISCONNECTED:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
940 state = "DISCONNECTED";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
941 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
942 case FS_STREAM_STATE_GATHERING:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
943 state = "GATHERING";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
944 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
945 case FS_STREAM_STATE_CONNECTING:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
946 state = "CONNECTING";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
947 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
948 case FS_STREAM_STATE_CONNECTED:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
949 state = "CONNECTED";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
950 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
951 case FS_STREAM_STATE_READY:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
952 state = "READY";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
953 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
954 default:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
955 state = "UNKNOWN";
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
956 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
957 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
958
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
959 purple_debug_info("backend-fs2",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
960 "farsight-component-state-changed: "
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
961 "component: %u state: %s\n",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
962 component, state);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
963 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
964 "farsight-send-codec-changed")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
965 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
966 FsCodec *codec;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
967 gchar *codec_str;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
968
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
969 value = gst_structure_get_value(msg->structure, "codec");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
970 codec = g_value_get_boxed(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
971 codec_str = fs_codec_to_string(codec);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
972
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
973 purple_debug_info("backend-fs2",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
974 "farsight-send-codec-changed: codec: %s\n",
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
975 codec_str);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
976
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
977 g_free(codec_str);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
978 } else if (gst_structure_has_name(msg->structure,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
979 "farsight-codecs-changed")) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
980 const GValue *value;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
981 FsSession *fssession;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
982 GList *sessions;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
983
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
984 value = gst_structure_get_value(msg->structure, "session");
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
985 fssession = g_value_get_object(value);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
986 sessions = g_hash_table_get_values(priv->sessions);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
987
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
988 for (; sessions; sessions =
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
989 g_list_delete_link(sessions, sessions)) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
990 PurpleMediaBackendFs2Session *session = sessions->data;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
991 gchar *session_id;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
992
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
993 if (session->session != fssession)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
994 continue;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
995
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
996 session_id = g_strdup(session->id);
29571
f5b8fe67c87f Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29570
diff changeset
997 g_signal_emit_by_name(self, "codecs-changed",
f5b8fe67c87f Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29570
diff changeset
998 session_id);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
999 g_free(session_id);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1000 g_list_free(sessions);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1001 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1002 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1003 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1004 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1005
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1006 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1007 gst_handle_message_error(GstBus *bus, GstMessage *msg,
29570
3c71157baa81 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29569
diff changeset
1008 PurpleMediaBackendFs2 *self)
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1009 {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1010 PurpleMediaBackendFs2Private *priv =
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1011 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1012 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1013 GstElement *lastElement = NULL;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1014 GList *sessions;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1015
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1016 while (!GST_IS_PIPELINE(element)) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1017 if (element == priv->confbin)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1018 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1019
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1020 lastElement = element;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1021 element = GST_ELEMENT_PARENT(element);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1022 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1023
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1024 if (!GST_IS_PIPELINE(element))
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1025 return;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1026
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1027 sessions = purple_media_get_session_ids(priv->media);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1028
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1029 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1030 if (purple_media_get_src(priv->media, sessions->data)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1031 != lastElement)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1032 continue;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1033
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1034 if (purple_media_get_session_type(priv->media, sessions->data)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1035 & PURPLE_MEDIA_AUDIO)
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1036 purple_media_error(priv->media,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1037 _("Error with your microphone"));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1038 else
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1039 purple_media_error(priv->media,
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1040 _("Error with your webcam"));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1041
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1042 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1043 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1044
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1045 g_list_free(sessions);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1046
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1047 purple_media_error(priv->media, _("Conference error"));
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1048 purple_media_end(priv->media, NULL, NULL);
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1049 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1050
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1051 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1052 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self)
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1053 {
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1054 switch(GST_MESSAGE_TYPE(msg)) {
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1055 case GST_MESSAGE_ELEMENT:
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1056 gst_handle_message_element(bus, msg, self);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1057 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1058 case GST_MESSAGE_ERROR:
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1059 gst_handle_message_error(bus, msg, self);
29568
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1060 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1061 default:
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1062 break;
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1063 }
e2fcbaf4409c Transfer some GStreamer message handling to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29564
diff changeset
1064
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1065 return TRUE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1066 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1067
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1068 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1069 state_changed_cb(PurpleMedia *media, PurpleMediaState state,
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1070 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self)
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1071 {
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1072 }
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1073
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1074 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1075 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1076 gchar *sid, gchar *name, gboolean local,
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1077 PurpleMediaBackendFs2 *self)
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1078 {
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1079 if (type == PURPLE_MEDIA_INFO_ACCEPT && sid != NULL && name != NULL) {
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1080 PurpleMediaBackendFs2Stream *stream =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1081 get_stream(self, sid, name);
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1082 GError *err = NULL;
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1083
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1084 g_object_set(G_OBJECT(stream->stream), "direction",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1085 session_type_to_fs_stream_direction(
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1086 stream->session->type), NULL);
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1087
29648
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1088 if (stream->remote_candidates == NULL ||
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1089 purple_media_is_initiator(media, sid, name))
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1090 return;
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1091
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1092 fs_stream_set_remote_candidates(stream->stream,
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1093 stream->remote_candidates, &err);
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1094
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1095 if (err == NULL)
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1096 return;
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1097
29619
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1098 purple_debug_error("backend-fs2", "Error adding "
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1099 "remote candidates: %s\n",
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1100 err->message);
5c64f74c2ebd Handle individual streams in the Fs2 backend's stream-info callback for accept
Michael Ruprecht <maiku@pidgin.im>
parents: 29618
diff changeset
1101 g_error_free(err);
29603
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1102 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1103 type == PURPLE_MEDIA_INFO_UNMUTE)) {
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1104 PurpleMediaBackendFs2Private *priv =
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1105 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1106 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1107 GList *sessions;
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1108
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1109 if (sid == NULL)
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1110 sessions = g_hash_table_get_values(priv->sessions);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1111 else
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1112 sessions = g_list_prepend(NULL,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1113 get_session(self, sid));
29603
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1114
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1115 purple_debug_info("media", "Turning mute %s\n",
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1116 active ? "on" : "off");
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1117
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1118 for (; sessions; sessions = g_list_delete_link(
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1119 sessions, sessions)) {
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1120 PurpleMediaBackendFs2Session *session =
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1121 sessions->data;
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1122
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1123 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1124 gchar *name = g_strdup_printf("volume_%s",
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1125 session->id);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1126 GstElement *volume = gst_bin_get_by_name(
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1127 GST_BIN(priv->confbin), name);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1128 g_free(name);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1129 g_object_set(volume, "mute", active, NULL);
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1130 }
271b6eb28f54 Move mute functionality into the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29601
diff changeset
1131 }
31278
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1132 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD ||
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1133 type == PURPLE_MEDIA_INFO_UNHOLD)) {
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1134 gboolean active = (type == PURPLE_MEDIA_INFO_HOLD);
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1135 GList *streams = get_streams(self, sid, name);
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1136 for (; streams; streams =
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1137 g_list_delete_link(streams, streams)) {
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1138 PurpleMediaBackendFs2Stream *stream = streams->data;
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1139 if (stream->session->type & PURPLE_MEDIA_SEND_AUDIO) {
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1140 g_object_set(stream->stream, "direction",
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1141 session_type_to_fs_stream_direction(
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1142 stream->session->type & ((active) ?
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1143 ~PURPLE_MEDIA_SEND_AUDIO :
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1144 PURPLE_MEDIA_AUDIO)), NULL);
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1145 }
3314c614763c Stop sending audio when placing a call on hold. Fixes #13032.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30769
diff changeset
1146 }
29594
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1147 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE ||
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1148 type == PURPLE_MEDIA_INFO_UNPAUSE)) {
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1149 gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE);
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1150 GList *streams = get_streams(self, sid, name);
29594
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1151 for (; streams; streams =
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1152 g_list_delete_link(streams, streams)) {
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1153 PurpleMediaBackendFs2Stream *stream = streams->data;
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1154 if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) {
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1155 g_object_set(stream->stream, "direction",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1156 session_type_to_fs_stream_direction(
29594
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1157 stream->session->type & ((active) ?
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1158 ~PURPLE_MEDIA_SEND_VIDEO :
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1159 PURPLE_MEDIA_VIDEO)), NULL);
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1160 }
1eefaad00189 Move pause functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29593
diff changeset
1161 }
29592
eac0dd44f441 Handle part of accepting a stream in the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29591
diff changeset
1162 }
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1163 }
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1164
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1165 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1166 init_conference(PurpleMediaBackendFs2 *self)
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1167 {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1168 PurpleMediaBackendFs2Private *priv =
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1169 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1170 GstElement *pipeline;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1171 GstBus *bus;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1172 gchar *name;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1173
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1174 priv->conference = FS_CONFERENCE(
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1175 gst_element_factory_make(priv->conference_type, NULL));
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1176
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1177 if (priv->conference == NULL) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1178 purple_debug_error("backend-fs2", "Conference == NULL\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1179 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1180 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1181
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1182 pipeline = purple_media_manager_get_pipeline(
29564
fa76e21160fd Various tweaks, fixes, and added debug output. Attached some media signals,
Michael Ruprecht <maiku@pidgin.im>
parents: 29559
diff changeset
1183 purple_media_get_manager(priv->media));
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1184
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1185 if (pipeline == NULL) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1186 purple_debug_error("backend-fs2",
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1187 "Couldn't retrieve pipeline.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1188 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1189 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1190
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1191 name = g_strdup_printf("conf_%p", priv->conference);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1192 priv->confbin = gst_bin_new(name);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1193 if (priv->confbin == NULL) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1194 purple_debug_error("backend-fs2",
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1195 "Couldn't create confbin.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1196 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1197 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1198
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1199 g_free(name);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1200
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1201 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1202 if (bus == NULL) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1203 purple_debug_error("backend-fs2",
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1204 "Couldn't get the pipeline's bus.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1205 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1206 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1207
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1208 g_signal_connect(G_OBJECT(bus), "message",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1209 G_CALLBACK(gst_bus_cb), self);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1210 gst_object_unref(bus);
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1211
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1212 if (!gst_bin_add(GST_BIN(pipeline),
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1213 GST_ELEMENT(priv->confbin))) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1214 purple_debug_error("backend-fs2", "Couldn't add confbin "
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1215 "element to the pipeline\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1216 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1217 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1218
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1219 if (!gst_bin_add(GST_BIN(priv->confbin),
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1220 GST_ELEMENT(priv->conference))) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1221 purple_debug_error("backend-fs2", "Couldn't add conference "
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1222 "element to the confbin\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1223 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1224 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1225
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1226 if (gst_element_set_state(GST_ELEMENT(priv->confbin),
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1227 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1228 purple_debug_error("backend-fs2",
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1229 "Failed to start conference.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1230 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1231 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1232
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1233 return TRUE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1234 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1235
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1236 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1237 gst_element_added_cb(FsElementAddedNotifier *self,
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1238 GstBin *bin, GstElement *element, gpointer user_data)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1239 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1240 /*
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1241 * Hack to make H264 work with Gmail video.
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1242 */
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1243 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1244 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1245 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1246 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1247
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1248 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1249 create_src(PurpleMediaBackendFs2 *self, const gchar *sess_id,
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1250 PurpleMediaSessionType type)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1251 {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1252 PurpleMediaBackendFs2Private *priv =
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1253 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1254 PurpleMediaBackendFs2Session *session;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1255 PurpleMediaSessionType session_type;
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1256 FsMediaType media_type = session_type_to_fs_media_type(type);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1257 FsStreamDirection type_direction =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1258 session_type_to_fs_stream_direction(type);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1259 GstElement *src;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1260 GstPad *sinkpad, *srcpad;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1261
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1262 if ((type_direction & FS_DIRECTION_SEND) == 0)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1263 return TRUE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1264
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1265 session_type = session_type_from_fs(
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1266 media_type, FS_DIRECTION_SEND);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1267 src = purple_media_manager_get_element(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1268 purple_media_get_manager(priv->media),
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1269 session_type, priv->media, sess_id, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1270
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1271 if (!GST_IS_ELEMENT(src)) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1272 purple_debug_error("backend-fs2",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1273 "Error creating src for session %s\n",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1274 sess_id);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1275 return FALSE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1276 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1277
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1278 session = get_session(self, sess_id);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1279
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1280 if (session == NULL) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1281 purple_debug_warning("backend-fs2",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1282 "purple_media_set_src: trying to set"
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1283 " src on non-existent session\n");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1284 return FALSE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1285 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1286
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1287 if (session->src)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1288 gst_object_unref(session->src);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1289
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1290 session->src = src;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1291 gst_element_set_locked_state(session->src, TRUE);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1292
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1293 session->tee = gst_element_factory_make("tee", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1294 gst_bin_add(GST_BIN(priv->confbin), session->tee);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1295
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1296 /* This supposedly isn't necessary, but it silences some warnings */
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1297 if (GST_ELEMENT_PARENT(priv->confbin)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1298 == GST_ELEMENT_PARENT(session->src)) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1299 GstPad *pad = gst_element_get_static_pad(session->tee, "sink");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1300 GstPad *ghost = gst_ghost_pad_new(NULL, pad);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1301 gst_object_unref(pad);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1302 gst_pad_set_active(ghost, TRUE);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1303 gst_element_add_pad(priv->confbin, ghost);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1304 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1305
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1306 gst_element_set_state(session->tee, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1307 gst_element_link(session->src, priv->confbin);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1308
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1309 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1310 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1311 gchar *name = g_strdup_printf("volume_%s", session->id);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1312 GstElement *level;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1313 GstElement *volume = gst_element_factory_make("volume", name);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1314 double input_volume = purple_prefs_get_int(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1315 "/purple/media/audio/volume/input")/10.0;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1316 g_free(name);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1317 name = g_strdup_printf("sendlevel_%s", session->id);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1318 level = gst_element_factory_make("level", name);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1319 g_free(name);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1320 gst_bin_add(GST_BIN(priv->confbin), volume);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1321 gst_bin_add(GST_BIN(priv->confbin), level);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1322 gst_element_set_state(level, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1323 gst_element_set_state(volume, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1324 gst_element_link(volume, level);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1325 gst_element_link(session->tee, volume);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1326 srcpad = gst_element_get_static_pad(level, "src");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1327 g_object_set(volume, "volume", input_volume, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1328 } else {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1329 srcpad = gst_element_get_request_pad(session->tee, "src%d");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1330 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1331
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1332 purple_debug_info("backend-fs2", "connecting pad: %s\n",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1333 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1334 ? "success" : "failure");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1335 gst_element_set_locked_state(session->src, FALSE);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1336 gst_object_unref(session->src);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1337
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1338 gst_element_set_state(session->src, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1339
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1340 purple_media_manager_create_output_window(purple_media_get_manager(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1341 priv->media), priv->media, sess_id, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1342
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1343 return TRUE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1344 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1345
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1346 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1347 create_session(PurpleMediaBackendFs2 *self, const gchar *sess_id,
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1348 PurpleMediaSessionType type, gboolean initiator,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1349 const gchar *transmitter)
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1350 {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1351 PurpleMediaBackendFs2Private *priv =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1352 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1353 PurpleMediaBackendFs2Session *session;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1354 GError *err = NULL;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1355 GList *codec_conf = NULL, *iter = NULL;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1356 gchar *filename = NULL;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1357 gboolean is_nice = !strcmp(transmitter, "nice");
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1358
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1359 session = g_new0(PurpleMediaBackendFs2Session, 1);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1360
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1361 session->session = fs_conference_new_session(priv->conference,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1362 session_type_to_fs_media_type(type), &err);
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1363
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1364 if (err != NULL) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1365 purple_media_error(priv->media,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1366 _("Error creating session: %s"),
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1367 err->message);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1368 g_error_free(err);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1369 g_free(session);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1370 return FALSE;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1371 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1372
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1373 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1374 codec_conf = fs_codec_list_from_keyfile(filename, &err);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1375 g_free(filename);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1376
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1377 if (err != NULL) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1378 if (err->code == 4)
29580
ee364f895072 Correct some debug categories.
Michael Ruprecht <maiku@pidgin.im>
parents: 29579
diff changeset
1379 purple_debug_info("backend-fs2", "Couldn't read "
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1380 "fs-codec.conf: %s\n",
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1381 err->message);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1382 else
29580
ee364f895072 Correct some debug categories.
Michael Ruprecht <maiku@pidgin.im>
parents: 29579
diff changeset
1383 purple_debug_error("backend-fs2", "Error reading "
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1384 "fs-codec.conf: %s\n",
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1385 err->message);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1386 g_error_free(err);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1387 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1388
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1389 /*
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1390 * Add SPEEX if the configuration file doesn't exist or
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1391 * there isn't a speex entry.
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1392 */
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1393 for (iter = codec_conf; iter; iter = g_list_next(iter)) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1394 FsCodec *codec = iter->data;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1395 if (!g_ascii_strcasecmp(codec->encoding_name, "speex"))
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1396 break;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1397 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1398
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1399 if (iter == NULL) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1400 codec_conf = g_list_prepend(codec_conf,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1401 fs_codec_new(FS_CODEC_ID_ANY,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1402 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1403 codec_conf = g_list_prepend(codec_conf,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1404 fs_codec_new(FS_CODEC_ID_ANY,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1405 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1406 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1407
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1408 fs_session_set_codec_preferences(session->session, codec_conf, NULL);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1409 fs_codec_list_destroy(codec_conf);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1410
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1411 /*
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1412 * Removes a 5-7 second delay before
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1413 * receiving the src-pad-added signal.
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1414 * Only works for non-multicast FsRtpSessions.
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1415 */
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1416 if (is_nice || !strcmp(transmitter, "rawudp"))
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1417 g_object_set(G_OBJECT(session->session),
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1418 "no-rtcp-timeout", 0, NULL);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1419
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1420 /*
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1421 * Hack to make x264 work with Gmail video.
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1422 */
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1423 if (is_nice && !strcmp(sess_id, "google-video")) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1424 FsElementAddedNotifier *notifier =
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1425 fs_element_added_notifier_new();
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1426 g_signal_connect(G_OBJECT(notifier), "element-added",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1427 G_CALLBACK(gst_element_added_cb), NULL);
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1428 fs_element_added_notifier_add(notifier,
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1429 GST_BIN(priv->conference));
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1430 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1431
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1432 session->id = g_strdup(sess_id);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1433 session->backend = self;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1434 session->type = type;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1435
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1436 if (!priv->sessions) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1437 purple_debug_info("backend-fs2",
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1438 "Creating hash table for sessions\n");
30715
61a0bd743512 Fix some media code leaks.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30706
diff changeset
1439 priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal,
61a0bd743512 Fix some media code leaks.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30706
diff changeset
1440 g_free, NULL);
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1441 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1442
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1443 g_hash_table_insert(priv->sessions, g_strdup(session->id), session);
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1444
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1445 if (!create_src(self, sess_id, type)) {
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1446 purple_debug_info("backend-fs2", "Error creating the src\n");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1447 return FALSE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1448 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1449
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1450 return TRUE;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1451 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1452
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1453 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1454 create_participant(PurpleMediaBackendFs2 *self, const gchar *name)
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1455 {
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1456 PurpleMediaBackendFs2Private *priv =
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1457 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1458 FsParticipant *participant;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1459 GError *err = NULL;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1460
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1461 participant = fs_conference_new_participant(
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1462 priv->conference, name, &err);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1463
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1464 if (err) {
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1465 purple_debug_error("backend-fs2",
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1466 "Error creating participant: %s\n",
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1467 err->message);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1468 g_error_free(err);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1469 return FALSE;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1470 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1471
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1472 if (!priv->participants) {
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1473 purple_debug_info("backend-fs2",
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1474 "Creating hash table for participants\n");
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1475 priv->participants = g_hash_table_new_full(g_str_hash,
30715
61a0bd743512 Fix some media code leaks.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30706
diff changeset
1476 g_str_equal, g_free, g_object_unref);
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1477 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1478
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1479 g_hash_table_insert(priv->participants, g_strdup(name), participant);
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1480
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1481 return TRUE;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1482 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1483
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1484 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1485 src_pad_added_cb_cb(PurpleMediaBackendFs2Stream *stream)
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1486 {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1487 PurpleMediaBackendFs2Private *priv;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1488
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1489 g_return_val_if_fail(stream != NULL, FALSE);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1490
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1491 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1492 stream->connected_cb_id = 0;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1493
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1494 purple_media_manager_create_output_window(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1495 purple_media_get_manager(priv->media), priv->media,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1496 stream->session->id, stream->participant);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1497
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1498 g_signal_emit_by_name(priv->media, "state-changed",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1499 PURPLE_MEDIA_STATE_CONNECTED,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1500 stream->session->id, stream->participant);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1501 return FALSE;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1502 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1503
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1504 static void
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1505 src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1506 FsCodec *codec, PurpleMediaBackendFs2Stream *stream)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1507 {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1508 PurpleMediaBackendFs2Private *priv;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1509 GstPad *sinkpad;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1510
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1511 g_return_if_fail(FS_IS_STREAM(fsstream));
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1512 g_return_if_fail(stream != NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1513
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1514 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1515
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1516 if (stream->src == NULL) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1517 GstElement *sink = NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1518
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1519 if (codec->media_type == FS_MEDIA_TYPE_AUDIO) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1520 GstElement *queue = NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1521 double output_volume = purple_prefs_get_int(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1522 "/purple/media/audio/volume/output")/10.0;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1523 /*
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1524 * Should this instead be:
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1525 * audioconvert ! audioresample ! liveadder !
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1526 * audioresample ! audioconvert ! realsink
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1527 */
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1528 queue = gst_element_factory_make("queue", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1529 stream->volume = gst_element_factory_make(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1530 "volume", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1531 g_object_set(stream->volume, "volume",
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1532 output_volume, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1533 stream->level = gst_element_factory_make(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1534 "level", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1535 stream->src = gst_element_factory_make(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1536 "liveadder", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1537 sink = purple_media_manager_get_element(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1538 purple_media_get_manager(priv->media),
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1539 PURPLE_MEDIA_RECV_AUDIO, priv->media,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1540 stream->session->id,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1541 stream->participant);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1542 gst_bin_add(GST_BIN(priv->confbin), queue);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1543 gst_bin_add(GST_BIN(priv->confbin), stream->volume);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1544 gst_bin_add(GST_BIN(priv->confbin), stream->level);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1545 gst_bin_add(GST_BIN(priv->confbin), sink);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1546 gst_element_set_state(sink, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1547 gst_element_set_state(stream->level, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1548 gst_element_set_state(stream->volume, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1549 gst_element_set_state(queue, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1550 gst_element_link(stream->level, sink);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1551 gst_element_link(stream->volume, stream->level);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1552 gst_element_link(queue, stream->volume);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1553 sink = queue;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1554 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1555 stream->src = gst_element_factory_make(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1556 "fsfunnel", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1557 sink = gst_element_factory_make(
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1558 "fakesink", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1559 g_object_set(G_OBJECT(sink), "async", FALSE, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1560 gst_bin_add(GST_BIN(priv->confbin), sink);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1561 gst_element_set_state(sink, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1562 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1563 stream->tee = gst_element_factory_make("tee", NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1564 gst_bin_add_many(GST_BIN(priv->confbin),
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1565 stream->src, stream->tee, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1566 gst_element_set_state(stream->tee, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1567 gst_element_set_state(stream->src, GST_STATE_PLAYING);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1568 gst_element_link_many(stream->src, stream->tee, sink, NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1569 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1570
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1571 sinkpad = gst_element_get_request_pad(stream->src, "sink%d");
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1572 gst_pad_link(srcpad, sinkpad);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1573 gst_object_unref(sinkpad);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1574
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1575 stream->connected_cb_id = purple_timeout_add(0,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1576 (GSourceFunc)src_pad_added_cb_cb, stream);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1577 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1578
30622
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1579 static GValueArray *
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1580 append_relay_info(GValueArray *relay_info, const gchar *ip, gint port,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1581 const gchar *username, const gchar *password, const gchar *type)
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1582 {
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1583 GValue value;
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1584 GstStructure *turn_setup = gst_structure_new("relay-info",
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1585 "ip", G_TYPE_STRING, ip,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1586 "port", G_TYPE_UINT, port,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1587 "username", G_TYPE_STRING, username,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1588 "password", G_TYPE_STRING, password,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1589 "relay-type", G_TYPE_STRING, type,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1590 NULL);
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1591
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1592 if (turn_setup) {
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1593 memset(&value, 0, sizeof(GValue));
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1594 g_value_init(&value, GST_TYPE_STRUCTURE);
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1595 gst_value_set_structure(&value, turn_setup);
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1596 relay_info = g_value_array_append(relay_info, &value);
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1597 gst_structure_free(turn_setup);
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1598 }
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1599
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1600 return relay_info;
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1601 }
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1602
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1603 static gboolean
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1604 create_stream(PurpleMediaBackendFs2 *self,
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1605 const gchar *sess_id, const gchar *who,
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1606 PurpleMediaSessionType type, gboolean initiator,
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1607 const gchar *transmitter,
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1608 guint num_params, GParameter *params)
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1609 {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1610 PurpleMediaBackendFs2Private *priv =
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1611 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1612 GError *err = NULL;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1613 FsStream *fsstream = NULL;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1614 const gchar *stun_ip = purple_network_get_stun_ip();
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1615 const gchar *turn_ip = purple_network_get_turn_ip();
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1616 guint _num_params = num_params;
29688
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1617 GParameter *_params = g_new0(GParameter, num_params + 3);
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1618 FsStreamDirection type_direction =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1619 session_type_to_fs_stream_direction(type);
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1620 PurpleMediaBackendFs2Session *session;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1621 PurpleMediaBackendFs2Stream *stream;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1622 FsParticipant *participant;
30766
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1623 /* check if the prpl has already specified a relay-info
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1624 we need to do this to allow them to override when using non-standard
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1625 TURN modes, like Google f.ex. */
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1626 gboolean got_turn_from_prpl = FALSE;
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1627 int i;
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1628
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1629 for (i = 0 ; i < num_params ; i++) {
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1630 if (purple_strequal(params[i].name, "relay-info")) {
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1631 got_turn_from_prpl = TRUE;
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1632 break;
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1633 }
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1634 }
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1635
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1636 memcpy(_params, params, sizeof(GParameter) * num_params);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1637
29688
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1638 /* set the controlling mode parameter */
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1639 _params[_num_params].name = "controlling-mode";
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1640 g_value_init(&_params[_num_params].value, G_TYPE_BOOLEAN);
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1641 g_value_set_boolean(&_params[_num_params].value, initiator);
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1642 ++_num_params;
d5409dbda6e7 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <malu@pidgin.im>
parents: 29661
diff changeset
1643
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1644 if (stun_ip) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1645 purple_debug_info("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1646 "Setting stun-ip on new stream: %s\n", stun_ip);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1647
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1648 _params[_num_params].name = "stun-ip";
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1649 g_value_init(&_params[_num_params].value, G_TYPE_STRING);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1650 g_value_set_string(&_params[_num_params].value, stun_ip);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1651 ++_num_params;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1652 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1653
30766
602dc4de31cf Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1654 if (turn_ip && !strcmp("nice", transmitter) && !got_turn_from_prpl) {
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1655 GValueArray *relay_info = g_value_array_new(0);
30622
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1656 gint port;
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1657 const gchar *username = purple_prefs_get_string(
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1658 "/purple/network/turn_username");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1659 const gchar *password = purple_prefs_get_string(
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1660 "/purple/network/turn_password");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1661
30622
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1662 /* UDP */
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1663 port = purple_prefs_get_int("/purple/network/turn_port");
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1664 if (port > 0) {
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1665 relay_info = append_relay_info(relay_info, turn_ip, port, username,
aa5a1b0e69bd Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <malu@pidgin.im>
parents: 30424
diff changeset
1666 password, "udp");
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1667 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1668
30743
f9599fe0199c Removed the TCP and TLS TURN relaying options since libnice currently only supports these in Google mode. Added a note about this in fs-backend.c and changed the prefs label to read "UDP Port"
Marcus Lundblad <malu@pidgin.im>
parents: 30718
diff changeset
1669 /* should add TCP and perhaps TLS relaying options when these are
f9599fe0199c Removed the TCP and TLS TURN relaying options since libnice currently only supports these in Google mode. Added a note about this in fs-backend.c and changed the prefs label to read "UDP Port"
Marcus Lundblad <malu@pidgin.im>
parents: 30718
diff changeset
1670 supported by libnice using non-google mode */
f9599fe0199c Removed the TCP and TLS TURN relaying options since libnice currently only supports these in Google mode. Added a note about this in fs-backend.c and changed the prefs label to read "UDP Port"
Marcus Lundblad <malu@pidgin.im>
parents: 30718
diff changeset
1671
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1672 purple_debug_info("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1673 "Setting relay-info on new stream\n");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1674 _params[_num_params].name = "relay-info";
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1675 g_value_init(&_params[_num_params].value,
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1676 G_TYPE_VALUE_ARRAY);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1677 g_value_set_boxed(&_params[_num_params].value,
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1678 relay_info);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1679 g_value_array_free(relay_info);
30424
24a75f52a4bd media: Fix the TURN server setting to actually work again (it was apparently
Marcus Lundblad <malu@pidgin.im>
parents: 29723
diff changeset
1680 _num_params++;
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1681 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1682
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1683 session = get_session(self, sess_id);
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1684
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1685 if (session == NULL) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1686 purple_debug_error("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1687 "Couldn't find session to create stream.\n");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1688 return FALSE;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1689 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1690
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1691 participant = get_participant(self, who);
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1692
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1693 if (participant == NULL) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1694 purple_debug_error("backend-fs2", "Couldn't find "
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1695 "participant to create stream.\n");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1696 return FALSE;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1697 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1698
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1699 fsstream = fs_session_new_stream(session->session, participant,
29648
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1700 initiator == TRUE ? type_direction :
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1701 (type_direction & FS_DIRECTION_RECV), transmitter,
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1702 _num_params, _params, &err);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1703 g_free(_params);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1704
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1705 if (fsstream == NULL) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1706 if (err) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1707 purple_debug_error("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1708 "Error creating stream: %s\n",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1709 err && err->message ?
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1710 err->message : "NULL");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1711 g_error_free(err);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1712 } else
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1713 purple_debug_error("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1714 "Error creating stream\n");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1715 return FALSE;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1716 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1717
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1718 stream = g_new0(PurpleMediaBackendFs2Stream, 1);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1719 stream->participant = g_strdup(who);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1720 stream->session = session;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1721 stream->stream = fsstream;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1722
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1723 priv->streams = g_list_append(priv->streams, stream);
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1724
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1725 g_signal_connect(G_OBJECT(fsstream), "src-pad-added",
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1726 G_CALLBACK(src_pad_added_cb), stream);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1727
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1728 return TRUE;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1729 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1730
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1731 static gboolean
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1732 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1733 const gchar *sess_id, const gchar *who,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1734 PurpleMediaSessionType type, gboolean initiator,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1735 const gchar *transmitter,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1736 guint num_params, GParameter *params)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1737 {
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1738 PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self);
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1739 PurpleMediaBackendFs2Private *priv =
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1740 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend);
29595
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1741 PurpleMediaBackendFs2Stream *stream;
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1742
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1743 if (priv->conference == NULL && !init_conference(backend)) {
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1744 purple_debug_error("backend-fs2",
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1745 "Error initializing the conference.\n");
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1746 return FALSE;
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1747 }
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1748
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1749 if (get_session(backend, sess_id) == NULL &&
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1750 !create_session(backend, sess_id, type,
29569
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1751 initiator, transmitter)) {
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1752 purple_debug_error("backend-fs2",
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1753 "Error creating the session.\n");
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1754 return FALSE;
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1755 }
03db05b81c5c Begin transferring FsSession over to the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29568
diff changeset
1756
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1757 if (get_participant(backend, who) == NULL &&
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1758 !create_participant(backend, who)) {
29579
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1759 purple_debug_error("backend-fs2",
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1760 "Error creating the participant.\n");
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1761 return FALSE;
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1762 }
bbe57f516ffd Add participant creation and destruction to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29573
diff changeset
1763
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1764 stream = get_stream(backend, sess_id, who);
29595
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1765
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1766 if (stream != NULL) {
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1767 FsStreamDirection type_direction =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1768 session_type_to_fs_stream_direction(type);
29595
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1769
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1770 if (session_type_to_fs_stream_direction(
29595
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1771 stream->session->type) != type_direction) {
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1772 /* change direction */
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1773 g_object_set(stream->stream, "direction",
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1774 type_direction, NULL);
f7e57d58c8be Move odd direction changing functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29594
diff changeset
1775 }
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1776 } else if (!create_stream(backend, sess_id, who, type,
29582
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1777 initiator, transmitter, num_params, params)) {
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1778 purple_debug_error("backend-fs2",
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1779 "Error creating the stream.\n");
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1780 return FALSE;
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1781 }
c4ef3aed1366 Transfer creating Farsight 2 streams to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29580
diff changeset
1782
29559
fc9fa90d7c4a Create and dispose the conference in the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29556
diff changeset
1783 return TRUE;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1784 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1785
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1786 static void
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1787 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1788 const gchar *sess_id, const gchar *participant,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1789 GList *remote_candidates)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1790 {
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1791 PurpleMediaBackendFs2Private *priv;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1792 PurpleMediaBackendFs2Stream *stream;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1793 GError *err = NULL;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1794
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1795 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1796
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1797 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1798 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1799 sess_id, participant);
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1800
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1801 if (stream == NULL) {
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1802 purple_debug_error("backend-fs2",
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1803 "purple_media_add_remote_candidates: "
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1804 "couldn't find stream %s %s.\n",
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1805 sess_id ? sess_id : "(null)",
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1806 participant ? participant : "(null)");
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1807 return;
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1808 }
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1809
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1810 stream->remote_candidates = g_list_concat(stream->remote_candidates,
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1811 candidate_list_to_fs(remote_candidates));
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1812
29648
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1813 if (purple_media_is_initiator(priv->media, sess_id, participant) ||
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1814 purple_media_accepted(
be1362619ef2 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
Michael Ruprecht <maiku@pidgin.im>
parents: 29623
diff changeset
1815 priv->media, sess_id, participant)) {
29583
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1816 fs_stream_set_remote_candidates(stream->stream,
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1817 stream->remote_candidates, &err);
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1818
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1819 if (err) {
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1820 purple_debug_error("backend-fs2", "Error adding remote"
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1821 " candidates: %s\n", err->message);
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1822 g_error_free(err);
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1823 }
706454e8df2b Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29582
diff changeset
1824 }
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1825 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1826
29597
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1827 static gboolean
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1828 purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self,
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1829 const gchar *sess_id)
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1830 {
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1831 PurpleMediaBackendFs2Private *priv;
30627
5aba54c21ca3 Fix a possible Garbage return value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30424
diff changeset
1832 gboolean ret = FALSE;
29597
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1833
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1834 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1835
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1836 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1837
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1838 if (sess_id != NULL) {
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1839 PurpleMediaBackendFs2Session *session = get_session(
29597
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1840 PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1841
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1842 if (session == NULL)
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1843 return FALSE;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1844
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1845 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1846 PURPLE_MEDIA_SEND_VIDEO))
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1847 g_object_get(session->session,
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1848 "codecs-ready", &ret, NULL);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1849 else
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1850 ret = TRUE;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1851 } else {
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1852 GList *values = g_hash_table_get_values(priv->sessions);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1853
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1854 for (; values; values = g_list_delete_link(values, values)) {
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1855 PurpleMediaBackendFs2Session *session = values->data;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1856 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1857 PURPLE_MEDIA_SEND_VIDEO))
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1858 g_object_get(session->session,
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1859 "codecs-ready", &ret, NULL);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1860 else
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1861 ret = TRUE;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1862
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1863 if (ret == FALSE)
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1864 break;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1865 }
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1866
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1867 if (values != NULL)
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1868 g_list_free(values);
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1869 }
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1870
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1871 return ret;
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1872 }
22843326ee22 Add codecs_ready to the media backend interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 29595
diff changeset
1873
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1874 static GList *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1875 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1876 const gchar *sess_id)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1877 {
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1878 PurpleMediaBackendFs2Session *session;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1879 GList *fscodecs;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1880 GList *codecs;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1881
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1882 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1883
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1884 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1885
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1886 if (session == NULL)
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1887 return NULL;
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1888
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1889 g_object_get(G_OBJECT(session->session),
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1890 "codecs", &fscodecs, NULL);
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1891 codecs = codec_list_from_fs(fscodecs);
29585
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1892 fs_codec_list_destroy(fscodecs);
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1893
37a79cc62b55 Transfer get_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29583
diff changeset
1894 return codecs;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1895 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1896
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1897 static GList *
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1898 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1899 const gchar *sess_id, const gchar *participant)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1900 {
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1901 PurpleMediaBackendFs2Stream *stream;
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1902 GList *candidates = NULL;
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1903
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1904 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1905
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1906 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1907 sess_id, participant);
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1908
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1909 if (stream != NULL)
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1910 candidates = candidate_list_from_fs(
29587
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1911 stream->local_candidates);
9bf09e3031b0 Move get_local_candidates functionality over to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29586
diff changeset
1912 return candidates;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1913 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1914
29588
a3fef46ce04a Make the backend interface's set_remote_codecs function return gboolean.
Michael Ruprecht <maiku@pidgin.im>
parents: 29587
diff changeset
1915 static gboolean
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1916 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1917 const gchar *sess_id, const gchar *participant,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1918 GList *codecs)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1919 {
29589
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1920 PurpleMediaBackendFs2Stream *stream;
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1921 GList *fscodecs;
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1922 GError *err = NULL;
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1923
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1924 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1925 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29589
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1926 sess_id, participant);
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1927
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1928 if (stream == NULL)
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1929 return FALSE;
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1930
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1931 fscodecs = codec_list_to_fs(codecs);
29589
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1932 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err);
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1933 fs_codec_list_destroy(fscodecs);
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1934
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1935 if (err) {
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1936 purple_debug_error("backend-fs2",
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1937 "Error setting remote codecs: %s\n",
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1938 err->message);
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1939 g_error_free(err);
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1940 return FALSE;
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1941 }
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1942
3ff2d4b37b1f Move set_remote_codecs functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29588
diff changeset
1943 return TRUE;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1944 }
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1945
29590
bec92b90acc9 Change the media backend interface's set_send_codec to return gboolean to
Michael Ruprecht <maiku@pidgin.im>
parents: 29589
diff changeset
1946 static gboolean
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1947 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1948 const gchar *sess_id, PurpleMediaCodec *codec)
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1949 {
29591
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1950 PurpleMediaBackendFs2Session *session;
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1951 FsCodec *fscodec;
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1952 GError *err = NULL;
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1953
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1954 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1955
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1956 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
29591
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1957
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1958 if (session == NULL)
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1959 return FALSE;
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1960
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1961 fscodec = codec_to_fs(codec);
29591
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1962 fs_session_set_send_codec(session->session, fscodec, &err);
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1963 fs_codec_destroy(fscodec);
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1964
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1965 if (err) {
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1966 purple_debug_error("media", "Error setting send codec\n");
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1967 g_error_free(err);
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1968 return FALSE;
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1969 }
fe94e4516832 Move set_remote_codec functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29590
diff changeset
1970
29590
bec92b90acc9 Change the media backend interface's set_send_codec to return gboolean to
Michael Ruprecht <maiku@pidgin.im>
parents: 29589
diff changeset
1971 return TRUE;
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1972 }
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1973 #else
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1974 GType
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1975 purple_media_backend_fs2_get_type(void)
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1976 {
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1977 return G_TYPE_NONE;
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1978 }
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1979 #endif /* USE_VV */
29556
ebf1af169279 Skeleton of the Farsight 2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1980
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1981 #ifdef USE_GSTREAMER
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1982 GstElement *
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1983 purple_media_backend_fs2_get_src(PurpleMediaBackendFs2 *self,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1984 const gchar *sess_id)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1985 {
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1986 #ifdef USE_VV
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
1987 PurpleMediaBackendFs2Session *session = get_session(self, sess_id);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1988 return session != NULL ? session->src : NULL;
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1989 #else
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1990 return NULL;
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1991 #endif
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1992 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1993
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1994 GstElement *
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1995 purple_media_backend_fs2_get_tee(PurpleMediaBackendFs2 *self,
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1996 const gchar *sess_id, const gchar *who)
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1997 {
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
1998 #ifdef USE_VV
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
1999 if (sess_id != NULL && who == NULL) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2000 PurpleMediaBackendFs2Session *session =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
2001 get_session(self, sess_id);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2002 return (session != NULL) ? session->tee : NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2003 } else if (sess_id != NULL && who != NULL) {
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2004 PurpleMediaBackendFs2Stream *stream =
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
2005 get_stream(self, sess_id, who);
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2006 return (stream != NULL) ? stream->tee : NULL;
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2007 }
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2008
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
2009 #endif /* USE_VV */
29599
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2010 g_return_val_if_reached(NULL);
24e1d49a6fce Move all src and sink creation in PurpleMedia to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29598
diff changeset
2011 }
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2012
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2013 void
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2014 purple_media_backend_fs2_set_input_volume(PurpleMediaBackendFs2 *self,
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2015 const gchar *sess_id, double level)
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2016 {
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
2017 #ifdef USE_VV
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2018 PurpleMediaBackendFs2Private *priv;
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2019 GList *sessions;
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2020
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2021 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2022
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2023 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2024
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2025 purple_prefs_set_int("/purple/media/audio/volume/input", level);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2026
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2027 if (sess_id == NULL)
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2028 sessions = g_hash_table_get_values(priv->sessions);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2029 else
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
2030 sessions = g_list_append(NULL, get_session(self, sess_id));
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2031
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2032 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2033 PurpleMediaBackendFs2Session *session = sessions->data;
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2034
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2035 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2036 gchar *name = g_strdup_printf("volume_%s",
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2037 session->id);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2038 GstElement *volume = gst_bin_get_by_name(
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2039 GST_BIN(priv->confbin), name);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2040 g_free(name);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2041 g_object_set(volume, "volume", level/10.0, NULL);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2042 }
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2043 }
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
2044 #endif /* USE_VV */
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2045 }
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2046
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2047 void
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2048 purple_media_backend_fs2_set_output_volume(PurpleMediaBackendFs2 *self,
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2049 const gchar *sess_id, const gchar *who, double level)
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2050 {
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
2051 #ifdef USE_VV
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2052 GList *streams;
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2053
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2054 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2055
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2056 purple_prefs_set_int("/purple/media/audio/volume/output", level);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2057
29623
664df0ecb40f Remove the underscore from functions as the underscore is reserved for compilers
Michael Ruprecht <maiku@pidgin.im>
parents: 29619
diff changeset
2058 streams = get_streams(self, sess_id, who);
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2059
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2060 for (; streams; streams = g_list_delete_link(streams, streams)) {
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2061 PurpleMediaBackendFs2Stream *stream = streams->data;
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2062
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2063 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2064 && GST_IS_ELEMENT(stream->volume)) {
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2065 g_object_set(stream->volume, "volume",
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2066 level/10.0, NULL);
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2067 }
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2068 }
29657
d7e6c5fcabcc Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
Michael Ruprecht <maiku@pidgin.im>
parents: 29648
diff changeset
2069 #endif /* USE_VV */
29601
fb1168d4ee6b Move volume setting functionality to the Fs2 media backend.
Michael Ruprecht <maiku@pidgin.im>
parents: 29600
diff changeset
2070 }
29661
ae75a0a4d399 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29657
diff changeset
2071 #endif /* USE_GSTREAMER */

mercurial