annotate libpurple/media.c @ 26365:abcc94ace5ea

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