annotate libpurple/media/backend-fs2.c @ 32766:fd1b4bbefc6b

Port to Farstream Farstream is the new name of Farsight. The changes to support Farstream are from ocrete. rlaager modified the patch to retain the Farsight code using #ifdef HAVE_FARSIGHT. committer: Richard Laager <rlaager@wiktel.com>
author olivier.crete@collabora.com
date Thu, 05 Apr 2012 03:18:40 +0000
parents 60bd913072f7
children cb2084b4a463
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1 /**
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2 * @file backend-fs2.c Farstream backend for media API
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
3 * @ingroup core
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
4 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
5
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
6 /* purple
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
7 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
10 * source distribution.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
11 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
15 * (at your option) any later version.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
16 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
20 * GNU General Public License for more details.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
21 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
25 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
26
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
27 #include "internal.h"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
28
29325
858d1a47bf83 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29320
diff changeset
29 #include "backend-fs2.h"
858d1a47bf83 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29320
diff changeset
30
29394
e75d6a51a5c4 Compile with --disable-vv. Without this change I get this error:
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
31 #ifdef USE_VV
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
32 #include "backend-iface.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
33 #include "debug.h"
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
34 #include "network.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
35 #include "media-gst.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
36
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
37 #ifdef HAVE_FARSIGHT
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
38 #include <gst/farsight/fs-conference-iface.h>
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
39 #include <gst/farsight/fs-element-added-notifier.h>
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
40 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
41 #include <farstream/fs-conference.h>
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
42 #include <farstream/fs-element-added-notifier.h>
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
43 #include <farstream/fs-utils.h>
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
44 #endif
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
45
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
46 /** @copydoc _PurpleMediaBackendFs2Class */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
47 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
48 /** @copydoc _PurpleMediaBackendFs2Private */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
49 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private;
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
50 /** @copydoc _PurpleMediaBackendFs2Session */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
51 typedef struct _PurpleMediaBackendFs2Session PurpleMediaBackendFs2Session;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
52 /** @copydoc _PurpleMediaBackendFs2Stream */
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
53 typedef struct _PurpleMediaBackendFs2Stream PurpleMediaBackendFs2Stream;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
54
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
55 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
56 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
57 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private))
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
58
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
59 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
60
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
61 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
62 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
63 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
64 state_changed_cb(PurpleMedia *media, PurpleMediaState state,
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
65 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
66 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
67 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
68 gchar *sid, gchar *name, gboolean local,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
69 PurpleMediaBackendFs2 *self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
70
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
71 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
72 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
73 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
74 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
75 guint num_params, GParameter *params);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
76 static void purple_media_backend_fs2_add_remote_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
77 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
78 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
79 GList *remote_candidates);
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
80 static gboolean purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self,
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
81 const gchar *sess_id);
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
82 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
83 const gchar *sess_id);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
84 static GList *purple_media_backend_fs2_get_local_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
85 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
86 const gchar *sess_id, const gchar *participant);
29178
a7cad99144f0 Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents: 29177
diff changeset
87 static gboolean purple_media_backend_fs2_set_remote_codecs(
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
88 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
89 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
90 GList *codecs);
29180
90c48f1e479a Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents: 29179
diff changeset
91 static gboolean purple_media_backend_fs2_set_send_codec(
90c48f1e479a Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents: 29179
diff changeset
92 PurpleMediaBackend *self, const gchar *sess_id,
90c48f1e479a Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents: 29179
diff changeset
93 PurpleMediaCodec *codec);
31517
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
94 static void purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
95 guint num_params, GParameter *params);
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
96 static const gchar **purple_media_backend_fs2_get_available_params(void);
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
97
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
98 static void free_stream(PurpleMediaBackendFs2Stream *stream);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
99 static void free_session(PurpleMediaBackendFs2Session *session);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
100
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
101 struct _PurpleMediaBackendFs2Class
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
102 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
103 GObjectClass parent_class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
104 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
105
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
106 struct _PurpleMediaBackendFs2
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
107 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
108 GObject parent;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
109 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
110
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
111 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
112 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
113 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
114
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
115 struct _PurpleMediaBackendFs2Stream
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
116 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
117 PurpleMediaBackendFs2Session *session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
118 gchar *participant;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
119 FsStream *stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
120
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
121 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
122 gboolean supports_add;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
123 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
124
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
125 GstElement *src;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
126 GstElement *tee;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
127 GstElement *volume;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
128 GstElement *level;
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
129 GstElement *fakesink;
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
130 GstElement *queue;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
131
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
132 GList *local_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
133 GList *remote_candidates;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
134
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
135 guint connected_cb_id;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
136 };
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
137
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
138 struct _PurpleMediaBackendFs2Session
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
139 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
140 PurpleMediaBackendFs2 *backend;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
141 gchar *id;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
142 FsSession *session;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
143
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
144 GstElement *src;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
145 GstElement *tee;
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
146 GstElement *srcvalve;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
147
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
148 GstPad *srcpad;
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
149
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
150 PurpleMediaSessionType type;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
151 };
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
152
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
153 struct _PurpleMediaBackendFs2Private
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
154 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
155 PurpleMedia *media;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
156 GstElement *confbin;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
157 FsConference *conference;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
158 gchar *conference_type;
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
159
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
160 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
161 FsElementAddedNotifier *notifier;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
162 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
163
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
164 GHashTable *sessions;
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
165 GHashTable *participants;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
166
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
167 GList *streams;
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
168
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
169 gdouble silence_threshold;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
170 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
171
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
172 enum {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
173 PROP_0,
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
174 PROP_CONFERENCE_TYPE,
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
175 PROP_MEDIA,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
176 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
177
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
178 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
179 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
31375
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
180 {}
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
181
31152
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
182 static gboolean
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
183 event_probe_cb(GstPad *srcpad, GstEvent *event, gboolean release_pad)
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
184 {
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
185 if (GST_EVENT_TYPE(event) == GST_EVENT_CUSTOM_DOWNSTREAM
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
186 && gst_event_has_name(event, "purple-unlink-tee")) {
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
187
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
188 const GstStructure *s = gst_event_get_structure(event);
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
189
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
190 gst_pad_unlink(srcpad, gst_pad_get_peer(srcpad));
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
191
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
192 gst_pad_remove_event_probe(srcpad,
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
193 g_value_get_uint(gst_structure_get_value(s, "handler-id")));
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
194
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
195 if (g_value_get_boolean(gst_structure_get_value(s, "release-pad")))
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
196 gst_element_release_request_pad(GST_ELEMENT_PARENT(srcpad), srcpad);
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
197
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
198 return FALSE;
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
199 }
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
200
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
201 return TRUE;
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
202 }
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
203
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
204 static void
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
205 unlink_teepad_dynamic(GstPad *srcpad, gboolean release_pad)
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
206 {
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
207 guint id = gst_pad_add_event_probe(srcpad, G_CALLBACK(event_probe_cb), NULL);
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
208
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
209 if (GST_IS_GHOST_PAD(srcpad))
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
210 srcpad = gst_ghost_pad_get_target(GST_GHOST_PAD(srcpad));
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
211
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
212 gst_element_send_event(gst_pad_get_parent_element(srcpad),
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
213 gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM,
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
214 gst_structure_new("purple-unlink-tee",
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
215 "release-pad", G_TYPE_BOOLEAN, release_pad,
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
216 "handler-id", G_TYPE_UINT, id,
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
217 NULL)));
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
218 }
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
219
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
220 static void
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
221 purple_media_backend_fs2_dispose(GObject *obj)
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
222 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
223 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
224 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
29183
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
225 GList *iter = NULL;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
226
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
227 purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
228
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
229 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
230 if (priv->notifier) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
231 g_object_unref(priv->notifier);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
232 priv->notifier = NULL;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
233 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
234 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
235
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
236 if (priv->confbin) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
237 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
238
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
239 pipeline = purple_media_manager_get_pipeline(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
240 purple_media_get_manager(priv->media));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
241
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
242 /* All connections to media sources should be blocked before confbin is
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
243 * removed, to prevent freezing of any other simultaneously running
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
244 * media calls. */
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
245 if (priv->sessions) {
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
246 GList *sessions = g_hash_table_get_values(priv->sessions);
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
247 for (; sessions; sessions =
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
248 g_list_delete_link(sessions, sessions)) {
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
249 PurpleMediaBackendFs2Session *session = sessions->data;
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
250 if (session->srcpad) {
31152
66fe4bda9a85 This is a better way to handle ending one call when multiple calls are in
jakub.adam@ktknet.cz
parents: 31105
diff changeset
251 unlink_teepad_dynamic(session->srcpad, FALSE);
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
252 gst_object_unref(session->srcpad);
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
253 session->srcpad = NULL;
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
254 }
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
255 }
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
256 }
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
257
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
258 gst_element_set_locked_state(priv->confbin, TRUE);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
259 gst_element_set_state(GST_ELEMENT(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
260 GST_STATE_NULL);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
261
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
262 if (pipeline) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
263 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
264 gst_bin_remove(GST_BIN(pipeline), priv->confbin);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
265 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
266 g_signal_handlers_disconnect_matched(G_OBJECT(bus),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
267 G_SIGNAL_MATCH_FUNC |
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
268 G_SIGNAL_MATCH_DATA,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
269 0, 0, 0, gst_bus_cb, obj);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
270 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
271 } else {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
272 purple_debug_warning("backend-fs2", "Unable to "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
273 "properly dispose the conference. "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
274 "Couldn't get the pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
275 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
276
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
277 priv->confbin = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
278 priv->conference = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
279
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
280 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
281
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
282 if (priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
283 GList *sessions = g_hash_table_get_values(priv->sessions);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
284
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
285 for (; sessions; sessions =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
286 g_list_delete_link(sessions, sessions)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
287 PurpleMediaBackendFs2Session *session =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
288 sessions->data;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
289
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
290 if (session->session) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
291 g_object_unref(session->session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
292 session->session = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
293 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
294 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
295 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
296
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
297 if (priv->participants) {
30439
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 30430
diff changeset
298 g_hash_table_destroy(priv->participants);
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
299 priv->participants = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
300 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
301
29183
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
302 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
303 PurpleMediaBackendFs2Stream *stream = iter->data;
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
304 if (stream->stream) {
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
305 g_object_unref(stream->stream);
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
306 stream->stream = NULL;
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
307 }
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
308 }
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
309
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
310 if (priv->media) {
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
311 g_object_remove_weak_pointer(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
312 (gpointer*)&priv->media);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
313 priv->media = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
314 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
315
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
316 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
317 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
318
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
319 static void
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
320 purple_media_backend_fs2_finalize(GObject *obj)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
321 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
322 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
323 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
324
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
325 purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n");
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
326
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
327 g_free(priv->conference_type);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
328
29183
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
329 for (; priv->streams; priv->streams =
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
330 g_list_delete_link(priv->streams, priv->streams)) {
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
331 PurpleMediaBackendFs2Stream *stream = priv->streams->data;
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
332 free_stream(stream);
29183
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
333 }
3bab2237724d Properly free PurpleMediaBackendFs2Stream's.
maiku@pidgin.im
parents: 29182
diff changeset
334
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
335 if (priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
336 GList *sessions = g_hash_table_get_values(priv->sessions);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
337
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
338 for (; sessions; sessions =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
339 g_list_delete_link(sessions, sessions)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
340 PurpleMediaBackendFs2Session *session =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
341 sessions->data;
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
342 free_session(session);
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
343 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
344
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
345 g_hash_table_destroy(priv->sessions);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
346 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
347
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
348 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj);
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
349 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
350
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
351 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
352 purple_media_backend_fs2_set_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
353 const GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
354 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
355 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
356 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
357
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
358 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
359
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
360 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
361 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
362 priv->conference_type = g_value_dup_string(value);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
363 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
364 case PROP_MEDIA:
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
365 priv->media = g_value_get_object(value);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
366
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
367 if (priv->media == NULL)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
368 break;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
369
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
370 g_object_add_weak_pointer(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
371 (gpointer*)&priv->media);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
372
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
373 g_signal_connect(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
374 "state-changed",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
375 G_CALLBACK(state_changed_cb),
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
376 PURPLE_MEDIA_BACKEND_FS2(object));
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
377 g_signal_connect(G_OBJECT(priv->media), "stream-info",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
378 G_CALLBACK(stream_info_cb),
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
379 PURPLE_MEDIA_BACKEND_FS2(object));
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
380 break;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
381 default:
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
382 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
383 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
384 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
385 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
386 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
387
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
388 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
389 purple_media_backend_fs2_get_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
390 GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
391 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
392 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
393 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
394
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
395 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
396
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
397 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
398 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
399 g_value_set_string(value, priv->conference_type);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
400 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
401 case PROP_MEDIA:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
402 g_value_set_object(value, priv->media);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
403 break;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
404 default:
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
405 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
406 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
407 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
408 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
409 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
410
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
411 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
412 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
413 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
414 GObjectClass *gobject_class = (GObjectClass*)klass;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
415
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
416 gobject_class->dispose = purple_media_backend_fs2_dispose;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
417 gobject_class->finalize = purple_media_backend_fs2_finalize;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
418 gobject_class->set_property = purple_media_backend_fs2_set_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
419 gobject_class->get_property = purple_media_backend_fs2_get_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
420
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
421 g_object_class_override_property(gobject_class, PROP_CONFERENCE_TYPE,
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
422 "conference-type");
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
423 g_object_class_override_property(gobject_class, PROP_MEDIA, "media");
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
424
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
425 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
426 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
427
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
428 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
429 purple_media_backend_iface_init(PurpleMediaBackendIface *iface)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
430 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
431 iface->add_stream = purple_media_backend_fs2_add_stream;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
432 iface->add_remote_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
433 purple_media_backend_fs2_add_remote_candidates;
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
434 iface->codecs_ready = purple_media_backend_fs2_codecs_ready;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
435 iface->get_codecs = purple_media_backend_fs2_get_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
436 iface->get_local_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
437 purple_media_backend_fs2_get_local_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
438 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
439 iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
31517
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
440 iface->set_params = purple_media_backend_fs2_set_params;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
441 iface->get_available_params = purple_media_backend_fs2_get_available_params;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
442 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
443
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
444 static FsMediaType
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
445 session_type_to_fs_media_type(PurpleMediaSessionType type)
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
446 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
447 if (type & PURPLE_MEDIA_AUDIO)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
448 return FS_MEDIA_TYPE_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
449 else if (type & PURPLE_MEDIA_VIDEO)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
450 return FS_MEDIA_TYPE_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
451 else
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
452 return 0;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
453 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
454
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
455 static FsStreamDirection
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
456 session_type_to_fs_stream_direction(PurpleMediaSessionType type)
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
457 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
458 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
459 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
460 return FS_DIRECTION_BOTH;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
461 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
462 (type & PURPLE_MEDIA_SEND_VIDEO))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
463 return FS_DIRECTION_SEND;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
464 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
465 (type & PURPLE_MEDIA_RECV_VIDEO))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
466 return FS_DIRECTION_RECV;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
467 else
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
468 return FS_DIRECTION_NONE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
469 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
470
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
471 static PurpleMediaSessionType
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
472 session_type_from_fs(FsMediaType type, FsStreamDirection direction)
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
473 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
474 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
475 if (type == FS_MEDIA_TYPE_AUDIO) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
476 if (direction & FS_DIRECTION_SEND)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
477 result |= PURPLE_MEDIA_SEND_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
478 if (direction & FS_DIRECTION_RECV)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
479 result |= PURPLE_MEDIA_RECV_AUDIO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
480 } else if (type == FS_MEDIA_TYPE_VIDEO) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
481 if (direction & FS_DIRECTION_SEND)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
482 result |= PURPLE_MEDIA_SEND_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
483 if (direction & FS_DIRECTION_RECV)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
484 result |= PURPLE_MEDIA_RECV_VIDEO;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
485 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
486 return result;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
487 }
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
488
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
489 static FsCandidate *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
490 candidate_to_fs(PurpleMediaCandidate *candidate)
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
491 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
492 FsCandidate *fscandidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
493 gchar *foundation;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
494 guint component_id;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
495 gchar *ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
496 guint port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
497 gchar *base_ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
498 guint base_port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
499 PurpleMediaNetworkProtocol proto;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
500 guint32 priority;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
501 PurpleMediaCandidateType type;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
502 gchar *username;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
503 gchar *password;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
504 guint ttl;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
505
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
506 if (candidate == NULL)
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
507 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
508
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
509 g_object_get(G_OBJECT(candidate),
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
510 "foundation", &foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
511 "component-id", &component_id,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
512 "ip", &ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
513 "port", &port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
514 "base-ip", &base_ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
515 "base-port", &base_port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
516 "protocol", &proto,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
517 "priority", &priority,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
518 "type", &type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
519 "username", &username,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
520 "password", &password,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
521 "ttl", &ttl,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
522 NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
523
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
524 fscandidate = fs_candidate_new(foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
525 component_id, type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
526 proto, ip, port);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
527
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
528 fscandidate->base_ip = base_ip;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
529 fscandidate->base_port = base_port;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
530 fscandidate->priority = priority;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
531 fscandidate->username = username;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
532 fscandidate->password = password;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
533 fscandidate->ttl = ttl;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
534
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
535 g_free(foundation);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
536 g_free(ip);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
537 return fscandidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
538 }
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
539
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
540 static GList *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
541 candidate_list_to_fs(GList *candidates)
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
542 {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
543 GList *new_list = NULL;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
544
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
545 for (; candidates; candidates = g_list_next(candidates)) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
546 new_list = g_list_prepend(new_list,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
547 candidate_to_fs(candidates->data));
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
548 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
549
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
550 new_list = g_list_reverse(new_list);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
551 return new_list;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
552 }
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
553
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
554 static PurpleMediaCandidate *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
555 candidate_from_fs(FsCandidate *fscandidate)
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
556 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
557 PurpleMediaCandidate *candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
558
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
559 if (fscandidate == NULL)
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
560 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
561
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
562 candidate = purple_media_candidate_new(fscandidate->foundation,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
563 fscandidate->component_id, fscandidate->type,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
564 fscandidate->proto, fscandidate->ip, fscandidate->port);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
565 g_object_set(candidate,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
566 "base-ip", fscandidate->base_ip,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
567 "base-port", fscandidate->base_port,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
568 "priority", fscandidate->priority,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
569 "username", fscandidate->username,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
570 "password", fscandidate->password,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
571 "ttl", fscandidate->ttl, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
572 return candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
573 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
574
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
575 static GList *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
576 candidate_list_from_fs(GList *candidates)
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
577 {
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
578 GList *new_list = NULL;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
579
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
580 for (; candidates; candidates = g_list_next(candidates)) {
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
581 new_list = g_list_prepend(new_list,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
582 candidate_from_fs(candidates->data));
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
583 }
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
584
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
585 new_list = g_list_reverse(new_list);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
586 return new_list;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
587 }
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
588
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
589 static FsCodec *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
590 codec_to_fs(const PurpleMediaCodec *codec)
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
591 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
592 FsCodec *new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
593 gint id;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
594 char *encoding_name;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
595 PurpleMediaSessionType media_type;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
596 guint clock_rate;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
597 guint channels;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
598 GList *iter;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
599
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
600 if (codec == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
601 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
602
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
603 g_object_get(G_OBJECT(codec),
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
604 "id", &id,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
605 "encoding-name", &encoding_name,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
606 "media-type", &media_type,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
607 "clock-rate", &clock_rate,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
608 "channels", &channels,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
609 "optional-params", &iter,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
610 NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
611
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
612 new_codec = fs_codec_new(id, encoding_name,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
613 session_type_to_fs_media_type(media_type),
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
614 clock_rate);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
615 new_codec->channels = channels;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
616
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
617 for (; iter; iter = g_list_next(iter)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
618 PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
619 fs_codec_add_optional_parameter(new_codec,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
620 param->key, param->value);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
621 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
622
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
623 g_free(encoding_name);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
624 return new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
625 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
626
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
627 static PurpleMediaCodec *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
628 codec_from_fs(const FsCodec *codec)
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
629 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
630 PurpleMediaCodec *new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
631 GList *iter;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
632
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
633 if (codec == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
634 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
635
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
636 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
637 session_type_from_fs(codec->media_type,
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
638 FS_DIRECTION_BOTH), codec->clock_rate);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
639 g_object_set(new_codec, "channels", codec->channels, NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
640
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
641 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
642 FsCodecParameter *param = (FsCodecParameter*)iter->data;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
643 purple_media_codec_add_optional_parameter(new_codec,
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
644 param->name, param->value);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
645 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
646
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
647 return new_codec;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
648 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
649
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
650 static GList *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
651 codec_list_from_fs(GList *codecs)
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
652 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
653 GList *new_list = NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
654
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
655 for (; codecs; codecs = g_list_next(codecs)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
656 new_list = g_list_prepend(new_list,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
657 codec_from_fs(codecs->data));
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
658 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
659
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
660 new_list = g_list_reverse(new_list);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
661 return new_list;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
662 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
663
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
664 static GList *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
665 codec_list_to_fs(GList *codecs)
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
666 {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
667 GList *new_list = NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
668
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
669 for (; codecs; codecs = g_list_next(codecs)) {
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
670 new_list = g_list_prepend(new_list,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
671 codec_to_fs(codecs->data));
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
672 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
673
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
674 new_list = g_list_reverse(new_list);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
675 return new_list;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
676 }
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
677
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
678 static PurpleMediaBackendFs2Session *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
679 get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id)
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
680 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
681 PurpleMediaBackendFs2Private *priv;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
682 PurpleMediaBackendFs2Session *session = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
683
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
684 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
685
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
686 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
687
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
688 if (priv->sessions != NULL)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
689 session = g_hash_table_lookup(priv->sessions, sess_id);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
690
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
691 return session;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
692 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
693
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
694 static FsParticipant *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
695 get_participant(PurpleMediaBackendFs2 *self, const gchar *name)
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
696 {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
697 PurpleMediaBackendFs2Private *priv;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
698 FsParticipant *participant = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
699
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
700 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
701
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
702 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
703
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
704 if (priv->participants != NULL)
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
705 participant = g_hash_table_lookup(priv->participants, name);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
706
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
707 return participant;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
708 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
709
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
710 static PurpleMediaBackendFs2Stream *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
711 get_stream(PurpleMediaBackendFs2 *self,
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
712 const gchar *sess_id, const gchar *name)
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
713 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
714 PurpleMediaBackendFs2Private *priv;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
715 GList *streams;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
716
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
717 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
718
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
719 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
720 streams = priv->streams;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
721
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
722 for (; streams; streams = g_list_next(streams)) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
723 PurpleMediaBackendFs2Stream *stream = streams->data;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
724 if (!strcmp(stream->session->id, sess_id) &&
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
725 !strcmp(stream->participant, name))
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
726 return stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
727 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
728
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
729 return NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
730 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
731
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
732 static GList *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
733 get_streams(PurpleMediaBackendFs2 *self,
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
734 const gchar *sess_id, const gchar *name)
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
735 {
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
736 PurpleMediaBackendFs2Private *priv;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
737 GList *streams, *ret = NULL;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
738
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
739 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
740
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
741 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
742 streams = priv->streams;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
743
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
744 for (; streams; streams = g_list_next(streams)) {
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
745 PurpleMediaBackendFs2Stream *stream = streams->data;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
746
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
747 if (sess_id != NULL && strcmp(stream->session->id, sess_id))
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
748 continue;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
749 else if (name != NULL && strcmp(stream->participant, name))
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
750 continue;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
751 else
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
752 ret = g_list_prepend(ret, stream);
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
753 }
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
754
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
755 ret = g_list_reverse(ret);
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
756 return ret;
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
757 }
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
758
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
759 static PurpleMediaBackendFs2Session *
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
760 get_session_from_fs_stream(PurpleMediaBackendFs2 *self, FsStream *stream)
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
761 {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
762 PurpleMediaBackendFs2Private *priv =
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
763 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
764 FsSession *fssession;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
765 GList *values;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
766
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
767 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
768 g_return_val_if_fail(FS_IS_STREAM(stream), NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
769
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
770 g_object_get(stream, "session", &fssession, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
771
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
772 values = g_hash_table_get_values(priv->sessions);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
773
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
774 for (; values; values = g_list_delete_link(values, values)) {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
775 PurpleMediaBackendFs2Session *session = values->data;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
776
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
777 if (session->session == fssession) {
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
778 g_list_free(values);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
779 g_object_unref(fssession);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
780 return session;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
781 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
782 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
783
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
784 g_object_unref(fssession);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
785 return NULL;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
786 }
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
787
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
788 static gdouble
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
789 gst_msg_db_to_percent(GstMessage *msg, gchar *value_name)
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
790 {
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
791 const GValue *list;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
792 const GValue *value;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
793 gdouble value_db;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
794 gdouble percent;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
795
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
796 list = gst_structure_get_value(
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
797 gst_message_get_structure(msg), value_name);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
798 value = gst_value_list_get_value(list, 0);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
799 value_db = g_value_get_double(value);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
800 percent = pow(10, value_db / 20);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
801 return (percent > 1.0) ? 1.0 : percent;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
802 }
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
803
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
804 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
805 gst_handle_message_element(GstBus *bus, GstMessage *msg,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
806 PurpleMediaBackendFs2 *self)
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
807 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
808 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
809 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
810 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
811 static guint level_id = 0;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
812
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
813 if (level_id == 0)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
814 level_id = g_signal_lookup("level", PURPLE_TYPE_MEDIA);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
815
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
816 if (gst_structure_has_name(msg->structure, "level")) {
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
817 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
818 gchar *name;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
819 gchar *participant = NULL;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
820 PurpleMediaBackendFs2Session *session = NULL;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
821 gdouble percent;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
822
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
823 if (!PURPLE_IS_MEDIA(priv->media) ||
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
824 GST_ELEMENT_PARENT(src) != priv->confbin)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
825 return;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
826
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
827 name = gst_element_get_name(src);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
828
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
829 if (!strncmp(name, "sendlevel_", 10)) {
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
830 session = get_session(self, name+10);
31375
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
831 if (priv->silence_threshold > 0) {
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
832 percent = gst_msg_db_to_percent(msg, "decay");
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
833 g_object_set(session->srcvalve,
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
834 "drop", (percent < priv->silence_threshold), NULL);
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
835 }
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
836 }
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
837
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
838 g_free(name);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
839
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
840 if (!g_signal_has_handler_pending(priv->media, level_id, 0, FALSE))
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
841 return;
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
842
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
843 if (!session) {
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
844 GList *iter = priv->streams;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
845 PurpleMediaBackendFs2Stream *stream;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
846 for (; iter; iter = g_list_next(iter)) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
847 stream = iter->data;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
848 if (stream->level == src) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
849 session = stream->session;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
850 participant = stream->participant;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
851 break;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
852 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
853 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
854 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
855
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
856 if (!session)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
857 return;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
858
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
859 percent = gst_msg_db_to_percent(msg, "rms");
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
860
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
861 g_signal_emit(priv->media, level_id, 0,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
862 session->id, participant, percent);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
863 return;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
864 }
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
865
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
866 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) ||
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
867 priv->conference != FS_CONFERENCE(src))
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
868 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
869
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
870 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
871 if (gst_structure_has_name(msg->structure, "farsight-error")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
872 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
873 if (gst_structure_has_name(msg->structure, "farstream-error")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
874 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
875 FsError error_no;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
876 gst_structure_get_enum(msg->structure, "error-no",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
877 FS_TYPE_ERROR, (gint*)&error_no);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
878 switch (error_no) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
879 case FS_ERROR_NO_CODECS:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
880 purple_media_error(priv->media, _("No codecs"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
881 " found. Install some"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
882 " GStreamer codecs found"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
883 " in GStreamer plugins"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
884 " packages."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
885 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
886 break;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
887 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
888 case FS_ERROR_NO_CODECS_LEFT:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
889 purple_media_error(priv->media, _("No codecs"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
890 " left. Your codec"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
891 " preferences in"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
892 " fs-codecs.conf are too"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
893 " strict."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
894 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
895 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
896 case FS_ERROR_UNKNOWN_CNAME:
32763
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
897 /*
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
898 * Unknown CName is only a problem for the
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
899 * multicast transmitter which isn't used.
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
900 * It is also deprecated.
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
901 */
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
902 break;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
903 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
904 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
905 purple_debug_error("backend-fs2",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
906 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
907 "farsight-error: %i: %s\n",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
908 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
909 "farstream-error: %i: %s\n",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
910 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
911 error_no,
32763
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
912 gst_structure_get_string(
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
913 msg->structure, "error-msg"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
914 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
915 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
916
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
917 if (FS_ERROR_IS_FATAL(error_no)) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
918 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
919 purple_media_error(priv->media, _("A non-recoverable "
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
920 "Farsight2 error has occurred."));
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
921 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
922 purple_media_error(priv->media, _("A non-recoverable "
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
923 "Farstream error has occurred."));
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
924 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
925 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
926 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
927 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
928 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
929 "farsight-new-local-candidate")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
930 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
931 "farstream-new-local-candidate")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
932 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
933 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
934 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
935 FsCandidate *local_candidate;
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
936 PurpleMediaCandidate *candidate;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
937 FsParticipant *participant;
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
938 PurpleMediaBackendFs2Session *session;
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
939 PurpleMediaBackendFs2Stream *media_stream;
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
940 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
941
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
942 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
943 stream = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
944 value = gst_structure_get_value(msg->structure, "candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
945 local_candidate = g_value_get_boxed(value);
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
946
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
947 session = get_session_from_fs_stream(self, stream);
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
948
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
949 purple_debug_info("backend-fs2",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
950 "got new local candidate: %s\n",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
951 local_candidate->foundation);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
952
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
953 g_object_get(stream, "participant", &participant, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
954 g_object_get(participant, "cname", &name, NULL);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
955 g_object_unref(participant);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
956
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
957 media_stream = get_stream(self, session->id, name);
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
958 media_stream->local_candidates = g_list_append(
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
959 media_stream->local_candidates,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
960 fs_candidate_copy(local_candidate));
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
961
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
962 candidate = candidate_from_fs(local_candidate);
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
963 g_signal_emit_by_name(self, "new-candidate",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
964 session->id, name, candidate);
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
965 g_object_unref(candidate);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
966 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
967 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
968 "farsight-local-candidates-prepared")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
969 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
970 "farstream-local-candidates-prepared")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
971 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
972 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
973 FsStream *stream;
29163
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
974 FsParticipant *participant;
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
975 PurpleMediaBackendFs2Session *session;
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
976 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
977
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
978 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
979 stream = g_value_get_object(value);
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
980 session = get_session_from_fs_stream(self, stream);
29163
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
981
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
982 g_object_get(stream, "participant", &participant, NULL);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
983 g_object_get(participant, "cname", &name, NULL);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
984 g_object_unref(participant);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
985
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
986 g_signal_emit_by_name(self, "candidates-prepared",
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29162
diff changeset
987 session->id, name);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
988 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
989 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
990 "farsight-new-active-candidate-pair")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
991 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
992 "farstream-new-active-candidate-pair")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
993 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
994 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
995 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
996 FsCandidate *local_candidate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
997 FsCandidate *remote_candidate;
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
998 FsParticipant *participant;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
999 PurpleMediaBackendFs2Session *session;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1000 PurpleMediaCandidate *lcandidate, *rcandidate;
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1001 gchar *name;
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1002
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1003 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1004 stream = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1005 value = gst_structure_get_value(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1006 "local-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1007 local_candidate = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1008 value = gst_structure_get_value(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1009 "remote-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1010 remote_candidate = g_value_get_boxed(value);
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1011
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1012 g_object_get(stream, "participant", &participant, NULL);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1013 g_object_get(participant, "cname", &name, NULL);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1014 g_object_unref(participant);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1015
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1016 session = get_session_from_fs_stream(self, stream);
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1017
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1018 lcandidate = candidate_from_fs(local_candidate);
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1019 rcandidate = candidate_from_fs(remote_candidate);
29162
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1020
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1021 g_signal_emit_by_name(self, "active-candidate-pair",
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1022 session->id, name, lcandidate, rcandidate);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1023
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1024 g_object_unref(lcandidate);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29161
diff changeset
1025 g_object_unref(rcandidate);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1026 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1027 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1028 "farsight-recv-codecs-changed")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1029 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1030 "farstream-recv-codecs-changed")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1031 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1032 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1033 GList *codecs;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1034 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1035
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1036 value = gst_structure_get_value(msg->structure, "codecs");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1037 codecs = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1038 codec = codecs->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1039
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1040 purple_debug_info("backend-fs2",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1041 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1042 "farsight-recv-codecs-changed: %s\n",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1043 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1044 "farstream-recv-codecs-changed: %s\n",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1045 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1046 codec->encoding_name);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1047 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1048 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1049 "farsight-component-state-changed")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1050 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1051 "farstream-component-state-changed")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1052 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1053 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1054 FsStreamState fsstate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1055 guint component;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1056 const gchar *state;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1057
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1058 value = gst_structure_get_value(msg->structure, "state");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1059 fsstate = g_value_get_enum(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1060 value = gst_structure_get_value(msg->structure, "component");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1061 component = g_value_get_uint(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1062
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1063 switch (fsstate) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1064 case FS_STREAM_STATE_FAILED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1065 state = "FAILED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1066 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1067 case FS_STREAM_STATE_DISCONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1068 state = "DISCONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1069 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1070 case FS_STREAM_STATE_GATHERING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1071 state = "GATHERING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1072 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1073 case FS_STREAM_STATE_CONNECTING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1074 state = "CONNECTING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1075 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1076 case FS_STREAM_STATE_CONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1077 state = "CONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1078 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1079 case FS_STREAM_STATE_READY:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1080 state = "READY";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1081 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1082 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1083 state = "UNKNOWN";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1084 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1085 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1086
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1087 purple_debug_info("backend-fs2",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1088 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1089 "farsight-component-state-changed: "
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1090 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1091 "farstream-component-state-changed: "
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1092 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1093 "component: %u state: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1094 component, state);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1095 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1096 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1097 "farsight-send-codec-changed")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1098 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1099 "farstream-send-codec-changed")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1100 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1101 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1102 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1103 gchar *codec_str;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1104
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1105 value = gst_structure_get_value(msg->structure, "codec");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1106 codec = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1107 codec_str = fs_codec_to_string(codec);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1108
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1109 purple_debug_info("backend-fs2",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1110 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1111 "farsight-send-codec-changed: codec: %s\n",
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1112 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1113 "farstream-send-codec-changed: codec: %s\n",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1114 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1115 codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1116
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1117 g_free(codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1118 } else if (gst_structure_has_name(msg->structure,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1119 #ifdef HAVE_FARSIGHT
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1120 "farsight-codecs-changed")) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1121 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1122 "farstream-codecs-changed")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1123 #endif
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1124 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1125 FsSession *fssession;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1126 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1127
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1128 value = gst_structure_get_value(msg->structure, "session");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1129 fssession = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1130 sessions = g_hash_table_get_values(priv->sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1131
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1132 for (; sessions; sessions =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1133 g_list_delete_link(sessions, sessions)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1134 PurpleMediaBackendFs2Session *session = sessions->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1135 gchar *session_id;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1136
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1137 if (session->session != fssession)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1138 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1139
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1140 session_id = g_strdup(session->id);
29161
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29160
diff changeset
1141 g_signal_emit_by_name(self, "codecs-changed",
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29160
diff changeset
1142 session_id);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1143 g_free(session_id);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1144 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1145 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1146 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1147 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1148 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1149
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1150 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1151 gst_handle_message_error(GstBus *bus, GstMessage *msg,
29160
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29159
diff changeset
1152 PurpleMediaBackendFs2 *self)
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1153 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1154 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1155 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1156 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1157 GstElement *lastElement = NULL;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1158 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1159
31601
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1160 GError *error = NULL;
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1161 gchar *debug_msg = NULL;
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1162
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1163 gst_message_parse_error(msg, &error, &debug_msg);
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1164 purple_debug_error("backend-fs2", "gst error %s\ndebugging: %s\n",
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1165 error->message, debug_msg);
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1166
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1167 g_error_free(error);
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1168 g_free(debug_msg);
0b73619ad581 media: Fix a NULL pointer deref crash, and add diagnostic logging.
Paul Aurich <paul@darkrain42.org>
parents: 31517
diff changeset
1169
31618
4ad7ff6bdc4e media/backend-fs2: Better fix for the NULL deref crash here.
Paul Aurich <paul@darkrain42.org>
parents: 31601
diff changeset
1170 while (element && !GST_IS_PIPELINE(element)) {
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1171 if (element == priv->confbin)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1172 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1173
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1174 lastElement = element;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1175 element = GST_ELEMENT_PARENT(element);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1176 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1177
31618
4ad7ff6bdc4e media/backend-fs2: Better fix for the NULL deref crash here.
Paul Aurich <paul@darkrain42.org>
parents: 31601
diff changeset
1178 if (!element || !GST_IS_PIPELINE(element))
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1179 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1180
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1181 sessions = purple_media_get_session_ids(priv->media);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1182
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1183 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1184 if (purple_media_get_src(priv->media, sessions->data)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1185 != lastElement)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1186 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1187
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1188 if (purple_media_get_session_type(priv->media, sessions->data)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1189 & PURPLE_MEDIA_AUDIO)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1190 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1191 _("Error with your microphone"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1192 else
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1193 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1194 _("Error with your webcam"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1195
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1196 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1197 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1198
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1199 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1200
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1201 purple_media_error(priv->media, _("Conference error"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1202 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1203 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1204
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1205 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1206 gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackendFs2 *self)
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1207 {
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1208 switch(GST_MESSAGE_TYPE(msg)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1209 case GST_MESSAGE_ELEMENT:
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1210 gst_handle_message_element(bus, msg, self);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1211 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1212 case GST_MESSAGE_ERROR:
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1213 gst_handle_message_error(bus, msg, self);
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1214 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1215 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1216 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1217 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
1218
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1219 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1220 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1221
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1222 static void
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1223 remove_element(GstElement *element)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1224 {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1225 if (element) {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1226 gst_element_set_locked_state(element, TRUE);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1227 gst_element_set_state(element, GST_STATE_NULL);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1228 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(element)), element);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1229 }
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1230 }
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1231
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1232 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1233 state_changed_cb(PurpleMedia *media, PurpleMediaState state,
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1234 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1235 {
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1236 if (state == PURPLE_MEDIA_STATE_END) {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1237 PurpleMediaBackendFs2Private *priv =
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1238 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1239
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1240 if (sid && name) {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1241 PurpleMediaBackendFs2Stream *stream = get_stream(self, sid, name);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1242 gst_object_unref(stream->stream);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1243
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1244 priv->streams = g_list_remove(priv->streams, stream);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1245
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1246 remove_element(stream->src);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1247 remove_element(stream->tee);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1248 remove_element(stream->volume);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1249 remove_element(stream->level);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1250 remove_element(stream->fakesink);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1251 remove_element(stream->queue);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1252
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1253 free_stream(stream);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1254 } else if (sid && !name) {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1255 PurpleMediaBackendFs2Session *session = get_session(self, sid);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1256 GstPad *pad;
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1257
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1258 g_object_get(session->session, "sink-pad", &pad, NULL);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1259 gst_pad_unlink(GST_PAD_PEER(pad), pad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1260 gst_object_unref(pad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1261
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1262 gst_object_unref(session->session);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1263 g_hash_table_remove(priv->sessions, session->id);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1264
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1265 pad = gst_pad_get_peer(session->srcpad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1266 gst_element_remove_pad(GST_ELEMENT_PARENT(pad), pad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1267 gst_object_unref(pad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1268 gst_object_unref(session->srcpad);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1269
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1270 remove_element(session->srcvalve);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1271 remove_element(session->tee);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1272
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1273 free_session(session);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1274 }
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1275
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1276 purple_media_manager_remove_output_windows(
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1277 purple_media_get_manager(media), media, sid, name);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1278 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1279 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1280
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1281 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1282 stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1283 gchar *sid, gchar *name, gboolean local,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1284 PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1285 {
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1286 if (type == PURPLE_MEDIA_INFO_ACCEPT && sid != NULL && name != NULL) {
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1287 PurpleMediaBackendFs2Stream *stream =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1288 get_stream(self, sid, name);
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1289 GError *err = NULL;
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1290
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1291 g_object_set(G_OBJECT(stream->stream), "direction",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1292 session_type_to_fs_stream_direction(
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1293 stream->session->type), NULL);
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1294
29239
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
1295 if (stream->remote_candidates == NULL ||
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
1296 purple_media_is_initiator(media, sid, name))
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1297 return;
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1298
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1299 #ifdef HAVE_FARSIGHT
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1300 fs_stream_set_remote_candidates(stream->stream,
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1301 stream->remote_candidates, &err);
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1302 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1303 if (stream->supports_add)
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1304 fs_stream_add_remote_candidates(stream->stream,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1305 stream->remote_candidates, &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1306 else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1307 fs_stream_force_remote_candidates(stream->stream,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1308 stream->remote_candidates, &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1309 #endif
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1310
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1311 if (err == NULL)
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1312 return;
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1313
29209
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1314 purple_debug_error("backend-fs2", "Error adding "
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1315 "remote candidates: %s\n",
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1316 err->message);
d510b0324721 Handle individual streams in the Fs2 backend's stream-info callback for accept
maiku@pidgin.im
parents: 29208
diff changeset
1317 g_error_free(err);
29193
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1318 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1319 type == PURPLE_MEDIA_INFO_UNMUTE)) {
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1320 PurpleMediaBackendFs2Private *priv =
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1321 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1322 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1323 GList *sessions;
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1324
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1325 if (sid == NULL)
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1326 sessions = g_hash_table_get_values(priv->sessions);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1327 else
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1328 sessions = g_list_prepend(NULL,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1329 get_session(self, sid));
29193
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1330
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1331 purple_debug_info("media", "Turning mute %s\n",
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1332 active ? "on" : "off");
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1333
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1334 for (; sessions; sessions = g_list_delete_link(
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1335 sessions, sessions)) {
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1336 PurpleMediaBackendFs2Session *session =
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1337 sessions->data;
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1338
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1339 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1340 gchar *name = g_strdup_printf("volume_%s",
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1341 session->id);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1342 GstElement *volume = gst_bin_get_by_name(
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1343 GST_BIN(priv->confbin), name);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1344 g_free(name);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1345 g_object_set(volume, "mute", active, NULL);
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1346 }
bd6279df50de Move mute functionality into the Fs2 media backend.
maiku@pidgin.im
parents: 29191
diff changeset
1347 }
31075
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1348 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD ||
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1349 type == PURPLE_MEDIA_INFO_UNHOLD)) {
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1350 gboolean active = (type == PURPLE_MEDIA_INFO_HOLD);
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1351 GList *streams = get_streams(self, sid, name);
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1352 for (; streams; streams =
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1353 g_list_delete_link(streams, streams)) {
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1354 PurpleMediaBackendFs2Stream *stream = streams->data;
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1355 if (stream->session->type & PURPLE_MEDIA_SEND_AUDIO) {
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1356 g_object_set(stream->stream, "direction",
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1357 session_type_to_fs_stream_direction(
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1358 stream->session->type & ((active) ?
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1359 ~PURPLE_MEDIA_SEND_AUDIO :
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1360 PURPLE_MEDIA_AUDIO)), NULL);
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1361 }
a202f4dcbb96 Stop sending audio when placing a call on hold. Fixes #13032.
jakub.adam@ktknet.cz
parents: 30528
diff changeset
1362 }
29184
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1363 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE ||
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1364 type == PURPLE_MEDIA_INFO_UNPAUSE)) {
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1365 gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE);
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1366 GList *streams = get_streams(self, sid, name);
29184
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1367 for (; streams; streams =
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1368 g_list_delete_link(streams, streams)) {
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1369 PurpleMediaBackendFs2Stream *stream = streams->data;
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1370 if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) {
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1371 g_object_set(stream->stream, "direction",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1372 session_type_to_fs_stream_direction(
29184
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1373 stream->session->type & ((active) ?
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1374 ~PURPLE_MEDIA_SEND_VIDEO :
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1375 PURPLE_MEDIA_VIDEO)), NULL);
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1376 }
dfc724880907 Move pause functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29183
diff changeset
1377 }
29182
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29181
diff changeset
1378 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1379 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1380
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1381 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1382 init_conference(PurpleMediaBackendFs2 *self)
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1383 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1384 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1385 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1386 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1387 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1388 gchar *name;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1389 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1390 GKeyFile *default_props;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1391 #endif
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1392
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1393 priv->conference = FS_CONFERENCE(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1394 gst_element_factory_make(priv->conference_type, NULL));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1395
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1396 if (priv->conference == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1397 purple_debug_error("backend-fs2", "Conference == NULL\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1398 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1399 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1400
31375
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1401 if (purple_account_get_silence_suppression(
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1402 purple_media_get_account(priv->media)))
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1403 priv->silence_threshold = purple_prefs_get_int(
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1404 "/purple/media/audio/silence_threshold") / 100.0;
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1405 else
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1406 priv->silence_threshold = 0;
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31356
diff changeset
1407
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1408 pipeline = purple_media_manager_get_pipeline(
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
1409 purple_media_get_manager(priv->media));
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1410
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1411 if (pipeline == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1412 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1413 "Couldn't retrieve pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1414 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1415 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1416
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1417 name = g_strdup_printf("conf_%p", priv->conference);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1418 priv->confbin = gst_bin_new(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1419 if (priv->confbin == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1420 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1421 "Couldn't create confbin.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1422 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1423 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1424
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1425 g_free(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1426
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1427 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1428 if (bus == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1429 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1430 "Couldn't get the pipeline's bus.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1431 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1432 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1433
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1434 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1435 default_props = fs_utils_get_default_element_properties(GST_ELEMENT(priv->conference));
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1436 if (default_props != NULL) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1437 priv->notifier = fs_element_added_notifier_new();
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1438 fs_element_added_notifier_add(priv->notifier,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1439 GST_BIN(priv->confbin));
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1440 fs_element_added_notifier_set_properties_from_keyfile(priv->notifier, default_props);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1441 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1442 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1443
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1444 g_signal_connect(G_OBJECT(bus), "message",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1445 G_CALLBACK(gst_bus_cb), self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1446 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1447
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1448 if (!gst_bin_add(GST_BIN(pipeline),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1449 GST_ELEMENT(priv->confbin))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1450 purple_debug_error("backend-fs2", "Couldn't add confbin "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1451 "element to the pipeline\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1452 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1453 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1454
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1455 if (!gst_bin_add(GST_BIN(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1456 GST_ELEMENT(priv->conference))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1457 purple_debug_error("backend-fs2", "Couldn't add conference "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1458 "element to the confbin\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1459 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1460 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1461
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1462 if (gst_element_set_state(GST_ELEMENT(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1463 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1464 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1465 "Failed to start conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1466 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1467 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1468
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1469 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1470 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1471
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1472 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1473 gst_element_added_cb(FsElementAddedNotifier *self,
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1474 GstBin *bin, GstElement *element, gpointer user_data)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1475 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1476 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1477 * Hack to make H264 work with Gmail video.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1478 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1479 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1480 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1481 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1482 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1483
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1484 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1485 create_src(PurpleMediaBackendFs2 *self, const gchar *sess_id,
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1486 PurpleMediaSessionType type)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1487 {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1488 PurpleMediaBackendFs2Private *priv =
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1489 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1490 PurpleMediaBackendFs2Session *session;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1491 PurpleMediaSessionType session_type;
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1492 FsMediaType media_type = session_type_to_fs_media_type(type);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1493 FsStreamDirection type_direction =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1494 session_type_to_fs_stream_direction(type);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1495 GstElement *src;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1496 GstPad *sinkpad, *srcpad;
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
1497 GstPad *ghost = NULL;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1498
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1499 if ((type_direction & FS_DIRECTION_SEND) == 0)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1500 return TRUE;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1501
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1502 session_type = session_type_from_fs(
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1503 media_type, FS_DIRECTION_SEND);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1504 src = purple_media_manager_get_element(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1505 purple_media_get_manager(priv->media),
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1506 session_type, priv->media, sess_id, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1507
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1508 if (!GST_IS_ELEMENT(src)) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1509 purple_debug_error("backend-fs2",
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1510 "Error creating src for session %s\n",
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1511 sess_id);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1512 return FALSE;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1513 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1514
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1515 session = get_session(self, sess_id);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1516
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1517 if (session == NULL) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1518 purple_debug_warning("backend-fs2",
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1519 "purple_media_set_src: trying to set"
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1520 " src on non-existent session\n");
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1521 return FALSE;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1522 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1523
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1524 if (session->src)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1525 gst_object_unref(session->src);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1526
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1527 session->src = src;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1528 gst_element_set_locked_state(session->src, TRUE);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1529
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1530 session->tee = gst_element_factory_make("tee", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1531 gst_bin_add(GST_BIN(priv->confbin), session->tee);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1532
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1533 /* This supposedly isn't necessary, but it silences some warnings */
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1534 if (GST_ELEMENT_PARENT(priv->confbin)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1535 == GST_ELEMENT_PARENT(session->src)) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1536 GstPad *pad = gst_element_get_static_pad(session->tee, "sink");
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
1537 ghost = gst_ghost_pad_new(NULL, pad);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1538 gst_object_unref(pad);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1539 gst_pad_set_active(ghost, TRUE);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1540 gst_element_add_pad(priv->confbin, ghost);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1541 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1542
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1543 gst_element_set_state(session->tee, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1544 gst_element_link(session->src, priv->confbin);
31105
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
1545 if (ghost)
0485aed45f5b This patch fixes #12758.
jakub.adam@ktknet.cz
parents: 31086
diff changeset
1546 session->srcpad = gst_pad_get_peer(ghost);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1547
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1548 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1549 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1550 gchar *name = g_strdup_printf("volume_%s", session->id);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1551 GstElement *level;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1552 GstElement *volume = gst_element_factory_make("volume", name);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1553 double input_volume = purple_prefs_get_int(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1554 "/purple/media/audio/volume/input")/10.0;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1555 g_free(name);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1556 name = g_strdup_printf("sendlevel_%s", session->id);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1557 level = gst_element_factory_make("level", name);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1558 g_free(name);
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
1559 session->srcvalve = gst_element_factory_make("valve", NULL);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1560 gst_bin_add(GST_BIN(priv->confbin), volume);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1561 gst_bin_add(GST_BIN(priv->confbin), level);
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
1562 gst_bin_add(GST_BIN(priv->confbin), session->srcvalve);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1563 gst_element_set_state(level, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1564 gst_element_set_state(volume, GST_STATE_PLAYING);
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
1565 gst_element_set_state(session->srcvalve, GST_STATE_PLAYING);
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
1566 gst_element_link(level, session->srcvalve);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1567 gst_element_link(volume, level);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1568 gst_element_link(session->tee, volume);
31356
017b7ff5a894 During a voice call, Pidgin now sends constant audio traffic, even when there
jakub.adam@ktknet.cz
parents: 31152
diff changeset
1569 srcpad = gst_element_get_static_pad(session->srcvalve, "src");
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1570 g_object_set(volume, "volume", input_volume, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1571 } else {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1572 srcpad = gst_element_get_request_pad(session->tee, "src%d");
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1573 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1574
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1575 purple_debug_info("backend-fs2", "connecting pad: %s\n",
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1576 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1577 ? "success" : "failure");
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1578 gst_element_set_locked_state(session->src, FALSE);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1579 gst_object_unref(session->src);
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1580 gst_object_unref(sinkpad);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1581
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1582 gst_element_set_state(session->src, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1583
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1584 purple_media_manager_create_output_window(purple_media_get_manager(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1585 priv->media), priv->media, sess_id, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1586
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1587 return TRUE;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1588 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1589
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1590 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1591 create_session(PurpleMediaBackendFs2 *self, const gchar *sess_id,
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1592 PurpleMediaSessionType type, gboolean initiator,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1593 const gchar *transmitter)
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1594 {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1595 PurpleMediaBackendFs2Private *priv =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1596 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1597 PurpleMediaBackendFs2Session *session;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1598 GError *err = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1599 GList *codec_conf = NULL, *iter = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1600 gchar *filename = NULL;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1601 gboolean is_nice = !strcmp(transmitter, "nice");
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1602
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1603 session = g_new0(PurpleMediaBackendFs2Session, 1);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1604
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1605 session->session = fs_conference_new_session(priv->conference,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1606 session_type_to_fs_media_type(type), &err);
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1607
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1608 if (err != NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1609 purple_media_error(priv->media,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1610 _("Error creating session: %s"),
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1611 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1612 g_error_free(err);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1613 g_free(session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1614 return FALSE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1615 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1616
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1617 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1618 codec_conf = fs_codec_list_from_keyfile(filename, &err);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1619 g_free(filename);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1620
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1621 if (err != NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1622 if (err->code == 4)
29170
7b0931b3e060 Correct some debug categories.
maiku@pidgin.im
parents: 29169
diff changeset
1623 purple_debug_info("backend-fs2", "Couldn't read "
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1624 "fs-codec.conf: %s\n",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1625 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1626 else
29170
7b0931b3e060 Correct some debug categories.
maiku@pidgin.im
parents: 29169
diff changeset
1627 purple_debug_error("backend-fs2", "Error reading "
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1628 "fs-codec.conf: %s\n",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1629 err->message);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1630 g_error_free(err);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1631 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1632
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1633 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1634 * Add SPEEX if the configuration file doesn't exist or
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1635 * there isn't a speex entry.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1636 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1637 for (iter = codec_conf; iter; iter = g_list_next(iter)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1638 FsCodec *codec = iter->data;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1639 if (!g_ascii_strcasecmp(codec->encoding_name, "speex"))
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1640 break;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1641 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1642
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1643 if (iter == NULL) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1644 codec_conf = g_list_prepend(codec_conf,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1645 fs_codec_new(FS_CODEC_ID_ANY,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1646 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1647 codec_conf = g_list_prepend(codec_conf,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1648 fs_codec_new(FS_CODEC_ID_ANY,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1649 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1650 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1651
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1652 fs_session_set_codec_preferences(session->session, codec_conf, NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1653 fs_codec_list_destroy(codec_conf);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1654
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1655 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1656 * Removes a 5-7 second delay before
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1657 * receiving the src-pad-added signal.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1658 * Only works for non-multicast FsRtpSessions.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1659 */
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1660 #ifdef HAVE_FARSIGHT
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1661 if (is_nice || !strcmp(transmitter, "rawudp"))
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1662 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1663 if (!!strcmp(transmitter, "multicast"))
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1664 #endif
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1665 g_object_set(G_OBJECT(session->session),
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1666 "no-rtcp-timeout", 0, NULL);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1667
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1668 /*
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1669 * Hack to make x264 work with Gmail video.
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1670 */
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1671 if (is_nice && !strcmp(sess_id, "google-video")) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1672 FsElementAddedNotifier *notifier =
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1673 fs_element_added_notifier_new();
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1674 g_signal_connect(G_OBJECT(notifier), "element-added",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1675 G_CALLBACK(gst_element_added_cb), NULL);
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1676 fs_element_added_notifier_add(notifier,
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1677 GST_BIN(priv->conference));
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1678 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1679
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1680 session->id = g_strdup(sess_id);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1681 session->backend = self;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1682 session->type = type;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1683
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1684 if (!priv->sessions) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1685 purple_debug_info("backend-fs2",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1686 "Creating hash table for sessions\n");
30439
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 30430
diff changeset
1687 priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal,
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 30430
diff changeset
1688 g_free, NULL);
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1689 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1690
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1691 g_hash_table_insert(priv->sessions, g_strdup(session->id), session);
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1692
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1693 if (!create_src(self, sess_id, type)) {
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1694 purple_debug_info("backend-fs2", "Error creating the src\n");
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1695 return FALSE;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1696 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1697
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1698 return TRUE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1699 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
1700
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1701 static void
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1702 free_session(PurpleMediaBackendFs2Session *session)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1703 {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1704 g_free(session->id);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1705 g_free(session);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1706 }
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1707
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
1708 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1709 create_participant(PurpleMediaBackendFs2 *self, const gchar *name)
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1710 {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1711 PurpleMediaBackendFs2Private *priv =
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1712 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1713 FsParticipant *participant;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1714 GError *err = NULL;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1715
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1716 participant = fs_conference_new_participant(
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1717 #ifdef HAVE_FARSIGHT
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1718 priv->conference, name, &err);
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1719 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1720 priv->conference, &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1721 #endif
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1722
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1723 if (err) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1724 purple_debug_error("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1725 "Error creating participant: %s\n",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1726 err->message);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1727 g_error_free(err);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1728 return FALSE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1729 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1730
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1731 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1732 if (g_object_class_find_property(G_OBJECT_GET_CLASS(participant),
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1733 "cname")) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1734 g_object_set(participant, "cname", name, NULL);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1735 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1736 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1737
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1738 if (!priv->participants) {
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1739 purple_debug_info("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1740 "Creating hash table for participants\n");
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1741 priv->participants = g_hash_table_new_full(g_str_hash,
30439
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 30430
diff changeset
1742 g_str_equal, g_free, g_object_unref);
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1743 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1744
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1745 g_hash_table_insert(priv->participants, g_strdup(name), participant);
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1746
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1747 return TRUE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1748 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1749
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
1750 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1751 src_pad_added_cb_cb(PurpleMediaBackendFs2Stream *stream)
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1752 {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1753 PurpleMediaBackendFs2Private *priv;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1754
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1755 g_return_val_if_fail(stream != NULL, FALSE);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1756
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1757 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1758 stream->connected_cb_id = 0;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1759
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1760 purple_media_manager_create_output_window(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1761 purple_media_get_manager(priv->media), priv->media,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1762 stream->session->id, stream->participant);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1763
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1764 g_signal_emit_by_name(priv->media, "state-changed",
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1765 PURPLE_MEDIA_STATE_CONNECTED,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1766 stream->session->id, stream->participant);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1767 return FALSE;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1768 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1769
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1770 static void
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1771 src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1772 FsCodec *codec, PurpleMediaBackendFs2Stream *stream)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1773 {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1774 PurpleMediaBackendFs2Private *priv;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1775 GstPad *sinkpad;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1776
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1777 g_return_if_fail(FS_IS_STREAM(fsstream));
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1778 g_return_if_fail(stream != NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1779
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1780 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(stream->session->backend);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1781
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1782 if (stream->src == NULL) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1783 GstElement *sink = NULL;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1784
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1785 if (codec->media_type == FS_MEDIA_TYPE_AUDIO) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1786 double output_volume = purple_prefs_get_int(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1787 "/purple/media/audio/volume/output")/10.0;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1788 /*
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1789 * Should this instead be:
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1790 * audioconvert ! audioresample ! liveadder !
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1791 * audioresample ! audioconvert ! realsink
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1792 */
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1793 stream->queue = gst_element_factory_make("queue", NULL);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1794 stream->volume = gst_element_factory_make(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1795 "volume", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1796 g_object_set(stream->volume, "volume",
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1797 output_volume, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1798 stream->level = gst_element_factory_make(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1799 "level", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1800 stream->src = gst_element_factory_make(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1801 "liveadder", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1802 sink = purple_media_manager_get_element(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1803 purple_media_get_manager(priv->media),
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1804 PURPLE_MEDIA_RECV_AUDIO, priv->media,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1805 stream->session->id,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1806 stream->participant);
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1807 gst_bin_add(GST_BIN(priv->confbin), stream->queue);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1808 gst_bin_add(GST_BIN(priv->confbin), stream->volume);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1809 gst_bin_add(GST_BIN(priv->confbin), stream->level);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1810 gst_bin_add(GST_BIN(priv->confbin), sink);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1811 gst_element_set_state(sink, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1812 gst_element_set_state(stream->level, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1813 gst_element_set_state(stream->volume, GST_STATE_PLAYING);
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1814 gst_element_set_state(stream->queue, GST_STATE_PLAYING);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1815 gst_element_link(stream->level, sink);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1816 gst_element_link(stream->volume, stream->level);
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1817 gst_element_link(stream->queue, stream->volume);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1818 sink = stream->queue;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1819 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1820 stream->src = gst_element_factory_make(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1821 "fsfunnel", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1822 sink = gst_element_factory_make(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1823 "fakesink", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1824 g_object_set(G_OBJECT(sink), "async", FALSE, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1825 gst_bin_add(GST_BIN(priv->confbin), sink);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1826 gst_element_set_state(sink, GST_STATE_PLAYING);
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
1827 stream->fakesink = sink;
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1828 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1829 stream->tee = gst_element_factory_make("tee", NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1830 gst_bin_add_many(GST_BIN(priv->confbin),
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1831 stream->src, stream->tee, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1832 gst_element_set_state(stream->tee, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1833 gst_element_set_state(stream->src, GST_STATE_PLAYING);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1834 gst_element_link_many(stream->src, stream->tee, sink, NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1835 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1836
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1837 sinkpad = gst_element_get_request_pad(stream->src, "sink%d");
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1838 gst_pad_link(srcpad, sinkpad);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1839 gst_object_unref(sinkpad);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1840
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1841 stream->connected_cb_id = purple_timeout_add(0,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1842 (GSourceFunc)src_pad_added_cb_cb, stream);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1843 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1844
30442
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1845 static GValueArray *
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1846 append_relay_info(GValueArray *relay_info, const gchar *ip, gint port,
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1847 const gchar *username, const gchar *password, const gchar *type)
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1848 {
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1849 GValue value;
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1850 GstStructure *turn_setup = gst_structure_new("relay-info",
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1851 "ip", G_TYPE_STRING, ip,
30442
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1852 "port", G_TYPE_UINT, port,
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1853 "username", G_TYPE_STRING, username,
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1854 "password", G_TYPE_STRING, password,
32763
88587257d083 Whitespace normalization
Richard Laager <rlaager@wiktel.com>
parents: 31654
diff changeset
1855 "relay-type", G_TYPE_STRING, type,
30442
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1856 NULL);
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1857
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1858 if (turn_setup) {
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1859 memset(&value, 0, sizeof(GValue));
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1860 g_value_init(&value, GST_TYPE_STRUCTURE);
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1861 gst_value_set_structure(&value, turn_setup);
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1862 relay_info = g_value_array_append(relay_info, &value);
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1863 gst_structure_free(turn_setup);
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1864 }
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1865
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1866 return relay_info;
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1867 }
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1868
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
1869 static gboolean
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1870 create_stream(PurpleMediaBackendFs2 *self,
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1871 const gchar *sess_id, const gchar *who,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1872 PurpleMediaSessionType type, gboolean initiator,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1873 const gchar *transmitter,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1874 guint num_params, GParameter *params)
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1875 {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1876 PurpleMediaBackendFs2Private *priv =
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1877 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1878 GError *err = NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1879 FsStream *fsstream = NULL;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1880 const gchar *stun_ip = purple_network_get_stun_ip();
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1881 const gchar *turn_ip = purple_network_get_turn_ip();
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1882 guint _num_params = num_params;
32764
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1883 GParameter *_params;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1884 FsStreamDirection type_direction =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
1885 session_type_to_fs_stream_direction(type);
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1886 PurpleMediaBackendFs2Session *session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1887 PurpleMediaBackendFs2Stream *stream;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1888 FsParticipant *participant;
30525
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1889 /* check if the prpl has already specified a relay-info
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1890 we need to do this to allow them to override when using non-standard
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1891 TURN modes, like Google f.ex. */
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1892 gboolean got_turn_from_prpl = FALSE;
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1893 int i;
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1894
32764
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1895 session = get_session(self, sess_id);
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1896
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1897 if (session == NULL) {
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1898 purple_debug_error("backend-fs2",
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1899 "Couldn't find session to create stream.\n");
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1900 return FALSE;
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1901 }
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1902
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1903 participant = get_participant(self, who);
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1904
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1905 if (participant == NULL) {
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1906 purple_debug_error("backend-fs2", "Couldn't find "
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1907 "participant to create stream.\n");
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1908 return FALSE;
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1909 }
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1910
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1911 #ifndef HAVE_FARSIGHT
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1912 fsstream = fs_session_new_stream(session->session, participant,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1913 initiator == TRUE ? type_direction :
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1914 (type_direction & FS_DIRECTION_RECV), &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1915
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1916 if (fsstream == NULL) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1917 if (err) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1918 purple_debug_error("backend-fs2",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1919 "Error creating stream: %s\n",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1920 err && err->message ?
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1921 err->message : "NULL");
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1922 g_error_free(err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1923 } else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1924 purple_debug_error("backend-fs2",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1925 "Error creating stream\n");
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1926 return FALSE;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1927 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1928 #endif
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1929
30525
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1930 for (i = 0 ; i < num_params ; i++) {
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1931 if (purple_strequal(params[i].name, "relay-info")) {
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1932 got_turn_from_prpl = TRUE;
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1933 break;
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1934 }
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1935 }
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1936
32764
cde7e464221b Reorder create_stream()
Richard Laager <rlaager@wiktel.com>
parents: 32763
diff changeset
1937 _params = g_new0(GParameter, num_params + 3);
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1938 memcpy(_params, params, sizeof(GParameter) * num_params);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1939
29350
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1940 /* set the controlling mode parameter */
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1941 _params[_num_params].name = "controlling-mode";
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1942 g_value_init(&_params[_num_params].value, G_TYPE_BOOLEAN);
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1943 g_value_set_boolean(&_params[_num_params].value, initiator);
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1944 ++_num_params;
1876a447db11 media: "Backport" the ICE controlling-mode fix in the new media subdirectory
Marcus Lundblad <ml@update.uu.se>
parents: 29325
diff changeset
1945
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1946 if (stun_ip) {
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1947 purple_debug_info("backend-fs2",
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1948 "Setting stun-ip on new stream: %s\n", stun_ip);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1949
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1950 _params[_num_params].name = "stun-ip";
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1951 g_value_init(&_params[_num_params].value, G_TYPE_STRING);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1952 g_value_set_string(&_params[_num_params].value, stun_ip);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1953 ++_num_params;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1954 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1955
30525
3d08b59ebf59 Make the check for PRPL-supplied TURN parameters in the new place
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1956 if (turn_ip && !strcmp("nice", transmitter) && !got_turn_from_prpl) {
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1957 GValueArray *relay_info = g_value_array_new(0);
30442
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1958 gint port;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1959 const gchar *username = purple_prefs_get_string(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1960 "/purple/network/turn_username");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1961 const gchar *password = purple_prefs_get_string(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1962 "/purple/network/turn_password");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1963
30442
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1964 /* UDP */
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1965 port = purple_prefs_get_int("/purple/network/turn_port");
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1966 if (port > 0) {
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1967 relay_info = append_relay_info(relay_info, turn_ip, port, username,
603638fad2f1 Added ability to relay over TCP and TLS for TURN for media.
Marcus Lundblad <ml@update.uu.se>
parents: 30174
diff changeset
1968 password, "udp");
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1969 }
31625
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1970
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1971 /* TCP */
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1972 port = purple_prefs_get_int("/purple/network/turn_port_tcp");
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1973 if (port > 0) {
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1974 relay_info = append_relay_info(relay_info, turn_ip, port, username,
31654
a15e0b0e5b6c Actually set the relay info for TCP
Marcus Lundblad <ml@update.uu.se>
parents: 31625
diff changeset
1975 password, "tcp");
31625
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1976 }
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1977
31625
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1978 /* TURN over SSL is only supported by libnice for Google's "psuedo" SSL mode
8b434ffd4efc Add support for using TCP relaying with TURN
Marcus Lundblad <ml@update.uu.se>
parents: 31618
diff changeset
1979 at this time */
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1980
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1981 purple_debug_info("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1982 "Setting relay-info on new stream\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1983 _params[_num_params].name = "relay-info";
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31075
diff changeset
1984 g_value_init(&_params[_num_params].value,
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1985 G_TYPE_VALUE_ARRAY);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1986 g_value_set_boxed(&_params[_num_params].value,
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1987 relay_info);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1988 g_value_array_free(relay_info);
30174
8cb39e235f39 media: Fix the TURN server setting to actually work again (it was apparently
Marcus Lundblad <ml@update.uu.se>
parents: 29394
diff changeset
1989 _num_params++;
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1990 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1991
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
1992 #ifdef HAVE_FARSIGHT
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1993 fsstream = fs_session_new_stream(session->session, participant,
29239
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
1994 initiator == TRUE ? type_direction :
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
1995 (type_direction & FS_DIRECTION_RECV), transmitter,
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1996 _num_params, _params, &err);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1997 g_free(_params);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1998
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
1999 if (fsstream == NULL) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2000 if (err) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2001 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2002 "Error creating stream: %s\n",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2003 err && err->message ?
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2004 err->message : "NULL");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2005 g_error_free(err);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2006 } else
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2007 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2008 "Error creating stream\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2009 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2010 }
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2011 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2012 if (!fs_stream_set_transmitter(fsstream, transmitter,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2013 _params, _num_params, &err)) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2014 purple_debug_error("backend-fs2",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2015 "Could not set transmitter %s: %s.\n",
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2016 transmitter, err->message);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2017 g_clear_error(&err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2018 g_free(_params);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2019 return FALSE;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2020 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2021 g_free(_params);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2022 #endif
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2023
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2024 stream = g_new0(PurpleMediaBackendFs2Stream, 1);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2025 stream->participant = g_strdup(who);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2026 stream->session = session;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2027 stream->stream = fsstream;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2028 #ifndef HAVE_FARSTREAM
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2029 stream->supports_add = !strcmp(transmitter, "nice");
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2030 #endif
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2031
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2032 priv->streams = g_list_append(priv->streams, stream);
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2033
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2034 g_signal_connect(G_OBJECT(fsstream), "src-pad-added",
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2035 G_CALLBACK(src_pad_added_cb), stream);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2036
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2037 return TRUE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2038 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2039
31419
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2040 static void
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2041 free_stream(PurpleMediaBackendFs2Stream *stream)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2042 {
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2043 /* Remove the connected_cb timeout */
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2044 if (stream->connected_cb_id != 0)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2045 purple_timeout_remove(stream->connected_cb_id);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2046
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2047 g_free(stream->participant);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2048
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2049 if (stream->local_candidates)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2050 fs_candidate_list_destroy(stream->local_candidates);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2051
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2052 if (stream->remote_candidates)
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2053 fs_candidate_list_destroy(stream->remote_candidates);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2054
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2055 g_free(stream);
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2056 }
3fb443b6460c Allow adding or removing media sessions (voice or video) on-the-fly. This
jakub.adam@ktknet.cz
parents: 31375
diff changeset
2057
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2058 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2059 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2060 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2061 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2062 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2063 guint num_params, GParameter *params)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2064 {
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2065 PurpleMediaBackendFs2 *backend = PURPLE_MEDIA_BACKEND_FS2(self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2066 PurpleMediaBackendFs2Private *priv =
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2067 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(backend);
29185
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2068 PurpleMediaBackendFs2Stream *stream;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2069
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2070 if (priv->conference == NULL && !init_conference(backend)) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2071 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2072 "Error initializing the conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2073 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2074 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2075
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2076 if (get_session(backend, sess_id) == NULL &&
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2077 !create_session(backend, sess_id, type,
29159
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2078 initiator, transmitter)) {
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2079 purple_debug_error("backend-fs2",
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2080 "Error creating the session.\n");
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2081 return FALSE;
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2082 }
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29158
diff changeset
2083
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2084 if (get_participant(backend, who) == NULL &&
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2085 !create_participant(backend, who)) {
29169
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
2086 purple_debug_error("backend-fs2",
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
2087 "Error creating the participant.\n");
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
2088 return FALSE;
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
2089 }
98a1b62a0f7e Add participant creation and destruction to the Fs2 media backend.
maiku@pidgin.im
parents: 29163
diff changeset
2090
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2091 stream = get_stream(backend, sess_id, who);
29185
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2092
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2093 if (stream != NULL) {
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2094 FsStreamDirection type_direction =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2095 session_type_to_fs_stream_direction(type);
29185
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2096
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2097 if (session_type_to_fs_stream_direction(
29185
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2098 stream->session->type) != type_direction) {
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2099 /* change direction */
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2100 g_object_set(stream->stream, "direction",
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2101 type_direction, NULL);
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29184
diff changeset
2102 }
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2103 } else if (!create_stream(backend, sess_id, who, type,
29172
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2104 initiator, transmitter, num_params, params)) {
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2105 purple_debug_error("backend-fs2",
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2106 "Error creating the stream.\n");
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2107 return FALSE;
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2108 }
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29170
diff changeset
2109
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
2110 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2111 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2112
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2113 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2114 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2115 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2116 GList *remote_candidates)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2117 {
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2118 PurpleMediaBackendFs2Private *priv;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2119 PurpleMediaBackendFs2Stream *stream;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2120 GError *err = NULL;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2121
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2122 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2123
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2124 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2125 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2126 sess_id, participant);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2127
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2128 if (stream == NULL) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2129 purple_debug_error("backend-fs2",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2130 "purple_media_add_remote_candidates: "
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2131 "couldn't find stream %s %s.\n",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2132 sess_id ? sess_id : "(null)",
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2133 participant ? participant : "(null)");
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2134 return;
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2135 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2136
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2137 stream->remote_candidates = g_list_concat(stream->remote_candidates,
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2138 candidate_list_to_fs(remote_candidates));
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2139
29239
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
2140 if (purple_media_is_initiator(priv->media, sess_id, participant) ||
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
2141 purple_media_accepted(
9da83d5f48c3 Allow connection checks before acceptance. Fixes Empathy<->Pidgin.
maiku@pidgin.im
parents: 29213
diff changeset
2142 priv->media, sess_id, participant)) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2143 #ifdef HAVE_FARSIGHT
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2144 fs_stream_set_remote_candidates(stream->stream,
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2145 stream->remote_candidates, &err);
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2146 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2147 if (stream->supports_add)
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2148 fs_stream_add_remote_candidates(stream->stream,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2149 stream->remote_candidates, &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2150 else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2151 fs_stream_force_remote_candidates(stream->stream,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2152 stream->remote_candidates, &err);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2153 #endif
29173
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2154
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2155 if (err) {
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2156 purple_debug_error("backend-fs2", "Error adding remote"
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2157 " candidates: %s\n", err->message);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2158 g_error_free(err);
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2159 }
983af0970bb2 Transfer setting Farsight 2's remote candidates to the Fs2 media backend.
maiku@pidgin.im
parents: 29172
diff changeset
2160 }
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2161 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2162
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2163 static gboolean
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2164 purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self,
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2165 const gchar *sess_id)
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2166 {
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2167 PurpleMediaBackendFs2Private *priv;
30414
77449a80fef2 Fix a possible Garbage return value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30174
diff changeset
2168 gboolean ret = FALSE;
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2169
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2170 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2171
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2172 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2173
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2174 if (sess_id != NULL) {
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2175 PurpleMediaBackendFs2Session *session = get_session(
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2176 PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2177
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2178 if (session == NULL)
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2179 return FALSE;
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2180
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2181 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
32765
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2182 PURPLE_MEDIA_SEND_VIDEO)) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2183 #ifdef HAVE_FARSIGHT
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2184 g_object_get(session->session,
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2185 "codecs-ready", &ret, NULL);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2186 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2187 GList *codecs = NULL;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2188
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2189 g_object_get(session->session,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2190 "codecs", &codecs, NULL);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2191 if (codecs) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2192 fs_codec_list_destroy (codecs);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2193 ret = TRUE;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2194 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2195 #endif
32765
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2196 } else
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2197 ret = TRUE;
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2198 } else {
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2199 GList *values = g_hash_table_get_values(priv->sessions);
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2200
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2201 for (; values; values = g_list_delete_link(values, values)) {
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2202 PurpleMediaBackendFs2Session *session = values->data;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2203
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2204 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
32765
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2205 PURPLE_MEDIA_SEND_VIDEO)) {
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2206 #ifdef HAVE_FARSIGHT
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2207 g_object_get(session->session,
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2208 "codecs-ready", &ret, NULL);
32765
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2209 if (ret == FALSE)
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2210 break;
32766
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2211 #else
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2212 GList *codecs = NULL;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2213
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2214 g_object_get(session->session,
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2215 "codecs", &codecs, NULL);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2216 if (codecs) {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2217 fs_codec_list_destroy (codecs);
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2218 ret = TRUE;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2219 } else {
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2220 ret = FALSE;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2221 break;
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2222 }
fd1b4bbefc6b Port to Farstream
olivier.crete@collabora.com
parents: 32765
diff changeset
2223 #endif
32765
60bd913072f7 Minor refactoring of purple_media_backend_fs2_codecs_ready()
Richard Laager <rlaager@wiktel.com>
parents: 32764
diff changeset
2224 } else
29187
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2225 ret = TRUE;
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2226 }
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2227
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2228 if (values != NULL)
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2229 g_list_free(values);
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2230 }
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2231
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2232 return ret;
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2233 }
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29185
diff changeset
2234
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2235 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2236 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2237 const gchar *sess_id)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2238 {
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2239 PurpleMediaBackendFs2Session *session;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2240 GList *fscodecs;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2241 GList *codecs;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2242
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2243 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2244
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2245 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2246
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2247 if (session == NULL)
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2248 return NULL;
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2249
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2250 g_object_get(G_OBJECT(session->session),
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2251 "codecs", &fscodecs, NULL);
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2252 codecs = codec_list_from_fs(fscodecs);
29175
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2253 fs_codec_list_destroy(fscodecs);
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2254
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29173
diff changeset
2255 return codecs;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2256 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2257
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2258 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2259 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2260 const gchar *sess_id, const gchar *participant)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2261 {
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2262 PurpleMediaBackendFs2Stream *stream;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2263 GList *candidates = NULL;
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2264
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2265 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2266
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2267 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2268 sess_id, participant);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2269
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2270 if (stream != NULL)
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2271 candidates = candidate_list_from_fs(
29177
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2272 stream->local_candidates);
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29176
diff changeset
2273 return candidates;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2274 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2275
29178
a7cad99144f0 Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents: 29177
diff changeset
2276 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2277 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2278 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2279 GList *codecs)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2280 {
29179
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2281 PurpleMediaBackendFs2Stream *stream;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2282 GList *fscodecs;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2283 GError *err = NULL;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2284
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2285 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2286 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
29179
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2287 sess_id, participant);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2288
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2289 if (stream == NULL)
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2290 return FALSE;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2291
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2292 fscodecs = codec_list_to_fs(codecs);
29179
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2293 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2294 fs_codec_list_destroy(fscodecs);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2295
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2296 if (err) {
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2297 purple_debug_error("backend-fs2",
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2298 "Error setting remote codecs: %s\n",
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2299 err->message);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2300 g_error_free(err);
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2301 return FALSE;
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2302 }
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2303
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29178
diff changeset
2304 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2305 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2306
29180
90c48f1e479a Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents: 29179
diff changeset
2307 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2308 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2309 const gchar *sess_id, PurpleMediaCodec *codec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2310 {
29181
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2311 PurpleMediaBackendFs2Session *session;
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2312 FsCodec *fscodec;
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2313 GError *err = NULL;
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2314
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2315 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2316
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2317 session = get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
29181
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2318
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2319 if (session == NULL)
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2320 return FALSE;
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2321
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2322 fscodec = codec_to_fs(codec);
29181
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2323 fs_session_set_send_codec(session->session, fscodec, &err);
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2324 fs_codec_destroy(fscodec);
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2325
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2326 if (err) {
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2327 purple_debug_error("media", "Error setting send codec\n");
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2328 g_error_free(err);
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2329 return FALSE;
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2330 }
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29180
diff changeset
2331
29180
90c48f1e479a Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents: 29179
diff changeset
2332 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2333 }
31517
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2334
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2335 static void
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2336 purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2337 guint num_params, GParameter *params)
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2338 {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2339 PurpleMediaBackendFs2Private *priv;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2340 const gchar **supported = purple_media_backend_fs2_get_available_params();
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2341 const gchar **p;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2342 guint i;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2343
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2344 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2345
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2346 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2347
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2348 if (priv->conference == NULL &&
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2349 !init_conference(PURPLE_MEDIA_BACKEND_FS2(self))) {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2350 purple_debug_error("backend-fs2",
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2351 "Error initializing the conference.\n");
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2352 return;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2353 }
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2354
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2355 for (i = 0; i != num_params; ++i) {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2356 for (p = supported; *p != NULL; ++p) {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2357 if (!strcmp(params[i].name, *p)) {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2358 g_object_set(priv->conference,
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2359 params[i].name, g_value_get_string(&params[i].value),
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2360 NULL);
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2361 break;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2362 }
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2363 }
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2364 }
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2365 }
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2366
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2367 static const gchar **
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2368 purple_media_backend_fs2_get_available_params(void)
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2369 {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2370 static const gchar *supported_params[] = {
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2371 "sdes-cname", "sdes-email", "sdes-location", "sdes-name", "sdes-note",
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2372 "sdes-phone", "sdes-tool", NULL
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2373 };
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2374
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2375 return supported_params;
a4ba3b194ce3 media: Allow setting SDES properties of RTP conferences. Fixes #12981.
jakub.adam@ktknet.cz
parents: 31419
diff changeset
2376 }
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2377 #else
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2378 GType
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2379 purple_media_backend_fs2_get_type(void)
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2380 {
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2381 return G_TYPE_NONE;
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2382 }
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2383 #endif /* USE_VV */
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2384
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2385 #ifdef USE_GSTREAMER
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2386 GstElement *
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2387 purple_media_backend_fs2_get_src(PurpleMediaBackendFs2 *self,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2388 const gchar *sess_id)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2389 {
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2390 #ifdef USE_VV
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2391 PurpleMediaBackendFs2Session *session = get_session(self, sess_id);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2392 return session != NULL ? session->src : NULL;
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2393 #else
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2394 return NULL;
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2395 #endif
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2396 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2397
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2398 GstElement *
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2399 purple_media_backend_fs2_get_tee(PurpleMediaBackendFs2 *self,
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2400 const gchar *sess_id, const gchar *who)
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2401 {
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2402 #ifdef USE_VV
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2403 if (sess_id != NULL && who == NULL) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2404 PurpleMediaBackendFs2Session *session =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2405 get_session(self, sess_id);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2406 return (session != NULL) ? session->tee : NULL;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2407 } else if (sess_id != NULL && who != NULL) {
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2408 PurpleMediaBackendFs2Stream *stream =
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2409 get_stream(self, sess_id, who);
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2410 return (stream != NULL) ? stream->tee : NULL;
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2411 }
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2412
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2413 #endif /* USE_VV */
29189
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2414 g_return_val_if_reached(NULL);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29188
diff changeset
2415 }
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2416
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2417 void
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2418 purple_media_backend_fs2_set_input_volume(PurpleMediaBackendFs2 *self,
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2419 const gchar *sess_id, double level)
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2420 {
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2421 #ifdef USE_VV
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2422 PurpleMediaBackendFs2Private *priv;
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2423 GList *sessions;
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2424
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2425 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2426
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2427 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2428
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2429 purple_prefs_set_int("/purple/media/audio/volume/input", level);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2430
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2431 if (sess_id == NULL)
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2432 sessions = g_hash_table_get_values(priv->sessions);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2433 else
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2434 sessions = g_list_append(NULL, get_session(self, sess_id));
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2435
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2436 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2437 PurpleMediaBackendFs2Session *session = sessions->data;
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2438
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2439 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2440 gchar *name = g_strdup_printf("volume_%s",
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2441 session->id);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2442 GstElement *volume = gst_bin_get_by_name(
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2443 GST_BIN(priv->confbin), name);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2444 g_free(name);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2445 g_object_set(volume, "volume", level/10.0, NULL);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2446 }
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2447 }
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2448 #endif /* USE_VV */
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2449 }
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2450
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2451 void
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2452 purple_media_backend_fs2_set_output_volume(PurpleMediaBackendFs2 *self,
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2453 const gchar *sess_id, const gchar *who, double level)
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2454 {
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2455 #ifdef USE_VV
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2456 GList *streams;
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2457
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2458 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2459
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2460 purple_prefs_set_int("/purple/media/audio/volume/output", level);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2461
29213
85a7a93cd19a Remove the underscore from functions as the underscore is reserved for compilers
maiku@pidgin.im
parents: 29209
diff changeset
2462 streams = get_streams(self, sess_id, who);
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2463
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2464 for (; streams; streams = g_list_delete_link(streams, streams)) {
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2465 PurpleMediaBackendFs2Stream *stream = streams->data;
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2466
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2467 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2468 && GST_IS_ELEMENT(stream->volume)) {
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2469 g_object_set(stream->volume, "volume",
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2470 level/10.0, NULL);
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2471 }
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2472 }
29320
bd7159aeabc0 Wraps backend-fs2.c in #ifdefs for when VV or GSTREAMER is disabled.
maiku@pidgin.im
parents: 29239
diff changeset
2473 #endif /* USE_VV */
29191
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29190
diff changeset
2474 }
29325
858d1a47bf83 Fix compile with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29320
diff changeset
2475 #endif /* USE_GSTREAMER */