libpurple/media.c

Sat, 31 Jan 2009 05:19:16 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Sat, 31 Jan 2009 05:19:16 +0000
branch
vv
changeset 26276
b9d3887b8318
parent 26270
c92c7e4eb004
child 26278
385a3da0c2fe
permissions
-rw-r--r--

Have all media sessions use a single pipeline.
This temporarily breaks the audio levels.

19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /**
19889
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
2 * @file media.c Media API
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 * @ingroup core
26105
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
4 */
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
5
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
6 /* purple
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * source distribution.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * (at your option) any later version.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 * GNU General Public License for more details.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 */
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
27 #include <string.h>
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
28
19889
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
29 #include "internal.h"
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
30
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31 #include "connection.h"
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
32 #include "media.h"
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
33 #include "marshallers.h"
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
34 #include "mediamanager.h"
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 26253
diff changeset
35 #include "network.h"
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
36
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
37 #include "debug.h"
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
38
23704
9b88c9b23aed Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents: 23701
diff changeset
39 #ifdef USE_VV
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
40
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
41 #include <gst/interfaces/propertyprobe.h>
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
42 #include <gst/interfaces/xoverlay.h>
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
43 #include <gst/farsight/fs-conference-iface.h>
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
44
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
45 /** @copydoc _PurpleMediaSession */
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
46 typedef struct _PurpleMediaSession PurpleMediaSession;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
47 /** @copydoc _PurpleMediaStream */
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
48 typedef struct _PurpleMediaStream PurpleMediaStream;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
49
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
50 struct _PurpleMediaSession
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
51 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
52 gchar *id;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
53 PurpleMedia *media;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
54 GstElement *src;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
55 FsSession *session;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
56
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
57 PurpleMediaSessionType type;
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
58
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
59 gboolean codecs_ready;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
60 gboolean accepted;
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
61
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
62 GstElement *sink;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
63 gulong window_id;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
64 };
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
65
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
66 struct _PurpleMediaStream
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
67 {
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
68 PurpleMediaSession *session;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
69 gchar *participant;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
70 FsStream *stream;
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
71 GstElement *sink;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
72
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
73 GList *local_candidates;
26200
6636bcf92be3 Add candidates instead of replacing them.
Michael Ruprecht <maiku@pidgin.im>
parents: 26195
diff changeset
74 GList *remote_candidates;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
75
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
76 gboolean candidates_prepared;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
77
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
78 FsCandidate *local_candidate;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
79 FsCandidate *remote_candidate;
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
80
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
81 gulong window_id;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
82 };
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
83
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84 struct _PurpleMediaPrivate
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85 {
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
86 FsConference *conference;
26187
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
87 gboolean initiator;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
89 GHashTable *sessions; /* PurpleMediaSession table */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
90 GHashTable *participants; /* FsParticipant table */
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
91
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
92 GList *streams; /* PurpleMediaStream table */
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
93
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
94 GstElement *pipeline;
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
95 GstElement *confbin;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
96 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
97
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
98 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
99
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
100 static void purple_media_class_init (PurpleMediaClass *klass);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
101 static void purple_media_init (PurpleMedia *media);
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
102 static void purple_media_dispose (GObject *object);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 static void purple_media_finalize (GObject *object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
104 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
107 static void purple_media_new_local_candidate_cb(FsStream *stream,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
108 FsCandidate *local_candidate, PurpleMediaSession *session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
109 static void purple_media_candidates_prepared_cb(FsStream *stream,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
110 PurpleMediaSession *session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
111 static void purple_media_candidate_pair_established_cb(FsStream *stream,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
112 FsCandidate *native_candidate, FsCandidate *remote_candidate,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
113 PurpleMediaSession *session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
114
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115 static GObjectClass *parent_class = NULL;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
116
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
118
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
119 enum {
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
120 ERROR,
26266
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
121 ACCEPTED,
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
122 CODECS_CHANGED,
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
123 NEW_CANDIDATE,
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
124 READY_NEW,
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
125 STATE_CHANGED,
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
126 LAST_SIGNAL
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
127 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
128 static guint purple_media_signals[LAST_SIGNAL] = {0};
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130 enum {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
131 PROP_0,
26185
6061487f59a7 Rename "fs-conference" to "conference".
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
132 PROP_CONFERENCE,
26187
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
133 PROP_INITIATOR,
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
135
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
136 GType
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
137 purple_media_get_type()
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
138 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
139 static GType type = 0;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
140
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141 if (type == 0) {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
142 static const GTypeInfo info = {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
143 sizeof(PurpleMediaClass),
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 (GClassInitFunc) purple_media_class_init,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
147 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
149 sizeof(PurpleMedia),
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 0,
22071
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19889
diff changeset
151 (GInstanceInitFunc) purple_media_init,
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19889
diff changeset
152 NULL
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
153 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
154 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
155 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
156 return type;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
157 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
158
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
159 GType
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
160 purple_media_state_changed_get_type()
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
161 {
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
162 static GType type = 0;
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
163 if (type == 0) {
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
164 static const GEnumValue values[] = {
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
165 { PURPLE_MEDIA_STATE_CHANGED_NEW, "PURPLE_MEDIA_STATE_CHANGED_NEW", "new" },
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
166 { PURPLE_MEDIA_STATE_CHANGED_CONNECTED, "PURPLE_MEDIA_STATE_CHANGED_CONNECTED", "connected" },
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
167 { PURPLE_MEDIA_STATE_CHANGED_END, "PURPLE_MEDIA_STATE_CHANGED_END", "end" },
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
168 { 0, NULL, NULL }
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
169 };
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
170 type = g_enum_register_static("PurpleMediaStateChangedType", values);
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
171 }
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
172 return type;
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
173 }
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
174
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
175 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176 purple_media_class_init (PurpleMediaClass *klass)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178 GObjectClass *gobject_class = (GObjectClass*)klass;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179 parent_class = g_type_class_peek_parent(klass);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
180
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
181 gobject_class->dispose = purple_media_dispose;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
182 gobject_class->finalize = purple_media_finalize;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
183 gobject_class->set_property = purple_media_set_property;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
184 gobject_class->get_property = purple_media_get_property;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
185
26185
6061487f59a7 Rename "fs-conference" to "conference".
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
186 g_object_class_install_property(gobject_class, PROP_CONFERENCE,
6061487f59a7 Rename "fs-conference" to "conference".
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
187 g_param_spec_object("conference",
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
188 "Farsight conference",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
189 "The FsConference associated with this media.",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
190 FS_TYPE_CONFERENCE,
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
191 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
192
26187
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
193 g_object_class_install_property(gobject_class, PROP_INITIATOR,
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
194 g_param_spec_boolean("initiator",
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
195 "initiator",
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
196 "If the local user initiated the conference.",
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
197 FALSE,
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
198 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
199
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
200 purple_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
201 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
202 g_cclosure_marshal_VOID__STRING,
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
203 G_TYPE_NONE, 1, G_TYPE_STRING);
26266
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
204 purple_media_signals[ACCEPTED] = g_signal_new("accepted", G_TYPE_FROM_CLASS(klass),
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
205 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
206 purple_smarshal_VOID__STRING_STRING,
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
207 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
208 purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass),
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
209 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
210 g_cclosure_marshal_VOID__STRING,
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
211 G_TYPE_NONE, 1, G_TYPE_STRING);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
212 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
213 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
214 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
215 G_TYPE_NONE, 3, G_TYPE_POINTER,
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
216 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
217 purple_media_signals[READY_NEW] = g_signal_new("ready-new", G_TYPE_FROM_CLASS(klass),
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
218 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
219 purple_smarshal_VOID__STRING_STRING,
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
220 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
221 purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass),
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
222 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
223 purple_smarshal_VOID__ENUM_STRING_STRING,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
224 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE_CHANGED,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
225 G_TYPE_STRING, G_TYPE_STRING);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
226 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
229
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
230 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
231 purple_media_init (PurpleMedia *media)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
232 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
234 memset(media->priv, 0, sizeof(media->priv));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
235 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
236
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
237 static void
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
238 purple_media_stream_free(PurpleMediaStream *stream)
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
239 {
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
240 g_free(stream->participant);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
241
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
242 if (stream->local_candidates)
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
243 fs_candidate_list_destroy(stream->local_candidates);
26200
6636bcf92be3 Add candidates instead of replacing them.
Michael Ruprecht <maiku@pidgin.im>
parents: 26195
diff changeset
244 if (stream->remote_candidates)
6636bcf92be3 Add candidates instead of replacing them.
Michael Ruprecht <maiku@pidgin.im>
parents: 26195
diff changeset
245 fs_candidate_list_destroy(stream->remote_candidates);
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
246
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
247 if (stream->local_candidate)
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
248 fs_candidate_destroy(stream->local_candidate);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
249 if (stream->remote_candidate)
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
250 fs_candidate_destroy(stream->remote_candidate);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
251
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
252 g_free(stream);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
253 }
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
254
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
255 static void
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
256 purple_media_session_free(PurpleMediaSession *session)
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
257 {
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
258 g_free(session->id);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
259 g_free(session);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
260 }
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
261
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
262 static void
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
263 purple_media_dispose(GObject *media)
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
264 {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
265 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
266 GList *iter = NULL;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
267
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
268 purple_debug_info("media","purple_media_dispose\n");
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
269
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
270 purple_media_manager_remove_media(purple_media_manager_get(),
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
271 PURPLE_MEDIA(media));
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
272
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
273 if (priv->confbin) {
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
274 gst_element_set_state(GST_ELEMENT(priv->confbin),
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
275 GST_STATE_NULL);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
276 gst_bin_remove(GST_BIN(priv->pipeline), priv->confbin);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
277 priv->confbin = NULL;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
278 priv->conference = NULL;
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
279 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
280
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
281 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
282 PurpleMediaStream *stream = iter->data;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
283 if (stream->stream) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
284 g_object_unref(stream->stream);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
285 stream->stream = NULL;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
286 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
287 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
288
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
289 if (priv->sessions) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
290 GList *sessions = g_hash_table_get_values(priv->sessions);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
291 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
292 PurpleMediaSession *session = sessions->data;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
293 if (session->session) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
294 g_object_unref(session->session);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
295 session->session = NULL;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
296 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
297 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
298 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
299
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
300 if (priv->participants) {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
301 GList *participants = g_hash_table_get_values(priv->participants);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
302 for (; participants; participants = g_list_delete_link(participants, participants))
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
303 g_object_unref(participants->data);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
304 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
305
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
306 G_OBJECT_CLASS(parent_class)->finalize(media);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
307 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
308
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
309 static void
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
310 purple_media_finalize(GObject *media)
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
311 {
23711
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
312 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
313 purple_debug_info("media","purple_media_finalize\n");
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
314
26181
8dd52c56abc0 Free Farsight objects better.
Michael Ruprecht <maiku@pidgin.im>
parents: 26180
diff changeset
315 for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams))
8dd52c56abc0 Free Farsight objects better.
Michael Ruprecht <maiku@pidgin.im>
parents: 26180
diff changeset
316 purple_media_stream_free(priv->streams->data);
8dd52c56abc0 Free Farsight objects better.
Michael Ruprecht <maiku@pidgin.im>
parents: 26180
diff changeset
317
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
318 if (priv->sessions) {
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
319 GList *sessions = g_hash_table_get_values(priv->sessions);
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
320 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
321 purple_media_session_free(sessions->data);
26096
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
322 }
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
323 g_hash_table_destroy(priv->sessions);
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
324 }
26096
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
325
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26209
diff changeset
326 G_OBJECT_CLASS(parent_class)->finalize(media);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
327 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
328
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
329 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
330 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
331 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
332 PurpleMedia *media;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
333 g_return_if_fail(PURPLE_IS_MEDIA(object));
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
334
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
335 media = PURPLE_MEDIA(object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
336
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
337 switch (prop_id) {
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
338 case PROP_CONFERENCE: {
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
339 gchar *name;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
340
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
341 if (media->priv->conference)
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
342 gst_object_unref(media->priv->conference);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
343 media->priv->conference = g_value_get_object(value);
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
344 gst_object_ref(media->priv->conference);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
345
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
346 name = g_strdup_printf("conf_%p",
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
347 media->priv->conference);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
348 media->priv->confbin = gst_bin_new(name);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
349 g_free(name);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
350 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
351 media->priv->confbin);
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
352 gst_bin_add(GST_BIN(media->priv->confbin),
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
353 GST_ELEMENT(media->priv->conference));
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
354
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
355 gst_element_set_state(GST_ELEMENT(
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
356 media->priv->confbin),
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
357 GST_STATE_PLAYING);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
358 break;
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
359 }
26187
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
360 case PROP_INITIATOR:
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
361 media->priv->initiator = g_value_get_boolean(value);
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
362 break;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
363 default:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
364 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
365 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
366 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
367 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
368
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
369 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
370 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
371 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
372 PurpleMedia *media;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
373 g_return_if_fail(PURPLE_IS_MEDIA(object));
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
374
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
375 media = PURPLE_MEDIA(object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
376
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
377 switch (prop_id) {
26185
6061487f59a7 Rename "fs-conference" to "conference".
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
378 case PROP_CONFERENCE:
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
379 g_value_set_object(value, media->priv->conference);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
380 break;
26187
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
381 case PROP_INITIATOR:
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
382 g_value_set_boolean(value, media->priv->initiator);
3b3059a7c091 Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26185
diff changeset
383 break;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
384 default:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
385 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
386 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
387 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
388
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
389 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
390
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
391 PurpleMediaCandidate *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
392 purple_media_candidate_new(const gchar *foundation, guint component_id,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
393 PurpleMediaCandidateType type,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
394 PurpleMediaNetworkProtocol proto,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
395 const gchar *ip, guint port)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
396 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
397 PurpleMediaCandidate *candidate = g_new0(PurpleMediaCandidate, 1);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
398 candidate->foundation = g_strdup(foundation);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
399 candidate->component_id = component_id;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
400 candidate->type = type;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
401 candidate->proto = proto;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
402 candidate->ip = g_strdup(ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
403 candidate->port = port;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
404 return candidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
405 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
406
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
407 static PurpleMediaCandidate *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
408 purple_media_candidate_copy(PurpleMediaCandidate *candidate)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
409 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
410 PurpleMediaCandidate *new_candidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
411
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
412 if (candidate == NULL)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
413 return NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
414
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
415 new_candidate = g_new0(PurpleMediaCandidate, 1);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
416 new_candidate->foundation = g_strdup(candidate->foundation);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
417 new_candidate->component_id = candidate->component_id;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
418 new_candidate->ip = g_strdup(candidate->ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
419 new_candidate->port = candidate->port;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
420 new_candidate->base_ip = g_strdup(candidate->base_ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
421 new_candidate->base_port = candidate->base_port;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
422 new_candidate->proto = candidate->proto;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
423 new_candidate->priority = candidate->priority;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
424 new_candidate->type = candidate->type;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
425 new_candidate->username = g_strdup(candidate->username);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
426 new_candidate->password = g_strdup(candidate->password);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
427 new_candidate->ttl = candidate->ttl;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
428 return new_candidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
429 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
430
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
431 static void
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
432 purple_media_candidate_free(PurpleMediaCandidate *candidate)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
433 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
434 if (candidate == NULL)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
435 return;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
436
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
437 g_free((gchar*)candidate->foundation);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
438 g_free((gchar*)candidate->ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
439 g_free((gchar*)candidate->base_ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
440 g_free((gchar*)candidate->username);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
441 g_free((gchar*)candidate->password);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
442 g_free(candidate);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
443 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
444
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
445 static FsCandidate *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
446 purple_media_candidate_to_fs(PurpleMediaCandidate *candidate)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
447 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
448 FsCandidate *fscandidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
449
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
450 if (candidate == NULL)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
451 return NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
452
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
453 fscandidate = fs_candidate_new(candidate->foundation,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
454 candidate->component_id, candidate->type,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
455 candidate->proto, candidate->ip, candidate->port);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
456
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
457 fscandidate->base_ip = g_strdup(candidate->base_ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
458 fscandidate->base_port = candidate->base_port;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
459 fscandidate->priority = candidate->priority;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
460 fscandidate->username = g_strdup(candidate->username);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
461 fscandidate->password = g_strdup(candidate->password);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
462 fscandidate->ttl = candidate->ttl;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
463 return fscandidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
464 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
465
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
466 static PurpleMediaCandidate *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
467 purple_media_candidate_from_fs(FsCandidate *fscandidate)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
468 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
469 PurpleMediaCandidate *candidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
470
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
471 if (fscandidate == NULL)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
472 return NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
473
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
474 candidate = purple_media_candidate_new(fscandidate->foundation,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
475 fscandidate->component_id, fscandidate->type,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
476 fscandidate->proto, fscandidate->ip, fscandidate->port);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
477 candidate->base_ip = g_strdup(fscandidate->base_ip);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
478 candidate->base_port = fscandidate->base_port;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
479 candidate->priority = fscandidate->priority;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
480 candidate->username = g_strdup(fscandidate->username);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
481 candidate->password = g_strdup(fscandidate->password);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
482 candidate->ttl = fscandidate->ttl;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
483 return candidate;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
484 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
485
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
486 static GList *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
487 purple_media_candidate_list_from_fs(GList *candidates)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
488 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
489 GList *new_list = NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
490
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
491 for (; candidates; candidates = g_list_next(candidates)) {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
492 new_list = g_list_prepend(new_list,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
493 purple_media_candidate_from_fs(
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
494 candidates->data));
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
495 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
496
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
497 new_list = g_list_reverse(new_list);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
498 return new_list;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
499 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
500
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
501 static GList *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
502 purple_media_candidate_list_to_fs(GList *candidates)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
503 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
504 GList *new_list = NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
505
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
506 for (; candidates; candidates = g_list_next(candidates)) {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
507 new_list = g_list_prepend(new_list,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
508 purple_media_candidate_to_fs(
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
509 candidates->data));
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
510 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
511
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
512 new_list = g_list_reverse(new_list);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
513 return new_list;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
514 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
515
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
516 GList *
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
517 purple_media_candidate_list_copy(GList *candidates)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
518 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
519 GList *new_list = NULL;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
520
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
521 for (; candidates; candidates = g_list_next(candidates)) {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
522 new_list = g_list_prepend(new_list, g_boxed_copy(
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
523 PURPLE_TYPE_MEDIA_CANDIDATE,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
524 candidates->data));
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
525 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
526
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
527 new_list = g_list_reverse(new_list);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
528 return new_list;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
529 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
530
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
531 void
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
532 purple_media_candidate_list_free(GList *candidates)
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
533 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
534 for (; candidates; candidates =
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
535 g_list_delete_link(candidates, candidates)) {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
536 g_boxed_free(PURPLE_TYPE_MEDIA_CANDIDATE,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
537 candidates->data);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
538 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
539 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
540
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
541 GType
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
542 purple_media_candidate_get_type()
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
543 {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
544 static GType type = 0;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
545
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
546 if (type == 0) {
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
547 type = g_boxed_type_register_static("PurpleMediaCandidate",
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
548 (GBoxedCopyFunc)purple_media_candidate_copy,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
549 (GBoxedFreeFunc)purple_media_candidate_free);
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
550 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
551 return type;
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
552 }
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
553
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26217
diff changeset
554 static FsMediaType
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
555 purple_media_to_fs_media_type(PurpleMediaSessionType type)
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
556 {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
557 if (type & PURPLE_MEDIA_AUDIO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
558 return FS_MEDIA_TYPE_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
559 else if (type & PURPLE_MEDIA_VIDEO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
560 return FS_MEDIA_TYPE_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
561 else
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
562 return 0;
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
563 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
564
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26217
diff changeset
565 static FsStreamDirection
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
566 purple_media_to_fs_stream_direction(PurpleMediaSessionType type)
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
567 {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
568 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
569 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
570 return FS_DIRECTION_BOTH;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
571 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
572 (type & PURPLE_MEDIA_SEND_VIDEO))
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
573 return FS_DIRECTION_SEND;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
574 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
575 (type & PURPLE_MEDIA_RECV_VIDEO))
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
576 return FS_DIRECTION_RECV;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
577 else
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
578 return FS_DIRECTION_NONE;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
579 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
580
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26217
diff changeset
581 static PurpleMediaSessionType
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
582 purple_media_from_fs(FsMediaType type, FsStreamDirection direction)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
583 {
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
584 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
585 if (type == FS_MEDIA_TYPE_AUDIO) {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
586 if (direction & FS_DIRECTION_SEND)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
587 result |= PURPLE_MEDIA_SEND_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
588 if (direction & FS_DIRECTION_RECV)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
589 result |= PURPLE_MEDIA_RECV_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
590 } else if (type == FS_MEDIA_TYPE_VIDEO) {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
591 if (direction & FS_DIRECTION_SEND)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
592 result |= PURPLE_MEDIA_SEND_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
593 if (direction & FS_DIRECTION_RECV)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
594 result |= PURPLE_MEDIA_RECV_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
595 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
596 return result;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
597 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
598
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
599 void
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
600 purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
601 const gchar *name, const gchar *value)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
602 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
603 PurpleMediaCodecParameter *new_param;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
604
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
605 g_return_if_fail(name != NULL && value != NULL);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
606
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
607 new_param = g_new0(PurpleMediaCodecParameter, 1);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
608 new_param->name = g_strdup(name);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
609 new_param->value = g_strdup(value);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
610 codec->optional_params = g_list_append(
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
611 codec->optional_params, new_param);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
612 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
613
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
614 void
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
615 purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
616 PurpleMediaCodecParameter *param)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
617 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
618 g_free(param->name);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
619 g_free(param->value);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
620 g_free(param);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
621 codec->optional_params =
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
622 g_list_remove(codec->optional_params, param);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
623 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
624
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
625 PurpleMediaCodecParameter *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
626 purple_media_codec_get_optional_parameter(PurpleMediaCodec *codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
627 const gchar *name, const gchar *value)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
628 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
629 GList *iter;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
630
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
631 g_return_val_if_fail(codec != NULL, NULL);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
632 g_return_val_if_fail(name != NULL, NULL);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
633
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
634 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
635 PurpleMediaCodecParameter *param = iter->data;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
636 if (!g_ascii_strcasecmp(param->name, name) &&
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
637 (value == NULL ||
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
638 !g_ascii_strcasecmp(param->value, value)))
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
639 return param;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
640 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
641
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
642 return NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
643 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
644
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
645 PurpleMediaCodec *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
646 purple_media_codec_new(int id, const char *encoding_name,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
647 PurpleMediaSessionType media_type, guint clock_rate)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
648 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
649 PurpleMediaCodec *codec = g_new0(PurpleMediaCodec, 1);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
650
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
651 codec->id = id;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
652 codec->encoding_name = g_strdup(encoding_name);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
653 codec->media_type = media_type;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
654 codec->clock_rate = clock_rate;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
655 return codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
656 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
657
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
658 static PurpleMediaCodec *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
659 purple_media_codec_copy(PurpleMediaCodec *codec)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
660 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
661 PurpleMediaCodec *new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
662 GList *iter;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
663
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
664 if (codec == NULL)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
665 return NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
666
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
667 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
668 codec->media_type, codec->clock_rate);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
669 new_codec->channels = codec->channels;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
670
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
671 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
672 PurpleMediaCodecParameter *param =
26235
10cecb64ea88 Manipulate optional parameters properly.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
673 (PurpleMediaCodecParameter*)iter->data;
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
674 purple_media_codec_add_optional_parameter(new_codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
675 param->name, param->value);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
676 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
677
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
678 return new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
679 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
680
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
681 static void
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
682 purple_media_codec_free(PurpleMediaCodec *codec)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
683 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
684 if (codec == NULL)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
685 return;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
686
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
687 g_free(codec->encoding_name);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
688
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
689 for (; codec->optional_params; codec->optional_params =
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
690 g_list_delete_link(codec->optional_params,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
691 codec->optional_params)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
692 purple_media_codec_remove_optional_parameter(codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
693 codec->optional_params->data);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
694 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
695
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
696 g_free(codec);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
697 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
698
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
699 static FsCodec *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
700 purple_media_codec_to_fs(const PurpleMediaCodec *codec)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
701 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
702 FsCodec *new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
703 GList *iter;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
704
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
705 if (codec == NULL)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
706 return NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
707
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
708 new_codec = fs_codec_new(codec->id, codec->encoding_name,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
709 purple_media_to_fs_media_type(codec->media_type),
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
710 codec->clock_rate);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
711 new_codec->channels = codec->channels;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
712
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
713 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
714 PurpleMediaCodecParameter *param =
26235
10cecb64ea88 Manipulate optional parameters properly.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
715 (PurpleMediaCodecParameter*)iter->data;
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
716 fs_codec_add_optional_parameter(new_codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
717 param->name, param->value);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
718 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
719
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
720 return new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
721 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
722
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
723 static PurpleMediaCodec *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
724 purple_media_codec_from_fs(const FsCodec *codec)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
725 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
726 PurpleMediaCodec *new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
727 GList *iter;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
728
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
729 if (codec == NULL)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
730 return NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
731
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
732 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
733 purple_media_from_fs(codec->media_type,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
734 FS_DIRECTION_BOTH), codec->clock_rate);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
735 new_codec->channels = codec->channels;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
736
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
737 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
26235
10cecb64ea88 Manipulate optional parameters properly.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
738 FsCodecParameter *param = (FsCodecParameter*)iter->data;
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
739 purple_media_codec_add_optional_parameter(new_codec,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
740 param->name, param->value);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
741 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
742
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
743 return new_codec;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
744 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
745
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
746 gchar *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
747 purple_media_codec_to_string(const PurpleMediaCodec *codec)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
748 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
749 FsCodec *fscodec = purple_media_codec_to_fs(codec);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
750 gchar *str = fs_codec_to_string(fscodec);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
751 fs_codec_destroy(fscodec);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
752 return str;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
753 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
754
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
755 static GList *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
756 purple_media_codec_list_from_fs(GList *codecs)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
757 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
758 GList *new_list = NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
759
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
760 for (; codecs; codecs = g_list_next(codecs)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
761 new_list = g_list_prepend(new_list,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
762 purple_media_codec_from_fs(
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
763 codecs->data));
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
764 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
765
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
766 new_list = g_list_reverse(new_list);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
767 return new_list;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
768 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
769
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
770 static GList *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
771 purple_media_codec_list_to_fs(GList *codecs)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
772 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
773 GList *new_list = NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
774
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
775 for (; codecs; codecs = g_list_next(codecs)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
776 new_list = g_list_prepend(new_list,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
777 purple_media_codec_to_fs(
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
778 codecs->data));
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
779 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
780
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
781 new_list = g_list_reverse(new_list);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
782 return new_list;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
783 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
784
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
785 GList *
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
786 purple_media_codec_list_copy(GList *codecs)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
787 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
788 GList *new_list = NULL;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
789
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
790 for (; codecs; codecs = g_list_next(codecs)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
791 new_list = g_list_prepend(new_list, g_boxed_copy(
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
792 PURPLE_TYPE_MEDIA_CODEC,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
793 codecs->data));
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
794 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
795
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
796 new_list = g_list_reverse(new_list);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
797 return new_list;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
798 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
799
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
800 void
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
801 purple_media_codec_list_free(GList *codecs)
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
802 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
803 for (; codecs; codecs =
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
804 g_list_delete_link(codecs, codecs)) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
805 g_boxed_free(PURPLE_TYPE_MEDIA_CODEC,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
806 codecs->data);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
807 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
808 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
809
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
810 GType
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
811 purple_media_codec_get_type()
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
812 {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
813 static GType type = 0;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
814
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
815 if (type == 0) {
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
816 type = g_boxed_type_register_static("PurpleMediaCodec",
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
817 (GBoxedCopyFunc)purple_media_codec_copy,
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
818 (GBoxedFreeFunc)purple_media_codec_free);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
819 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
820 return type;
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
821 }
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
822
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
823
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
824
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
825 PurpleMediaSessionType
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
826 purple_media_get_overall_type(PurpleMedia *media)
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
827 {
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
828 GList *values = g_hash_table_get_values(media->priv->sessions);
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
829 PurpleMediaSessionType type = PURPLE_MEDIA_NONE;
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
830
23752
d573c980437e Fixed some memory leak issues involving GLists.
Michael Ruprecht <maiku@pidgin.im>
parents: 23746
diff changeset
831 for (; values; values = g_list_delete_link(values, values)) {
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
832 PurpleMediaSession *session = values->data;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
833 type |= session->type;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
834 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
835
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
836 return type;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
837 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
838
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
839 static PurpleMediaSession*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
840 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
841 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
842 return (PurpleMediaSession*) (media->priv->sessions) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
843 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
844 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
845
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
846 static FsParticipant*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
847 purple_media_get_participant(PurpleMedia *media, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
848 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
849 return (FsParticipant*) (media->priv->participants) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
850 g_hash_table_lookup(media->priv->participants, name) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
851 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
852
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
853 static PurpleMediaStream*
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
854 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant)
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
855 {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
856 GList *streams = media->priv->streams;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
857
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
858 for (; streams; streams = g_list_next(streams)) {
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
859 PurpleMediaStream *stream = streams->data;
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
860 if (!strcmp(stream->session->id, session) &&
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
861 !strcmp(stream->participant, participant))
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
862 return stream;
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
863 }
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
864
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
865 return NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
866 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
867
26172
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
868 static GList *
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
869 purple_media_get_streams(PurpleMedia *media, const gchar *session,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
870 const gchar *participant)
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
871 {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
872 GList *streams = media->priv->streams;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
873 GList *ret = NULL;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
874
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
875 for (; streams; streams = g_list_next(streams)) {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
876 PurpleMediaStream *stream = streams->data;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
877 if ((session == NULL ||
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
878 !strcmp(stream->session->id, session)) &&
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
879 (participant == NULL ||
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
880 !strcmp(stream->participant, participant)))
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
881 ret = g_list_append(ret, stream);
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
882 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
883
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
884 return ret;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
885 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
886
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
887 static void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
888 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
889 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
890 if (!media->priv->sessions) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
891 purple_debug_info("media", "Creating hash table for sessions\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
892 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
893 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
894 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
895 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
896
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
897 static gboolean
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
898 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
899 {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
900 return g_hash_table_remove(media->priv->sessions, session->id);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
901 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
902
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
903 static FsParticipant *
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
904 purple_media_add_participant(PurpleMedia *media, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
905 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
906 FsParticipant *participant = purple_media_get_participant(media, name);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
907 GError *err = NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
908
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
909 if (participant)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
910 return participant;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
911
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
912 participant = fs_conference_new_participant(media->priv->conference,
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
913 (gchar*)name, &err);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
914
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
915 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
916 purple_debug_error("media", "Error creating participant: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
917 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
918 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
919 return NULL;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
920 }
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
921
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
922 if (!media->priv->participants) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
923 purple_debug_info("media", "Creating hash table for participants\n");
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
924 media->priv->participants = g_hash_table_new_full(g_str_hash,
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
925 g_str_equal, g_free, NULL);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
926 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
927
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
928 g_hash_table_insert(media->priv->participants, g_strdup(name), participant);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
929
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
930 return participant;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
931 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
932
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
933 static PurpleMediaStream *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
934 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
935 {
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
936 PurpleMediaStream *media_stream = g_new0(PurpleMediaStream, 1);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
937 media_stream->stream = stream;
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
938 media_stream->participant = g_strdup(name);
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
939 media_stream->session = session;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
940
26162
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
941 session->media->priv->streams =
5089efd94a64 Added PurpleMediaStream to wrap FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26160
diff changeset
942 g_list_append(session->media->priv->streams, media_stream);
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
943
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
944 return media_stream;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
945 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
946
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
947 static void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
948 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
949 FsCandidate *candidate)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
950 {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
951 PurpleMediaStream *stream = purple_media_get_stream(session->media, session->id, name);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
952 stream->local_candidates = g_list_append(stream->local_candidates, candidate);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
953 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
954
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
955 GList *
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
956 purple_media_get_session_names(PurpleMedia *media)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
957 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
958 return g_hash_table_get_keys(media->priv->sessions);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
959 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
960
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
961 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
962 purple_media_get_elements(PurpleMedia *media, GstElement **audio_src, GstElement **audio_sink,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
963 GstElement **video_src, GstElement **video_sink)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
964 {
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
965 GList *values = g_hash_table_get_values(media->priv->sessions);
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
966
23752
d573c980437e Fixed some memory leak issues involving GLists.
Michael Ruprecht <maiku@pidgin.im>
parents: 23746
diff changeset
967 for (; values; values = g_list_delete_link(values, values)) {
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
968 PurpleMediaSession *session = (PurpleMediaSession*)values->data;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
969
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
970 if (session->type & PURPLE_MEDIA_SEND_AUDIO && audio_src)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
971 *audio_src = session->src;
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
972 if (session->type & PURPLE_MEDIA_SEND_VIDEO && video_src)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
973 *video_src = session->src;
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
974 }
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
975
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
976 values = media->priv->streams;
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
977 for (; values; values = g_list_next(values)) {
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
978 PurpleMediaStream *stream = (PurpleMediaStream*)values->data;
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
979
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
980 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO && audio_sink)
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
981 *audio_sink = stream->sink;
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
982 if (stream->session->type & PURPLE_MEDIA_RECV_VIDEO && video_sink)
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
983 *video_sink = stream->sink;
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
984 }
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
985 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
986
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
987 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
988 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
989 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
990 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
991 GstPad *sinkpad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
992 GstPad *srcpad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
993
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
994 if (session->src)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
995 gst_object_unref(session->src);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
996 session->src = src;
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
997 gst_bin_add(GST_BIN(session->media->priv->confbin),
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
998 session->src);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
999
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1000 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1001 srcpad = gst_element_get_static_pad(src, "ghostsrc");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1002 purple_debug_info("media", "connecting pad: %s\n",
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1003 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1004 ? "success" : "failure");
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1005 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1006
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1007 void
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1008 purple_media_set_sink(PurpleMedia *media, const gchar *sess_id,
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1009 const gchar *participant, GstElement *sink)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1010 {
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1011 PurpleMediaStream *stream =
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1012 purple_media_get_stream(media, sess_id, participant);
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1013
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1014 if (stream->sink)
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1015 gst_object_unref(stream->sink);
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1016 stream->sink = sink;
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1017 gst_bin_add(GST_BIN(stream->session->media->priv->confbin),
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1018 stream->sink);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1019 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1020
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1021 GstElement *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1022 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1023 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1024 return purple_media_get_session(media, sess_id)->src;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1025 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1026
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1027 GstElement *
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1028 purple_media_get_sink(PurpleMedia *media, const gchar *sess_id, const gchar *participant)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1029 {
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1030 return purple_media_get_stream(media, sess_id, participant)->sink;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1031 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1032
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1033 static PurpleMediaSession *
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1034 purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream)
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1035 {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1036 FsSession *fssession;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1037 GList *values;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1038
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1039 g_object_get(stream, "session", &fssession, NULL);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1040
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1041 values = g_hash_table_get_values(media->priv->sessions);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1042
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1043 for (; values; values = g_list_delete_link(values, values)) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1044 PurpleMediaSession *session = values->data;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1045
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1046 if (session->session == fssession) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1047 g_list_free(values);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1048 g_object_unref(fssession);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1049 return session;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1050 }
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1051 }
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1052
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1053 g_object_unref(fssession);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1054 return NULL;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1055 }
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1056
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1057 /* This could also emit when participants are ready */
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1058 static void
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1059 purple_media_emit_ready(PurpleMedia *media, PurpleMediaSession *session, const gchar *participant)
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1060 {
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1061 GList *sessions;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1062 gboolean conf_ready = TRUE;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1063
26190
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1064 if ((session != NULL) && ((media->priv->initiator == FALSE &&
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1065 session->accepted == FALSE) ||
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1066 (purple_media_codecs_ready(media, session->id) == FALSE)))
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1067 return;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1068
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1069 sessions = g_hash_table_get_values(media->priv->sessions);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1070
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1071 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1072 PurpleMediaSession *session_data = sessions->data;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1073 GList *streams = purple_media_get_streams(media,
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1074 session_data->id, NULL);
26190
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1075 gboolean session_ready = TRUE;
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1076
26190
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1077 if ((media->priv->initiator == FALSE &&
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1078 session_data->accepted == FALSE) ||
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1079 (purple_media_codecs_ready(
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1080 media, session_data->id) == FALSE))
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1081 conf_ready = FALSE;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1082
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1083 for (; streams; streams = g_list_delete_link(streams, streams)) {
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1084 PurpleMediaStream *stream = streams->data;
26190
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1085 if (stream->candidates_prepared == FALSE) {
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1086 session_ready = FALSE;
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1087 conf_ready = FALSE;
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1088 } else if (session_data == session)
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1089 g_signal_emit(media, purple_media_signals[READY_NEW],
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1090 0, session_data->id, stream->participant);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1091 }
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1092
26190
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1093 if (session_ready == TRUE &&
8d7ea9d4f8d4 Have XMPP use the new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26189
diff changeset
1094 (session == session_data || session == NULL))
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1095 g_signal_emit(media, purple_media_signals[READY_NEW],
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1096 0, session_data->id, NULL);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1097 }
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1098
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1099 if (conf_ready == TRUE) {
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1100 g_signal_emit(media, purple_media_signals[READY_NEW],
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1101 0, NULL, NULL);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1102 }
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1103 }
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1104
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1105 static gboolean
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1106 media_bus_call(GstBus *bus, GstMessage *msg, gpointer dummy)
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1107 {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1108 switch(GST_MESSAGE_TYPE(msg)) {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1109 case GST_MESSAGE_EOS:
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1110 purple_debug_info("media", "End of Stream\n");
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1111 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1112 case GST_MESSAGE_ERROR: {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1113 gchar *debug = NULL;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1114 GError *err = NULL;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1115
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1116 gst_message_parse_error(msg, &err, &debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1117
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1118 purple_debug_error("media", "gst pipeline error: %s\n", err->message);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1119 g_error_free(err);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1120
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1121 if (debug) {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1122 purple_debug_error("media", "Debug details: %s\n", debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1123 g_free (debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1124 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1125 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1126 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1127 case GST_MESSAGE_ELEMENT: {
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1128 PurpleMedia *media = NULL;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1129 if (FS_IS_CONFERENCE(GST_MESSAGE_SRC(msg))) {
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1130 GList *iter = purple_media_manager_get_media(
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1131 purple_media_manager_get());
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1132 for (; iter; iter = g_list_next(iter)) {
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1133 if (PURPLE_MEDIA(iter->data)->priv->conference
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1134 == FS_CONFERENCE(GST_MESSAGE_SRC(msg))) {
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1135 media = iter->data;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1136 break;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1137 }
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1138 }
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1139 }
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1140
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1141 if (gst_structure_has_name(msg->structure, "farsight-error")) {
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1142 FsError error_no;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1143 gst_structure_get_enum(msg->structure, "error-no",
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1144 FS_TYPE_ERROR, (gint*)&error_no);
26132
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1145 /*
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1146 * Unknown CName is only a problem for the
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1147 * multicast transmitter which isn't used.
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1148 */
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1149 if (error_no != FS_ERROR_UNKNOWN_CNAME)
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1150 purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
1dce93db50e3 Silence FS_ERROR_UNKNOWN_CNAME error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26131
diff changeset
1151 gst_structure_get_string(msg->structure, "error-msg"));
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1152 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1153 "farsight-new-local-candidate")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1154 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1155 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "candidate"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1156 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1157 purple_media_new_local_candidate_cb(stream, local_candidate, session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1158 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1159 "farsight-local-candidates-prepared")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1160 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1161 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1162 purple_media_candidates_prepared_cb(stream, session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1163 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1164 "farsight-new-active-candidate-pair")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1165 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1166 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "local-candidate"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1167 FsCandidate *remote_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "remote-candidate"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1168 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1169 purple_media_candidate_pair_established_cb(stream, local_candidate, remote_candidate, session);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1170 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1171 "farsight-recv-codecs-changed")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1172 GList *codecs = g_value_get_boxed(gst_structure_get_value(msg->structure, "codecs"));
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1173 FsCodec *codec = codecs->data;
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1174 purple_debug_info("media", "farsight-recv-codecs-changed: %s\n", codec->encoding_name);
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1175
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1176 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1177 "farsight-component-state-changed")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1178
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1179 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1180 "farsight-send-codec-changed")) {
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1181
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1182 } else if (gst_structure_has_name(msg->structure,
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1183 "farsight-codecs-changed")) {
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1184 GList *sessions = g_hash_table_get_values(PURPLE_MEDIA(media)->priv->sessions);
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1185 FsSession *fssession = g_value_get_object(gst_structure_get_value(msg->structure, "session"));
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1186 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1187 PurpleMediaSession *session = sessions->data;
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1188 if (session->session == fssession) {
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1189 gboolean ready;
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
1190 gchar *session_id;
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
1191
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1192 g_object_get(session->session, "codecs-ready", &ready, NULL);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1193 if (session->codecs_ready == FALSE && ready == TRUE) {
26191
12ec5694e4a4 Use the new ready signal instead of accept to send a session-accept.
Michael Ruprecht <maiku@pidgin.im>
parents: 26190
diff changeset
1194 session->codecs_ready = ready;
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1195 purple_media_emit_ready(media, session, NULL);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1196 }
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1197
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
1198 session_id = g_strdup(session->id);
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
1199 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, session_id);
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
1200 g_free(session_id);
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1201 g_list_free(sessions);
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1202 break;
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1203 }
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1204 }
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1205 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1206 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1207 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1208 default:
26120
b4ab036ab9fe Remove a bunch of extraneous GstBus messages from the debug output.
Michael Ruprecht <maiku@pidgin.im>
parents: 26119
diff changeset
1209 break;
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1210 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1211
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1212 return TRUE;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1213 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1214
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1215 GstElement *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1216 purple_media_get_pipeline(PurpleMedia *media)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1217 {
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1218 static GstElement *pipeline = NULL;
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1219
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1220 if (!pipeline) {
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1221 GstBus *bus;
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1222 media->priv->pipeline = pipeline = gst_pipeline_new(NULL);
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1223 bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1224 gst_bus_add_signal_watch(GST_BUS(bus));
26119
3c849417c108 Fix GStreamer assertion.
Michael Ruprecht <maiku@pidgin.im>
parents: 26118
diff changeset
1225 g_signal_connect(G_OBJECT(bus), "message",
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1226 G_CALLBACK(media_bus_call), NULL);
26177
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26176
diff changeset
1227 gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL);
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
1228 gst_object_unref(bus);
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1229 gst_element_set_state(pipeline, GST_STATE_PLAYING);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1230 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1231
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1232 media->priv->pipeline = pipeline;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1233 return media->priv->pipeline;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1234 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1235
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1236 void
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1237 purple_media_error(PurpleMedia *media, const gchar *error, ...)
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1238 {
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1239 va_list args;
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1240 gchar *message;
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1241
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1242 va_start(args, error);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1243 message = g_strdup_vprintf(error, args);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1244 va_end(args);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1245
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1246 purple_debug_error("media", "%s\n", message);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1247 g_signal_emit(media, purple_media_signals[ERROR], 0, message);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1248
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1249 g_free(message);
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1250 }
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1251
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1252 void
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1253 purple_media_accept(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1254 {
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1255 GList *sessions;
26209
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1256 GList *streams;
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1257
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1258 sessions = g_hash_table_get_values(media->priv->sessions);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1259
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1260 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1261 PurpleMediaSession *session = sessions->data;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1262 session->accepted = TRUE;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1263
26248
03954067f80e Remove some of the deprecated API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26247
diff changeset
1264 if (media->priv->initiator == FALSE)
03954067f80e Remove some of the deprecated API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26247
diff changeset
1265 purple_media_emit_ready(media, session, NULL);
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1266 }
26209
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1267
26266
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
1268 g_signal_emit(media, purple_media_signals[ACCEPTED],
069e72982f87 Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26265
diff changeset
1269 0, NULL, NULL);
26209
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1270 streams = media->priv->streams;
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1271
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1272 for (; streams; streams = g_list_next(streams)) {
26257
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1273 PurpleMediaStream *stream = streams->data;
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1274 g_object_set(G_OBJECT(stream->stream), "direction",
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1275 purple_media_to_fs_stream_direction(
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1276 stream->session->type), NULL);
26209
618cc6a7cff2 Wait to send media until both sides have accepted.
Michael Ruprecht <maiku@pidgin.im>
parents: 26200
diff changeset
1277 }
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1278 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1279
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1280 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1281 purple_media_hangup(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1282 {
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1283 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
26237
9f5f3c147950 Added reject and hangup states to the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26235
diff changeset
1284 0, PURPLE_MEDIA_STATE_CHANGED_HANGUP,
9f5f3c147950 Added reject and hangup states to the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26235
diff changeset
1285 NULL, NULL);
26264
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1286 purple_media_end(media, NULL, NULL);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1287 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1288
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1289 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1290 purple_media_reject(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1291 {
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1292 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
26237
9f5f3c147950 Added reject and hangup states to the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26235
diff changeset
1293 0, PURPLE_MEDIA_STATE_CHANGED_REJECTED,
9f5f3c147950 Added reject and hangup states to the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26235
diff changeset
1294 NULL, NULL);
26264
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1295 purple_media_end(media, NULL, NULL);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1296 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1297
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1298 void
26264
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1299 purple_media_end(PurpleMedia *media,
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1300 const gchar *session_id, const gchar *participant)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1301 {
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1302 if (session_id == NULL && participant == NULL) {
26264
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1303 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1304 0, PURPLE_MEDIA_STATE_CHANGED_END,
c062fc1f212f Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26263
diff changeset
1305 NULL, NULL);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1306 g_object_unref(media);
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1307 }
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1308 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
1309
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1310 GList*
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1311 purple_media_get_devices(const gchar *plugin)
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1312 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1313 GObjectClass *klass;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1314 GstPropertyProbe *probe;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1315 const GParamSpec *pspec;
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1316 GstElement *element = gst_element_factory_make(plugin, NULL);
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1317 GstElementFactory *factory;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1318 const gchar *longname = NULL;
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1319 GList *ret = NULL;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1320
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1321 if (element == NULL)
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1322 return NULL;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1323
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1324 factory = gst_element_get_factory(element);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1325
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1326 longname = gst_element_factory_get_longname(factory);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1327 klass = G_OBJECT_GET_CLASS(element);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1328
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1329 if (!g_object_class_find_property (klass, "device") ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1330 !GST_IS_PROPERTY_PROBE (element) ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1331 !(probe = GST_PROPERTY_PROBE (element)) ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1332 !(pspec = gst_property_probe_get_property (probe, "device"))) {
23699
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
1333 purple_debug_info("media", "Found source '%s' (%s) - no device\n",
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1334 longname, GST_PLUGIN_FEATURE (factory)->name);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1335 } else {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1336 gint n;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1337 gchar *name;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1338 GValueArray *array;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1339
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1340 purple_debug_info("media", "Found devices\n");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1341
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1342 /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1343 if (g_object_class_find_property (klass, "autoprobe")) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1344 g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1345 if (g_object_class_find_property (klass, "autoprobe-fps")) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1346 g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1347 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1348 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1349
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1350 array = gst_property_probe_probe_and_get_values (probe, pspec);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1351 if (array != NULL) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1352 for (n = 0 ; n < array->n_values ; n++) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1353 GValue *device = g_value_array_get_nth (array, n);
26125
17cbd1af89d3 Simplify device API. Use gchar* instead of GValue.
Michael Ruprecht <maiku@pidgin.im>
parents: 26124
diff changeset
1354
17cbd1af89d3 Simplify device API. Use gchar* instead of GValue.
Michael Ruprecht <maiku@pidgin.im>
parents: 26124
diff changeset
1355 ret = g_list_append(ret, g_value_dup_string(device));
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1356
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1357 g_object_set(G_OBJECT(element), "device",
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1358 g_value_get_string(device), NULL);
26131
5b1937e15c58 Removed several PurpleMedia functions that now seem unnecessary:
Michael Ruprecht <maiku@pidgin.im>
parents: 26129
diff changeset
1359 g_object_get(G_OBJECT(element), "device-name", &name, NULL);
23699
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
1360 purple_debug_info("media", "Found source '%s' (%s) - device '%s' (%s)\n",
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
1361 longname, GST_PLUGIN_FEATURE (factory)->name,
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
1362 name, g_value_get_string(device));
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
1363 g_free(name);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1364 }
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
1365 g_value_array_free(array);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1366 }
26122
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1367
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1368 /* Restore autoprobe[-fps] to TRUE. */
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1369 if (g_object_class_find_property (klass, "autoprobe")) {
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1370 g_object_set (G_OBJECT (element), "autoprobe", TRUE, NULL);
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1371 if (g_object_class_find_property (klass, "autoprobe-fps")) {
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1372 g_object_set (G_OBJECT (element), "autoprobe-fps", TRUE, NULL);
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1373 }
51a3f29ecf01 Restore autoprobe property when finished probing for devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1374 }
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1375 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1376
26135
b7e6a25f1771 Simplified purple_media_get_devices.
Michael Ruprecht <maiku@pidgin.im>
parents: 26134
diff changeset
1377 gst_object_unref(element);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1378 return ret;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1379 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1380
26125
17cbd1af89d3 Simplify device API. Use gchar* instead of GValue.
Michael Ruprecht <maiku@pidgin.im>
parents: 26124
diff changeset
1381 gchar *
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1382 purple_media_element_get_device(GstElement *element)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1383 {
26125
17cbd1af89d3 Simplify device API. Use gchar* instead of GValue.
Michael Ruprecht <maiku@pidgin.im>
parents: 26124
diff changeset
1384 gchar *device;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1385 g_object_get(G_OBJECT(element), "device", &device, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1386 return device;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1387 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1388
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1389 void
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1390 purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1391 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1392 GstElement *src;
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1393 GstElement *volume;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1394 GstPad *pad;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1395 GstPad *ghost;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1396 const gchar *audio_device = purple_prefs_get_string("/purple/media/audio/device");
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1397 double input_volume = purple_prefs_get_int("/purple/media/audio/volume/input")/10.0;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1398
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1399 *sendbin = gst_bin_new("purplesendaudiobin");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1400 src = gst_element_factory_make("alsasrc", "asrc");
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1401 volume = gst_element_factory_make("volume", "purpleaudioinputvolume");
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1402 g_object_set(volume, "volume", input_volume, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1403 *sendlevel = gst_element_factory_make("level", "sendlevel");
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1404 gst_bin_add_many(GST_BIN(*sendbin), src, volume, *sendlevel, NULL);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1405 gst_element_link(src, volume);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1406 gst_element_link(volume, *sendlevel);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1407 pad = gst_element_get_pad(*sendlevel, "src");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1408 ghost = gst_ghost_pad_new("ghostsrc", pad);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1409 gst_element_add_pad(*sendbin, ghost);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1410 g_object_set(G_OBJECT(*sendlevel), "message", TRUE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1411
26131
5b1937e15c58 Removed several PurpleMedia functions that now seem unnecessary:
Michael Ruprecht <maiku@pidgin.im>
parents: 26129
diff changeset
1412 if (audio_device != NULL && strcmp(audio_device, ""))
5b1937e15c58 Removed several PurpleMedia functions that now seem unnecessary:
Michael Ruprecht <maiku@pidgin.im>
parents: 26129
diff changeset
1413 g_object_set(G_OBJECT(src), "device", audio_device, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1414 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1415
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1416 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1417 purple_media_video_init_src(GstElement **sendbin)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1418 {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
1419 GstElement *src, *tee, *queue;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1420 GstPad *pad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1421 GstPad *ghost;
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1422 const gchar *video_plugin = purple_prefs_get_string(
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1423 "/purple/media/video/plugin");
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1424 const gchar *video_device = purple_prefs_get_string(
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1425 "/purple/media/video/device");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1426
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1427 *sendbin = gst_bin_new("purplesendvideobin");
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1428 src = gst_element_factory_make(video_plugin, "purplevideosource");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1429 gst_bin_add(GST_BIN(*sendbin), src);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1430
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1431 tee = gst_element_factory_make("tee", "purplevideosrctee");
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1432 gst_bin_add(GST_BIN(*sendbin), tee);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1433 gst_element_link(src, tee);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1434
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1435 queue = gst_element_factory_make("queue", NULL);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1436 gst_bin_add(GST_BIN(*sendbin), queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1437 gst_element_link(tee, queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1438
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1439 if (!strcmp(video_plugin, "videotestsrc")) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1440 /* unless is-live is set to true it doesn't throttle videotestsrc */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1441 g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1442 }
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
1443
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1444 pad = gst_element_get_static_pad(queue, "src");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1445 ghost = gst_ghost_pad_new("ghostsrc", pad);
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1446 gst_object_unref(pad);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1447 gst_element_add_pad(*sendbin, ghost);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1448
26131
5b1937e15c58 Removed several PurpleMedia functions that now seem unnecessary:
Michael Ruprecht <maiku@pidgin.im>
parents: 26129
diff changeset
1449 if (video_device != NULL && strcmp(video_device, ""))
5b1937e15c58 Removed several PurpleMedia functions that now seem unnecessary:
Michael Ruprecht <maiku@pidgin.im>
parents: 26129
diff changeset
1450 g_object_set(G_OBJECT(src), "device", video_device, NULL);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1451 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1452
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1453 void
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1454 purple_media_audio_init_recv(GstElement **recvbin, GstElement **recvlevel)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1455 {
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1456 GstElement *sink, *volume;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1457 GstPad *pad, *ghost;
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1458 double output_volume = purple_prefs_get_int(
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1459 "/purple/media/audio/volume/output")/10.0;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1460
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1461 *recvbin = gst_bin_new("pidginrecvaudiobin");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1462 sink = gst_element_factory_make("alsasink", "asink");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1463 g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1464 volume = gst_element_factory_make("volume", "purpleaudiooutputvolume");
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1465 g_object_set(volume, "volume", output_volume, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1466 *recvlevel = gst_element_factory_make("level", "recvlevel");
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1467 gst_bin_add_many(GST_BIN(*recvbin), sink, volume, *recvlevel, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1468 gst_element_link(*recvlevel, sink);
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1469 gst_element_link(volume, *recvlevel);
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1470 pad = gst_element_get_pad(volume, "sink");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1471 ghost = gst_ghost_pad_new("ghostsink", pad);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1472 gst_element_add_pad(*recvbin, ghost);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1473 g_object_set(G_OBJECT(*recvlevel), "message", TRUE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1474 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
1475
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1476 void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1477 purple_media_video_init_recv(GstElement **recvbin)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1478 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1479 GstElement *sink;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1480 GstPad *pad, *ghost;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1481
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
1482 *recvbin = gst_bin_new("fakebin");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
1483 sink = gst_element_factory_make("fakesink", NULL);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1484 gst_bin_add(GST_BIN(*recvbin), sink);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1485 pad = gst_element_get_pad(sink, "sink");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1486 ghost = gst_ghost_pad_new("ghostsink", pad);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1487 gst_element_add_pad(*recvbin, ghost);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1488 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1489
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1490 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1491 purple_media_new_local_candidate_cb(FsStream *stream,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1492 FsCandidate *local_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1493 PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1494 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1495 gchar *name;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1496 FsParticipant *participant;
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1497 PurpleMediaCandidate *candidate;
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1498 purple_debug_info("media", "got new local candidate: %s\n", local_candidate->foundation);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1499 g_object_get(stream, "participant", &participant, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1500 g_object_get(participant, "cname", &name, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1501 g_object_unref(participant);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1502
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1503 purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1504
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1505 candidate = purple_media_candidate_from_fs(local_candidate);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1506 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
1507 0, session->id, name, candidate);
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1508 purple_media_candidate_free(candidate);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1509
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1510 g_free(name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1511 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1512
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1513 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1514 purple_media_candidates_prepared_cb(FsStream *stream, PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1515 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1516 gchar *name;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1517 FsParticipant *participant;
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1518 PurpleMediaStream *stream_data;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1519
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1520 g_object_get(stream, "participant", &participant, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1521 g_object_get(participant, "cname", &name, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1522 g_object_unref(participant);
26189
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1523
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1524 stream_data = purple_media_get_stream(session->media, session->id, name);
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1525 stream_data->candidates_prepared = TRUE;
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1526
32cf2cf21fd6 Implement a new ready signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26187
diff changeset
1527 purple_media_emit_ready(session->media, session, name);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1528 g_free(name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1529 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1530
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1531 /* callback called when a pair of transport candidates (local and remote)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1532 * has been established */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1533 static void
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1534 purple_media_candidate_pair_established_cb(FsStream *fsstream,
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1535 FsCandidate *native_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1536 FsCandidate *remote_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1537 PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1538 {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1539 gchar *name;
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1540 FsParticipant *participant;
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1541 PurpleMediaStream *stream;
26116
41f7d4545566 Fixed a ton of memory leaks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26115
diff changeset
1542
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1543 g_object_get(fsstream, "participant", &participant, NULL);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1544 g_object_get(participant, "cname", &name, NULL);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1545 g_object_unref(participant);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1546
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1547 stream = purple_media_get_stream(session->media, session->id, name);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1548
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1549 stream->local_candidate = fs_candidate_copy(native_candidate);
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1550 stream->remote_candidate = fs_candidate_copy(remote_candidate);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1551
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1552 purple_debug_info("media", "candidate pair established\n");
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1553 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1554
26234
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1555 static gboolean
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1556 purple_media_connected_cb(PurpleMediaStream *stream)
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1557 {
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1558 g_signal_emit(stream->session->media,
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1559 purple_media_signals[STATE_CHANGED],
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1560 0, PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1561 stream->session->id, stream->participant);
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1562 return FALSE;
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1563 }
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1564
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1565 static void
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1566 purple_media_src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1567 FsCodec *codec, PurpleMediaStream *stream)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1568 {
26151
218a4f61cf0d Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents: 26148
diff changeset
1569 PurpleMediaSessionType type = purple_media_from_fs(codec->media_type, FS_DIRECTION_RECV);
218a4f61cf0d Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents: 26148
diff changeset
1570 GstPad *sinkpad = NULL;
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1571
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
1572 if (stream->sink == NULL)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
1573 stream->sink = purple_media_manager_get_element(
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1574 purple_media_manager_get(), type);
26151
218a4f61cf0d Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents: 26148
diff changeset
1575
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26270
diff changeset
1576 gst_bin_add(GST_BIN(stream->session->media->priv->confbin),
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1577 stream->sink);
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1578 sinkpad = gst_element_get_static_pad(stream->sink, "ghostsink");
26234
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1579 gst_pad_link(srcpad, sinkpad);
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1580 gst_element_set_state(stream->sink, GST_STATE_PLAYING);
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1581
26234
b94d1e8250a1 Fix some crashes from printing debug messages on a separate thread.
Michael Ruprecht <maiku@pidgin.im>
parents: 26232
diff changeset
1582 g_timeout_add(0, (GSourceFunc)purple_media_connected_cb, stream);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1583 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1584
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1585 static gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1586 purple_media_add_stream_internal(PurpleMedia *media, const gchar *sess_id,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1587 const gchar *who, FsMediaType type,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1588 FsStreamDirection type_direction,
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1589 const gchar *transmitter,
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1590 guint num_params, GParameter *params)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1591 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1592 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1593 FsParticipant *participant = NULL;
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1594 PurpleMediaStream *stream = NULL;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1595 FsStreamDirection *direction = NULL;
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1596 PurpleMediaSessionType session_type;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1597
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1598 if (!session) {
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1599 GError *err = NULL;
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1600 GList *codec_conf = NULL;
26148
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1601 gchar *filename = NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1602
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1603 session = g_new0(PurpleMediaSession, 1);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1604
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1605 session->session = fs_conference_new_session(media->priv->conference, type, &err);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1606
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1607 if (err != NULL) {
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26181
diff changeset
1608 purple_media_error(media, "Error creating session: %s\n", err->message);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1609 g_error_free(err);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1610 g_free(session);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1611 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1612 }
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1613
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1614 /* XXX: SPEEX has a latency of 5 or 6 seconds for me */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1615 #if 0
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1616 /* SPEEX is added through the configuration */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1617 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1618 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1619 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1620 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1621 #endif
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1622
26148
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1623 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL);
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1624 codec_conf = fs_codec_list_from_keyfile(filename, &err);
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1625 g_free(filename);
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1626
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1627 if (err != NULL) {
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1628 purple_debug_error("media", "Error reading codec configuration file: %s\n", err->message);
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1629 g_error_free(err);
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1630 }
fd54f5fd9bcb Use a key file for Farsight 2 codec configuration.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1631
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1632 fs_session_set_codec_preferences(session->session, codec_conf, NULL);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1633
26180
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1634 /*
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1635 * Removes a 5-7 second delay before
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1636 * receiving the src-pad-added signal.
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1637 * Only works for non-multicast FsRtpSessions.
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1638 */
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1639 if (!strcmp(transmitter, "nice") || !strcmp(transmitter, "rawudp"))
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1640 g_object_set(G_OBJECT(session->session),
7ee4ef9150fd Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Michael Ruprecht <maiku@pidgin.im>
parents: 26179
diff changeset
1641 "no-rtcp-timeout", 0, NULL);
23726
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1642
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1643 fs_codec_list_destroy(codec_conf);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1644
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1645 session->id = g_strdup(sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1646 session->media = media;
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1647 session->type = purple_media_from_fs(type, type_direction);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1648
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1649 purple_media_add_session(media, session);
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1650 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1651 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1652 session->id, NULL);
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1653
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1654 session_type = purple_media_from_fs(type, FS_DIRECTION_SEND);
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1655 purple_media_set_src(media, session->id,
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1656 purple_media_manager_get_element(
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1657 purple_media_manager_get(), session_type));
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
1658 gst_element_set_state(session->src, GST_STATE_PLAYING);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1659 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1660
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1661 if (!(participant = purple_media_add_participant(media, who))) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1662 purple_media_remove_session(media, session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1663 g_free(session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1664 return FALSE;
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1665 } else {
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1666 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1667 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1668 NULL, who);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1669 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1670
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1671 stream = purple_media_get_stream(media, sess_id, who);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1672
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1673 if (!stream) {
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1674 GError *err = NULL;
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1675 FsStream *fsstream = NULL;
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 26253
diff changeset
1676 const gchar *stun_ip = purple_network_get_stun_ip();
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1677 const gchar *turn_ip = purple_network_get_turn_ip();
26262
1ad96aa2e92a Removed some extra tabs on blank lines
Marcus Lundblad <malu@pidgin.im>
parents: 26261
diff changeset
1678
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1679 if (stun_ip || turn_ip) {
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1680 guint new_num_params =
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1681 stun_ip && turn_ip ? num_params + 2 : num_params + 1;
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1682 guint next_param_index = num_params;
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1683 GParameter *param = g_new0(GParameter, new_num_params);
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1684 memcpy(param, params, sizeof(GParameter) * num_params);
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1685
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1686 if (stun_ip) {
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1687 purple_debug_info("media",
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1688 "setting property stun-ip on new stream: %s\n", stun_ip);
26262
1ad96aa2e92a Removed some extra tabs on blank lines
Marcus Lundblad <malu@pidgin.im>
parents: 26261
diff changeset
1689
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1690 param[next_param_index].name = "stun-ip";
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1691 g_value_init(&param[next_param_index].value, G_TYPE_STRING);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1692 g_value_set_string(&param[next_param_index].value, stun_ip);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1693 next_param_index++;
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1694 }
26262
1ad96aa2e92a Removed some extra tabs on blank lines
Marcus Lundblad <malu@pidgin.im>
parents: 26261
diff changeset
1695
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1696 if (turn_ip) {
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1697 GValueArray *relay_info = g_value_array_new(0);
26263
725845e88ebf Removed a couple of warnings
Marcus Lundblad <malu@pidgin.im>
parents: 26262
diff changeset
1698 GValue value;
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1699 gint turn_port =
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1700 purple_prefs_get_int("/purple/network/turn_port");
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1701 const gchar *username =
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1702 purple_prefs_get_string("/purple/network/turn_username");
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1703 const gchar *password =
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1704 purple_prefs_get_string("/purple/network/turn_password");
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1705 GstStructure *turn_setup = gst_structure_new("relay-info",
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1706 "ip", G_TYPE_STRING, turn_ip,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1707 "port", G_TYPE_UINT, turn_port,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1708 "username", G_TYPE_STRING, username,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1709 "password", G_TYPE_STRING, password,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1710 NULL);
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1711
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1712 if (turn_setup) {
26263
725845e88ebf Removed a couple of warnings
Marcus Lundblad <malu@pidgin.im>
parents: 26262
diff changeset
1713 memset(&value, 0, sizeof(GValue));
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1714 g_value_init(&value, GST_TYPE_STRUCTURE);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1715 gst_value_set_structure(&value, turn_setup);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1716 relay_info = g_value_array_append(relay_info, &value);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1717 gst_structure_free(turn_setup);
26262
1ad96aa2e92a Removed some extra tabs on blank lines
Marcus Lundblad <malu@pidgin.im>
parents: 26261
diff changeset
1718
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1719 purple_debug_info("media",
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1720 "setting property relay-info on new stream\n");
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1721 param[next_param_index].name = "relay-info";
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1722 g_value_init(&param[next_param_index].value,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1723 G_TYPE_VALUE_ARRAY);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1724 g_value_set_boxed(&param[next_param_index].value,
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1725 relay_info);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1726 g_value_array_free(relay_info);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1727 } else {
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1728 purple_debug_error("media", "Error relay info");
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1729 g_object_unref(participant);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1730 g_hash_table_remove(media->priv->participants, who);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1731 purple_media_remove_session(media, session);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1732 g_free(session);
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1733 return FALSE;
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1734 }
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1735 }
26262
1ad96aa2e92a Removed some extra tabs on blank lines
Marcus Lundblad <malu@pidgin.im>
parents: 26261
diff changeset
1736
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1737 fsstream = fs_session_new_stream(session->session,
26257
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1738 participant, type_direction &
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1739 FS_DIRECTION_RECV, transmitter,
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26259
diff changeset
1740 new_num_params, param, &err);
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1741 g_free(param);
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1742 } else {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1743 fsstream = fs_session_new_stream(session->session,
26257
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1744 participant, type_direction &
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1745 FS_DIRECTION_RECV, transmitter,
e4a840dab1d4 Use the stream's direction to wait to send media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26256
diff changeset
1746 num_params, params, &err);
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1747 }
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1748
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1749 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1750 purple_debug_error("media", "Error creating stream: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1751 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1752 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1753 g_object_unref(participant);
26129
18c8f2cfb52b Properly free PurpleMedia when there's an error creating an FsStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26125
diff changeset
1754 g_hash_table_remove(media->priv->participants, who);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1755 purple_media_remove_session(media, session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1756 g_free(session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1757 return FALSE;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1758 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1759
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1760 stream = purple_media_insert_stream(session, who, fsstream);
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1761
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1762 /* callback for source pad added (new stream source ready) */
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1763 g_signal_connect(G_OBJECT(fsstream),
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1764 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), stream);
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1765
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1766 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1767 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1768 session->id, who);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1769 } else if (*direction != type_direction) {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1770 /* change direction */
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1771 g_object_set(stream->stream, "direction", type_direction, NULL);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1772 }
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1773
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1774 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1775 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1776
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1777 gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1778 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
1779 PurpleMediaSessionType type,
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1780 const gchar *transmitter,
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1781 guint num_params, GParameter *params)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1782 {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1783 FsStreamDirection type_direction;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1784
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1785 if (type & PURPLE_MEDIA_AUDIO) {
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1786 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_AUDIO);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1787
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1788 if (!purple_media_add_stream_internal(media, sess_id, who,
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1789 FS_MEDIA_TYPE_AUDIO, type_direction,
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1790 transmitter, num_params, params)) {
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1791 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1792 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1793 }
26134
2def4b29fcfe purple_media_add_stream should only add a stream to one session.
Michael Ruprecht <maiku@pidgin.im>
parents: 26133
diff changeset
1794 else if (type & PURPLE_MEDIA_VIDEO) {
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1795 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_VIDEO);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1796
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1797 if (!purple_media_add_stream_internal(media, sess_id, who,
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1798 FS_MEDIA_TYPE_VIDEO, type_direction,
26133
a12ffee5bd73 Add params to purple_media_add_stream to allow for different libNice
Michael Ruprecht <maiku@pidgin.im>
parents: 26132
diff changeset
1799 transmitter, num_params, params)) {
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1800 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1801 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1802 }
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1803 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1804 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1805
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1806 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1807 purple_media_remove_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1808 {
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
1809 /* Add state-changed end emits in here when this is implemented */
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1810 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1811
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
1812 PurpleMediaSessionType
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1813 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1814 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1815 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1816 return session->type;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1817 }
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1818 /* XXX: Should wait until codecs-ready is TRUE before using this function */
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1819 GList *
26160
46bc5e18d59c Combine get_*_codecs functions to mirror Farsight 2.
Michael Ruprecht <maiku@pidgin.im>
parents: 26151
diff changeset
1820 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1821 {
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1822 GList *fscodecs;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1823 GList *codecs;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1824 g_object_get(G_OBJECT(purple_media_get_session(media, sess_id)->session),
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1825 "codecs", &fscodecs, NULL);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1826 codecs = purple_media_codec_list_from_fs(fscodecs);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1827 fs_codec_list_destroy(fscodecs);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1828 return codecs;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1829 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1830
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1831 GList *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1832 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1833 {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1834 PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1835 return purple_media_candidate_list_from_fs(stream->local_candidates);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1836 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1837
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1838 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1839 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1840 const gchar *name, GList *remote_candidates)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1841 {
26200
6636bcf92be3 Add candidates instead of replacing them.
Michael Ruprecht <maiku@pidgin.im>
parents: 26195
diff changeset
1842 PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
26258
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1843 GError *err = NULL;
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1844
26200
6636bcf92be3 Add candidates instead of replacing them.
Michael Ruprecht <maiku@pidgin.im>
parents: 26195
diff changeset
1845 stream->remote_candidates = g_list_concat(stream->remote_candidates,
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1846 purple_media_candidate_list_to_fs(remote_candidates));
26121
8b548a0ea68e Update to Farsight2 0.0.3.
Michael Ruprecht <maiku@pidgin.im>
parents: 26120
diff changeset
1847
26258
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1848 fs_stream_set_remote_candidates(stream->stream,
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1849 stream->remote_candidates, &err);
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1850
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1851 if (err) {
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1852 purple_debug_error("media", "Error adding remote"
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1853 " candidates: %s\n", err->message);
9cfc01913beb Set remote candidates as soon as they are received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26257
diff changeset
1854 g_error_free(err);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1855 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1856 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1857
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1858 PurpleMediaCandidate *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1859 purple_media_get_local_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1860 {
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1861 return purple_media_candidate_from_fs(purple_media_get_stream(
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1862 media, sess_id, name)->local_candidate);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1863 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1864
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1865 PurpleMediaCandidate *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1866 purple_media_get_remote_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1867 {
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1868 return purple_media_candidate_from_fs(purple_media_get_stream(
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26228
diff changeset
1869 media, sess_id, name)->remote_candidate);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1870 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1871
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1872 gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1873 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1874 {
26163
df72970bffc6 Move variables to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26162
diff changeset
1875 FsStream *stream = purple_media_get_stream(media, sess_id, name)->stream;
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1876 GList *fscodecs = purple_media_codec_list_to_fs(codecs);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1877 GError *err = NULL;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1878
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1879 fs_stream_set_remote_codecs(stream, fscodecs, &err);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1880 fs_codec_list_destroy(fscodecs);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1881
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1882 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1883 purple_debug_error("media", "Error setting remote codecs: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1884 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1885 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1886 return FALSE;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1887 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1888 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1889 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1890
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1891 gboolean
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1892 purple_media_candidates_prepared(PurpleMedia *media, const gchar *name)
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1893 {
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1894 GList *sessions = purple_media_get_session_names(media);
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1895
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1896 for (; sessions; sessions = sessions->next) {
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1897 const gchar *session = sessions->data;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1898 if (!purple_media_get_local_candidate(media, session, name) ||
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1899 !purple_media_get_remote_candidate(media, session, name))
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1900 return FALSE;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1901 }
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1902
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1903 return TRUE;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1904 }
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1905
26102
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1906 gboolean
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1907 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec)
26102
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1908 {
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1909 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1910 FsCodec *fscodec = purple_media_codec_to_fs(codec);
26102
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1911 GError *err = NULL;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1912
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1913 fs_session_set_send_codec(session->session, fscodec, &err);
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26231
diff changeset
1914 fs_codec_destroy(fscodec);
26102
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1915
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1916 if (err) {
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1917 purple_debug_error("media", "Error setting send codec\n");
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1918 g_error_free(err);
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1919 return FALSE;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1920 }
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1921 return TRUE;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1922 }
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1923
26137
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1924 gboolean
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1925 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1926 {
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1927 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1928 gboolean ret;
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1929 g_object_get(session->session, "codecs-ready", &ret, NULL);
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1930 return ret;
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1931 }
0688cf5221c9 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26135
diff changeset
1932
26267
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1933 gboolean
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1934 purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1935 const gchar *participant)
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1936 {
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1937 PurpleMediaSession *session =
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1938 purple_media_get_session(media, sess_id);
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1939 return session->accepted;
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1940 }
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26266
diff changeset
1941
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1942 void purple_media_mute(PurpleMedia *media, gboolean active)
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1943 {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1944 GList *sessions = g_hash_table_get_values(media->priv->sessions);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1945 purple_debug_info("media", "Turning mute %s\n", active ? "on" : "off");
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1946
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1947 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1948 PurpleMediaSession *session = sessions->data;
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1949 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1950 GstElement *volume = gst_bin_get_by_name(
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1951 GST_BIN(session->src),
26115
5f0500efc781 * Added input/output volume preferences for voice conversations.
Michael Ruprecht <maiku@pidgin.im>
parents: 26112
diff changeset
1952 "purpleaudioinputvolume");
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1953 g_object_set(volume, "mute", active, NULL);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1954 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1955 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1956 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1957
26172
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1958 void purple_media_set_input_volume(PurpleMedia *media,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1959 const gchar *session_id, double level)
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1960 {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1961 GList *sessions;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1962
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1963 if (session_id == NULL)
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1964 sessions = g_hash_table_get_values(media->priv->sessions);
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1965 else
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1966 sessions = g_list_append(NULL,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1967 purple_media_get_session(media, session_id));
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1968
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1969 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1970 PurpleMediaSession *session = sessions->data;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1971
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1972 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1973 GstElement *volume = gst_bin_get_by_name(
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1974 GST_BIN(session->src),
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1975 "purpleaudioinputvolume");
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1976 g_object_set(volume, "volume", level, NULL);
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1977 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1978 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1979 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1980
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1981 void purple_media_set_output_volume(PurpleMedia *media,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1982 const gchar *session_id, const gchar *participant,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1983 double level)
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1984 {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1985 GList *streams = purple_media_get_streams(media,
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1986 session_id, participant);
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1987
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1988 for (; streams; streams = g_list_delete_link(streams, streams)) {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1989 PurpleMediaStream *stream = streams->data;
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1990
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1991 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO) {
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1992 GstElement *volume = gst_bin_get_by_name(
26176
05f45eb5a8ed Move sink from PurpleMediaSession to PurpleMediaStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26174
diff changeset
1993 GST_BIN(stream->sink),
26172
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1994 "purpleaudiooutputvolume");
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1995 g_object_set(volume, "volume", level, NULL);
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1996 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1997 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1998 }
b14249e42983 Added media functions to set input and output volume.
Michael Ruprecht <maiku@pidgin.im>
parents: 26168
diff changeset
1999
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2000 typedef struct
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2001 {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2002 PurpleMedia *media;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2003 gchar *session_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2004 gchar *participant;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2005 gulong handler_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2006 } PurpleMediaXOverlayData;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2007
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2008 static void
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2009 window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaXOverlayData *data)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2010 {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2011 gchar *name;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2012 gchar *cmpname;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2013 gulong window_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2014 gboolean set = FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2015
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2016 if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT ||
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2017 !gst_structure_has_name(msg->structure,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2018 "prepare-xwindow-id"))
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2019 return;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2020
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2021 name = gst_object_get_name(GST_MESSAGE_SRC(msg));
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2022
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2023 if (data->participant == NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2024 cmpname = g_strdup_printf("session-sink_%s",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2025 data->session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2026 if (!strncmp(name, cmpname, strlen(cmpname))) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2027 PurpleMediaSession *session =
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2028 purple_media_get_session(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2029 data->media, data->session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2030 if (session != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2031 window_id = session->window_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2032 set = TRUE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2033 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2034 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2035 } else {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2036 cmpname = g_strdup_printf("stream-sink_%s_%s",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2037 data->session_id, data->participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2038
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2039 if (!strncmp(name, cmpname, strlen(cmpname))) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2040 PurpleMediaStream *stream =
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2041 purple_media_get_stream(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2042 data->media, data->session_id,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2043 data->participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2044 if (stream != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2045 window_id = stream->window_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2046 set = TRUE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2047 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2048 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2049 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2050 g_free(cmpname);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2051 g_free(name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2052
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2053 if (set == TRUE) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2054 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2055 purple_media_get_pipeline(data->media)));
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2056 g_signal_handler_disconnect(bus, data->handler_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2057 gst_object_unref(bus);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2058
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2059 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2060 GST_MESSAGE_SRC(msg)), window_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2061
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2062 g_free(data->session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2063 g_free(data->participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2064 g_free(data);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2065 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2066
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2067 return;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2068 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2069
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2070 gboolean
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2071 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2072 const gchar *participant, gulong window_id)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2073 {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2074
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2075 if (session_id != NULL && participant == NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2076
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2077 PurpleMediaSession *session;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2078 session = purple_media_get_session(media, session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2079
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2080 if (session == NULL)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2081 return FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2082
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2083 session->window_id = window_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2084
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2085 if (session->sink == NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2086 GstBus *bus;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2087 GstElement *tee, *bin, *queue, *sink;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2088 GstPad *request_pad, *sinkpad, *ghostpad;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2089 gchar *name;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2090
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2091 /* Create callback for prepared-xwindow-id signal */
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2092 PurpleMediaXOverlayData *data =
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2093 g_new0(PurpleMediaXOverlayData, 1);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2094 data->media = media;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2095 data->session_id = g_strdup(session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2096 data->participant = g_strdup(participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2097
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2098 bus = gst_pipeline_get_bus(GST_PIPELINE(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2099 purple_media_get_pipeline(media)));
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2100 data->handler_id = g_signal_connect(bus,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2101 "sync-message::element",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2102 G_CALLBACK(window_id_cb), data);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2103 gst_object_unref(bus);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2104
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2105 /* Create sink */
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2106 tee = gst_bin_get_by_name(GST_BIN(session->src),
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2107 "purplevideosrctee");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2108 bin = gst_bin_new(NULL);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2109 gst_bin_add(GST_BIN(GST_ELEMENT_PARENT(tee)), bin);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2110
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2111 queue = gst_element_factory_make("queue", NULL);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2112 name = g_strdup_printf(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2113 "session-sink_%s", session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2114 sink = gst_element_factory_make(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2115 "autovideosink", name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2116 g_free(name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2117
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2118 gst_bin_add_many(GST_BIN(bin), queue, sink, NULL);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2119 gst_element_link(queue, sink);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2120
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2121 sinkpad = gst_element_get_static_pad(queue, "sink");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2122 ghostpad = gst_ghost_pad_new("ghostsink", sinkpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2123 gst_object_unref(sinkpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2124 gst_element_add_pad(bin, ghostpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2125
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2126 gst_element_set_state(bin, GST_STATE_PLAYING);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2127
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2128 request_pad = gst_element_get_request_pad(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2129 tee, "src%d");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2130 gst_pad_link(request_pad, ghostpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2131 gst_object_unref(request_pad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2132
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2133 session->sink = bin;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2134 return TRUE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2135 } else {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2136 /* Changing the XOverlay output window */
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2137 GstElement *xoverlay = gst_bin_get_by_interface(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2138 GST_BIN(session->sink),
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2139 GST_TYPE_X_OVERLAY);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2140 if (xoverlay != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2141 gst_x_overlay_set_xwindow_id(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2142 GST_X_OVERLAY(xoverlay),
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2143 window_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2144 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2145 return FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2146 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2147 } else if (session_id != NULL && participant != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2148 PurpleMediaStream *stream = purple_media_get_stream(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2149 media, session_id, participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2150 GstBus *bus;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2151 GstElement *bin, *sink;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2152 GstPad *pad, *peer = NULL, *ghostpad;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2153 PurpleMediaXOverlayData *data;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2154 gchar *name;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2155
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2156 if (stream == NULL)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2157 return FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2158
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2159 stream->window_id = window_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2160
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2161 if (stream->sink != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2162 gboolean is_fakebin;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2163 name = gst_element_get_name(stream->sink);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2164 is_fakebin = !strcmp(name, "fakebin");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2165 g_free(name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2166
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2167 if (is_fakebin) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2168 pad = gst_element_get_static_pad(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2169 stream->sink, "ghostsink");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2170 peer = gst_pad_get_peer(pad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2171
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2172 gst_pad_unlink(peer, pad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2173 gst_object_unref(pad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2174 gst_element_set_state(stream->sink,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2175 GST_STATE_NULL);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2176 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2177 stream->sink)), stream->sink);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2178 } else {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2179 /* Changing the XOverlay output window */
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2180 GstElement *xoverlay =
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2181 gst_bin_get_by_interface(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2182 GST_BIN(stream->sink),
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2183 GST_TYPE_X_OVERLAY);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2184 if (xoverlay != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2185 gst_x_overlay_set_xwindow_id(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2186 GST_X_OVERLAY(xoverlay),
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2187 window_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2188 return TRUE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2189 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2190 return FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2191 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2192 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2193
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2194 data = g_new0(PurpleMediaXOverlayData, 1);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2195 data->media = media;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2196 data->session_id = g_strdup(session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2197 data->participant = g_strdup(participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2198
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2199 bus = gst_pipeline_get_bus(GST_PIPELINE(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2200 purple_media_get_pipeline(media)));
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2201 data->handler_id = g_signal_connect(bus,
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2202 "sync-message::element",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2203 G_CALLBACK(window_id_cb), data);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2204 gst_object_unref(bus);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2205
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2206 bin = gst_bin_new(NULL);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2207
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2208 if (stream->sink != NULL)
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2209 gst_bin_add(GST_BIN(GST_ELEMENT_PARENT(
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2210 stream->sink)), bin);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2211
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2212 name = g_strdup_printf("stream-sink_%s_%s",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2213 session_id, participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2214 sink = gst_element_factory_make("autovideosink", name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2215 g_free(name);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2216
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2217 gst_bin_add(GST_BIN(bin), sink);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2218 pad = gst_element_get_static_pad(sink, "sink");
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2219 ghostpad = gst_ghost_pad_new("ghostsink", pad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2220 gst_element_add_pad(bin, ghostpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2221
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2222 if (stream->sink != NULL) {
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2223 gst_element_set_state(bin, GST_STATE_PLAYING);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2224 gst_pad_link(peer, ghostpad);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2225 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2226
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2227 stream->sink = bin;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2228 return TRUE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2229 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2230 return FALSE;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2231 }
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26258
diff changeset
2232
23704
9b88c9b23aed Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents: 23701
diff changeset
2233 #endif /* USE_VV */

mercurial