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