annotate libpurple/media.c @ 26041:68ebba87143b

merge of '403c70a10f0947c6a968f38acae33715ffad2fce' and 'dca923f5c49ff1a1638b3ac1529f82d846737578'
author Marcus Lundblad <ml@update.uu.se>
date Sat, 10 Jan 2009 01:27:48 +0000
parents 8b54456cba97 81e34828a9da
children e5f9cf20c4aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
2 * @file media.c Media API
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
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
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
29 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
30
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "connection.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "media.h"
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
33 #include "marshallers.h"
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
34 #include "mediamanager.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
36 #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
37
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
38 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
40 #include <gst/interfaces/propertyprobe.h>
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
41 #include <gst/farsight/fs-conference-iface.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
43 /** @copydoc _PurpleMediaSession */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
44 typedef struct _PurpleMediaSession PurpleMediaSession;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
45 /** @copydoc _PurpleMediaStream */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
46 typedef struct _PurpleMediaStream PurpleMediaStream;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
47
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
48 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
49 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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 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
51 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
52 GstElement *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
53 FsSession *session;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
54
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
55 PurpleMediaSessionType type;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
56
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
57 gboolean codecs_ready;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
58 gboolean accepted;
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
59 };
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
61 struct _PurpleMediaStream
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
62 {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
63 PurpleMediaSession *session;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
64 gchar *participant;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
65 FsStream *stream;
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
66 GstElement *sink;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
67
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
68 GList *local_candidates;
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
69 GList *remote_candidates;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
70
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
71 gboolean candidates_prepared;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
72
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
73 FsCandidate *local_candidate;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
74 FsCandidate *remote_candidate;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
75 };
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
76
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 struct _PurpleMediaPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 {
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
79 FsConference *conference;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
80 gboolean initiator;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
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
82 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
83 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
84
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
85 GList *streams; /* PurpleMediaStream table */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
86
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
87 GstElement *pipeline;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
88
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 static void purple_media_class_init (PurpleMediaClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 static void purple_media_init (PurpleMedia *media);
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
95 static void purple_media_dispose (GObject *object);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 static void purple_media_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
100 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
101 FsCandidate *local_candidate, PurpleMediaSession *session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
102 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
103 PurpleMediaSession *session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
104 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
105 FsCandidate *native_candidate, FsCandidate *remote_candidate,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
106 PurpleMediaSession *session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
107
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 enum {
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
113 ERROR,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
114 READY,
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
115 WAIT,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
116 ACCEPTED,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
117 HANGUP,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
118 REJECT,
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
119 GOT_REQUEST,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
120 GOT_HANGUP,
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
121 GOT_ACCEPT,
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
122 NEW_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
123 CANDIDATES_PREPARED,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
124 CANDIDATE_PAIR,
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
125 CODECS_READY,
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
126 READY_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
127 STATE_CHANGED,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 static guint purple_media_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 PROP_0,
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
134 PROP_CONFERENCE,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
135 PROP_INITIATOR,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 purple_media_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 sizeof(PurpleMediaClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 (GClassInitFunc) purple_media_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 sizeof(PurpleMedia),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
153 (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
154 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 return type;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
161 GType
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
162 purple_media_state_changed_get_type()
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
163 {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
164 static GType type = 0;
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
165 if (type == 0) {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
166 static const GEnumValue values[] = {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
167 { PURPLE_MEDIA_STATE_CHANGED_NEW, "PURPLE_MEDIA_STATE_CHANGED_NEW", "new" },
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
168 { PURPLE_MEDIA_STATE_CHANGED_CONNECTED, "PURPLE_MEDIA_STATE_CHANGED_CONNECTED", "connected" },
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
169 { PURPLE_MEDIA_STATE_CHANGED_END, "PURPLE_MEDIA_STATE_CHANGED_END", "end" },
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
170 { 0, NULL, NULL }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
171 };
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
172 type = g_enum_register_static("PurpleMediaStateChangedType", values);
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
173 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
174 return type;
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
175 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
176
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 purple_media_class_init (PurpleMediaClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
183 gobject_class->dispose = purple_media_dispose;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 gobject_class->finalize = purple_media_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 gobject_class->set_property = purple_media_set_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 gobject_class->get_property = purple_media_get_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
188 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
189 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
190 "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
191 "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
192 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
193 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
195 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
196 g_param_spec_boolean("initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
197 "initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
198 "If the local user initiated the conference.",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
199 FALSE,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
200 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
201
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
202 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
203 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
204 g_cclosure_marshal_VOID__STRING,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
205 G_TYPE_NONE, 1, 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
206 purple_media_signals[READY] = g_signal_new("ready", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
207 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
208 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
209 G_TYPE_NONE, 0);
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
210 purple_media_signals[WAIT] = g_signal_new("wait", G_TYPE_FROM_CLASS(klass),
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
211 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
212 g_cclosure_marshal_VOID__VOID,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
213 G_TYPE_NONE, 0);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
214 purple_media_signals[ACCEPTED] = g_signal_new("accepted", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
215 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
216 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
217 G_TYPE_NONE, 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
218 purple_media_signals[HANGUP] = g_signal_new("hangup", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
219 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
220 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
221 G_TYPE_NONE, 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
222 purple_media_signals[REJECT] = g_signal_new("reject", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
223 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
224 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
225 G_TYPE_NONE, 0);
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
226 purple_media_signals[GOT_REQUEST] = g_signal_new("got-request", G_TYPE_FROM_CLASS(klass),
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
227 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
228 g_cclosure_marshal_VOID__VOID,
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
229 G_TYPE_NONE, 0);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
230 purple_media_signals[GOT_HANGUP] = g_signal_new("got-hangup", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
231 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
232 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
233 G_TYPE_NONE, 0);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
234 purple_media_signals[GOT_ACCEPT] = g_signal_new("got-accept", G_TYPE_FROM_CLASS(klass),
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
235 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
236 g_cclosure_marshal_VOID__VOID,
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
237 G_TYPE_NONE, 0);
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
238 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
239 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
240 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
241 G_TYPE_NONE, 3, G_TYPE_POINTER,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
242 G_TYPE_POINTER, FS_TYPE_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
243 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
244 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
24938
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24937
diff changeset
245 purple_smarshal_VOID__STRING_STRING,
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24937
diff changeset
246 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
247 purple_media_signals[CANDIDATE_PAIR] = g_signal_new("candidate-pair", G_TYPE_FROM_CLASS(klass),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
248 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
249 purple_smarshal_VOID__BOXED_BOXED,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
250 G_TYPE_NONE, 2, FS_TYPE_CANDIDATE, FS_TYPE_CANDIDATE);
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
251 purple_media_signals[CODECS_READY] = g_signal_new("codecs-ready", G_TYPE_FROM_CLASS(klass),
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
252 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
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
253 g_cclosure_marshal_VOID__STRING,
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
254 G_TYPE_NONE, 1, G_TYPE_STRING);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
255 purple_media_signals[READY_NEW] = g_signal_new("ready-new", G_TYPE_FROM_CLASS(klass),
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
256 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
257 purple_smarshal_VOID__STRING_STRING,
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
258 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
259 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
260 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
261 purple_smarshal_VOID__ENUM_STRING_STRING,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
262 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE_CHANGED,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
263 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
264 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
267
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 purple_media_init (PurpleMedia *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
272 memset(media->priv, 0, sizeof(media->priv));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 static void
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
276 purple_media_stream_free(PurpleMediaStream *stream)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
277 {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
278 g_free(stream->participant);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
279
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
280 if (stream->local_candidates)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
281 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
282 if (stream->remote_candidates)
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
283 fs_candidate_list_destroy(stream->remote_candidates);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
284
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
285 if (stream->local_candidate)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
286 fs_candidate_destroy(stream->local_candidate);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
287 if (stream->remote_candidate)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
288 fs_candidate_destroy(stream->remote_candidate);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
289
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
290 g_free(stream);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
291 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
292
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
293 static void
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
294 purple_media_session_free(PurpleMediaSession *session)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
295 {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
296 g_free(session->id);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
297 g_free(session);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
298 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
299
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
300 static void
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
301 purple_media_dispose(GObject *media)
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
302 {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
303 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
304 GList *iter = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
305
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
306 purple_debug_info("media","purple_media_dispose\n");
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
307
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
308 purple_media_manager_remove_media(purple_media_manager_get(),
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
309 PURPLE_MEDIA(media));
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
310
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
311 if (priv->pipeline) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
312 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(priv->pipeline));
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
313 gst_bus_remove_signal_watch(bus);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
314 gst_object_unref(bus);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
315 gst_element_set_state(priv->pipeline, GST_STATE_NULL);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
316 gst_object_unref(priv->pipeline);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
317 priv->pipeline = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
318 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
319
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
320 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
321 PurpleMediaStream *stream = iter->data;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
322 if (stream->stream) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
323 g_object_unref(stream->stream);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
324 stream->stream = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
325 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
326 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
327
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
328 if (priv->sessions) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
329 GList *sessions = g_hash_table_get_values(priv->sessions);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
330 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
331 PurpleMediaSession *session = sessions->data;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
332 if (session->session) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
333 g_object_unref(session->session);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
334 session->session = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
335 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
336 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
337 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
338
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
339 if (priv->participants) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
340 GList *participants = g_hash_table_get_values(priv->participants);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
341 for (; participants; participants = g_list_delete_link(participants, participants))
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
342 g_object_unref(participants->data);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
343 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
344
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
345 G_OBJECT_CLASS(parent_class)->finalize(media);
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 static void
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
349 purple_media_finalize(GObject *media)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 {
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
351 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
352 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
353
24981
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
354 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
355 purple_media_stream_free(priv->streams->data);
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
356
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
357 if (priv->sessions) {
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
358 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
359 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
360 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
361 }
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
362 g_hash_table_destroy(priv->sessions);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
363 }
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23852
diff changeset
364
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
365 gst_object_unref(priv->conference);
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
366
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
367 G_OBJECT_CLASS(parent_class)->finalize(media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 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
375
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 switch (prop_id) {
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
379 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
380 if (media->priv->conference)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
381 g_object_unref(media->priv->conference);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
382 media->priv->conference = g_value_get_object(value);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
383 g_object_ref(media->priv->conference);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 break;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
385 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
386 media->priv->initiator = g_value_get_boolean(value);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
387 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 g_return_if_fail(PURPLE_IS_MEDIA(object));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 switch (prop_id) {
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
403 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
404 g_value_set_object(value, media->priv->conference);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 break;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
406 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
407 g_value_set_boolean(value, media->priv->initiator);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
408 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
416 FsMediaType
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
417 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
418 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
419 if (type & PURPLE_MEDIA_AUDIO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
420 return FS_MEDIA_TYPE_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
421 else if (type & PURPLE_MEDIA_VIDEO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
422 return FS_MEDIA_TYPE_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
423 else
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
424 return 0;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
425 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
426
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
427 FsStreamDirection
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
428 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
429 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
430 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
431 (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
432 return FS_DIRECTION_BOTH;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
433 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
434 (type & PURPLE_MEDIA_SEND_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
435 return FS_DIRECTION_SEND;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
436 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
437 (type & PURPLE_MEDIA_RECV_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
438 return FS_DIRECTION_RECV;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
439 else
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
440 return FS_DIRECTION_NONE;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
441 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
442
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
443 PurpleMediaSessionType
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
444 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
445 {
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
446 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
447 if (type == FS_MEDIA_TYPE_AUDIO) {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
448 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
449 result |= PURPLE_MEDIA_SEND_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
450 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
451 result |= PURPLE_MEDIA_RECV_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
452 } 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
453 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
454 result |= PURPLE_MEDIA_SEND_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
455 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
456 result |= PURPLE_MEDIA_RECV_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
457 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
458 return result;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
459 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
460
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
461 PurpleMediaSessionType
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
462 purple_media_get_overall_type(PurpleMedia *media)
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
463 {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
464 GList *values = g_hash_table_get_values(media->priv->sessions);
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
465 PurpleMediaSessionType type = PURPLE_MEDIA_NONE;
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
466
23852
a1a1f44cdecc Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23846
diff changeset
467 for (; values; values = g_list_delete_link(values, values)) {
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
468 PurpleMediaSession *session = values->data;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
469 type |= session->type;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
470 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
471
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
472 return type;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
473 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
474
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
475 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
476 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
477 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
478 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
479 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
480 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
481
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
482 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
483 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
484 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
485 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
486 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
487 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
488
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
489 static PurpleMediaStream*
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
490 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
491 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
492 GList *streams = media->priv->streams;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
493
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
494 for (; streams; streams = g_list_next(streams)) {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
495 PurpleMediaStream *stream = streams->data;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
496 if (!strcmp(stream->session->id, session) &&
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
497 !strcmp(stream->participant, participant))
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
498 return stream;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
499 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
500
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
501 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
502 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
503
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
504 static GList *
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
505 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
506 const gchar *participant)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
507 {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
508 GList *streams = media->priv->streams;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
509 GList *ret = NULL;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
510
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
511 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
512 PurpleMediaStream *stream = streams->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
513 if ((session == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
514 !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
515 (participant == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
516 !strcmp(stream->participant, participant)))
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
517 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
518 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
519
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
520 return ret;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
521 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
522
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
523 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
524 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
525 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
526 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
527 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
528 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
529 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
530 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
531 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
532
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
533 static gboolean
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
534 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
535 {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
536 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
537 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
538
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
539 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
540 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
541 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
542 FsParticipant *participant = purple_media_get_participant(media, name);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
543 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
544
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
545 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
546 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
547
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
548 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
549 (gchar*)name, &err);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
550
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
551 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
552 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
553 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
554 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
555 return NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
556 }
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
557
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
558 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
559 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
560 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
561 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
562 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
563
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
564 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
565
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
566 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
567 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
568
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
569 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
570 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
571 {
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
572 PurpleMediaStream *media_stream = g_new0(PurpleMediaStream, 1);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
573 media_stream->stream = stream;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
574 media_stream->participant = g_strdup(name);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
575 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
576
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
577 session->media->priv->streams =
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
578 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
579
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
580 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
581 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
582
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
583 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
584 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
585 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
586 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
587 PurpleMediaStream *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
588 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
589 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
590
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
591 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
592 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
593 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
594 return g_hash_table_get_keys(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
595 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
596
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
597 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
598 purple_media_get_elements(PurpleMedia *media, GstElement **audio_src, GstElement **audio_sink,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
599 GstElement **video_src, GstElement **video_sink)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
600 {
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
601 GList *values = g_hash_table_get_values(media->priv->sessions);
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
602
23852
a1a1f44cdecc Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23846
diff changeset
603 for (; values; values = g_list_delete_link(values, values)) {
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
604 PurpleMediaSession *session = (PurpleMediaSession*)values->data;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
605
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
606 if (session->type & PURPLE_MEDIA_SEND_AUDIO && audio_src)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
607 *audio_src = session->src;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
608 if (session->type & PURPLE_MEDIA_SEND_VIDEO && video_src)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
609 *video_src = session->src;
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
610 }
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
611
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
612 values = media->priv->streams;
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
613 for (; values; values = g_list_next(values)) {
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
614 PurpleMediaStream *stream = (PurpleMediaStream*)values->data;
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
615
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
616 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO && audio_sink)
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
617 *audio_sink = stream->sink;
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
618 if (stream->session->type & PURPLE_MEDIA_RECV_VIDEO && video_sink)
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
619 *video_sink = stream->sink;
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
620 }
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
621 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
622
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
623 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
624 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
625 {
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
626 PurpleMediaSession *session = purple_media_get_session(media, 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
627 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
628 GstPad *srcpad;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
629
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
630 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
631 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
632 session->src = 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
633 gst_bin_add(GST_BIN(purple_media_get_pipeline(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
634 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
635
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
636 g_object_get(session->session, "sink-pad", &sinkpad, 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
637 srcpad = gst_element_get_static_pad(src, "ghostsrc");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
638 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
639 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
640 ? "success" : "failure");
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
641 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
642
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
643 void
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
644 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
645 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
646 {
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
647 PurpleMediaStream *stream =
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
648 purple_media_get_stream(media, sess_id, participant);
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
649
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
650 if (stream->sink)
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
651 gst_object_unref(stream->sink);
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
652 stream->sink = sink;
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
653 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
654 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
655 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
656
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
657 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
658 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
659 {
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
660 return purple_media_get_session(media, sess_id)->src;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
661 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
662
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
663 GstElement *
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
664 purple_media_get_sink(PurpleMedia *media, const gchar *sess_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
665 {
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
666 return purple_media_get_stream(media, sess_id, participant)->sink;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
667 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
668
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
669 static PurpleMediaSession *
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
670 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
671 {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
672 FsSession *fssession;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
673 GList *values;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
674
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
675 g_object_get(stream, "session", &fssession, NULL);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
676
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
677 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
678
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
679 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
680 PurpleMediaSession *session = values->data;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
681
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
682 if (session->session == fssession) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
683 g_list_free(values);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
684 g_object_unref(fssession);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
685 return session;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
686 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
687 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
688
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
689 g_object_unref(fssession);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
690 return NULL;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
691 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
692
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
693 /* This could also emit when participants are ready */
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
694 static void
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
695 purple_media_emit_ready(PurpleMedia *media, PurpleMediaSession *session, const gchar *participant)
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
696 {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
697 GList *sessions;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
698 gboolean conf_ready = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
699
24990
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
700 if ((session != NULL) && ((media->priv->initiator == FALSE &&
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
701 session->accepted == FALSE) ||
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
702 (purple_media_codecs_ready(media, session->id) == FALSE)))
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
703 return;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
704
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
705 sessions = g_hash_table_get_values(media->priv->sessions);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
706
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
707 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
708 PurpleMediaSession *session_data = sessions->data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
709 GList *streams = purple_media_get_streams(media,
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
710 session_data->id, NULL);
24990
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
711 gboolean session_ready = TRUE;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
712
24990
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
713 if ((media->priv->initiator == FALSE &&
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
714 session_data->accepted == FALSE) ||
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
715 (purple_media_codecs_ready(
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
716 media, session_data->id) == FALSE))
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
717 conf_ready = FALSE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
718
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
719 for (; streams; streams = g_list_delete_link(streams, streams)) {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
720 PurpleMediaStream *stream = streams->data;
24990
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
721 if (stream->candidates_prepared == FALSE) {
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
722 session_ready = FALSE;
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
723 conf_ready = FALSE;
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
724 } else if (session_data == session)
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
725 g_signal_emit(media, purple_media_signals[READY_NEW],
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
726 0, session_data->id, stream->participant);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
727 }
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
728
24990
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
729 if (session_ready == TRUE &&
607d82dce00e Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24989
diff changeset
730 (session == session_data || session == NULL))
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
731 g_signal_emit(media, purple_media_signals[READY_NEW],
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
732 0, session_data->id, NULL);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
733 }
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
734
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
735 if (conf_ready == TRUE) {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
736 g_signal_emit(media, purple_media_signals[READY_NEW],
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
737 0, NULL, NULL);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
738 }
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
739 }
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
740
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
741 static gboolean
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
742 media_bus_call(GstBus *bus, GstMessage *msg, gpointer media)
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
743 {
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
744 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
745 case GST_MESSAGE_EOS:
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
746 purple_debug_info("media", "End of Stream\n");
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
747 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
748 case GST_MESSAGE_ERROR: {
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
749 gchar *debug = NULL;
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
750 GError *err = NULL;
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
751
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
752 gst_message_parse_error(msg, &err, &debug);
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
753
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
754 purple_debug_error("media", "gst pipeline error: %s\n", err->message);
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
755 g_error_free(err);
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
756
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
757 if (debug) {
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
758 purple_debug_error("media", "Debug details: %s\n", debug);
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
759 g_free (debug);
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
760 }
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
761 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
762 }
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
763 case GST_MESSAGE_ELEMENT: {
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
764 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
765 FsError error_no;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
766 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
767 FS_TYPE_ERROR, (gint*)&error_no);
24932
5606408fff59 Silence FS_ERROR_UNKNOWN_CNAME error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24931
diff changeset
768 /*
5606408fff59 Silence FS_ERROR_UNKNOWN_CNAME error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24931
diff changeset
769 * 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
770 * multicast transmitter which isn't used.
5606408fff59 Silence FS_ERROR_UNKNOWN_CNAME error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24931
diff changeset
771 */
5606408fff59 Silence FS_ERROR_UNKNOWN_CNAME error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24931
diff changeset
772 if (error_no != FS_ERROR_UNKNOWN_CNAME)
5606408fff59 Silence FS_ERROR_UNKNOWN_CNAME error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24931
diff changeset
773 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
774 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
775 } 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
776 "farsight-new-local-candidate")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
777 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
778 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
779 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
780 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
781 } 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
782 "farsight-local-candidates-prepared")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
783 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
784 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
785 purple_media_candidates_prepared_cb(stream, session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
786 } 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
787 "farsight-new-active-candidate-pair")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
788 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
789 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
790 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
791 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
792 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
793 } 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
794 "farsight-recv-codecs-changed")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
795 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
796 FsCodec *codec = codecs->data;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
797 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
798
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
799 } 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
800 "farsight-component-state-changed")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
801
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
802 } 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
803 "farsight-send-codec-changed")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
804
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
805 } 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
806 "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
807 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
808 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
809 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
810 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
811 if (session->session == fssession) {
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
812 gboolean ready;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
813 g_object_get(session->session, "codecs-ready", &ready, NULL);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
814 if (session->codecs_ready == FALSE && ready == TRUE) {
24991
b0e6a64cbf2e Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24990
diff changeset
815 session->codecs_ready = ready;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
816 g_signal_emit(session->media,
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
817 purple_media_signals[CODECS_READY],
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
818 0, session->id);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
819 purple_media_emit_ready(media, session, NULL);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
820 }
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
821
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
822 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
823 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
824 }
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
825 }
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
826 }
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
827 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
828 }
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
829 default:
23914
d6bda7b63eac Remove a bunch of extraneous GstBus messages from the debug output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23913
diff changeset
830 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
831 }
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
832
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
833 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
834 }
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
835
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
836 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
837 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
838 {
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
839 if (!media->priv->pipeline) {
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
840 GstBus *bus;
24984
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
841 media->priv->pipeline = gst_pipeline_new(NULL);
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
842 bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
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
843 gst_bus_add_signal_watch(GST_BUS(bus));
23913
ba609f368dc8 Fix GStreamer assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23912
diff changeset
844 g_signal_connect(G_OBJECT(bus), "message",
ba609f368dc8 Fix GStreamer assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23912
diff changeset
845 G_CALLBACK(media_bus_call), media);
24977
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24976
diff changeset
846 gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL);
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
847 gst_object_unref(bus);
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
848
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
849 gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(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
850 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
851
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
852 return media->priv->pipeline;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
853 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
854
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
855 static void
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
856 purple_media_set_remote_candidates(PurpleMediaStream *stream)
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
857 {
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
858 GError *err = NULL;
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
859
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
860 fs_stream_set_remote_candidates(stream->stream,
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
861 stream->remote_candidates, &err);
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
862
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
863 if (err) {
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
864 purple_debug_error("media", "Error adding remote"
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
865 " candidates: %s\n", err->message);
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
866 g_error_free(err);
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
867 }
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
868 }
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
869
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
870 void
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
871 purple_media_error(PurpleMedia *media, const gchar *error, ...)
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
872 {
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
873 va_list args;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
874 gchar *message;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
875
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
876 va_start(args, error);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
877 message = g_strdup_vprintf(error, args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
878 va_end(args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
879
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
880 purple_debug_error("media", "%s\n", message);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
881 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
882
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
883 g_free(message);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
884 }
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
885
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
886 void
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
887 purple_media_ready(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
888 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
889 g_signal_emit(media, purple_media_signals[READY], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
890 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
891
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
892 void
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
893 purple_media_wait(PurpleMedia *media)
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
894 {
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
895 g_signal_emit(media, purple_media_signals[WAIT], 0);
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
896 }
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
897
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
898 void
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
899 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
900 {
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
901 GList *sessions;
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
902 GList *streams;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
903
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
904 g_signal_emit(media, purple_media_signals[ACCEPTED], 0);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
905
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
906 sessions = g_hash_table_get_values(media->priv->sessions);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
907
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
908 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
909 PurpleMediaSession *session = sessions->data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
910 session->accepted = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
911
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
912 purple_media_emit_ready(media, session, NULL);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
913 }
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
914
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
915 streams = media->priv->streams;
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
916
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
917 for (; streams; streams = g_list_next(streams)) {
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
918 purple_media_set_remote_candidates(streams->data);
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
919 }
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
920 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
921
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
922 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
923 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
924 {
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
925 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
926 0, PURPLE_MEDIA_STATE_CHANGED_END,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
927 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
928 g_signal_emit(media, purple_media_signals[HANGUP], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
929 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
930
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
931 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
932 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
933 {
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
934 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
935 0, PURPLE_MEDIA_STATE_CHANGED_END,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
936 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
937 g_signal_emit(media, purple_media_signals[REJECT], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
938 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
939
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
940 void
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
941 purple_media_got_request(PurpleMedia *media)
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
942 {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
943 g_signal_emit(media, purple_media_signals[GOT_REQUEST], 0);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
944 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
945
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
946 void
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
947 purple_media_got_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
948 {
24995
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
949 /*
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
950 * There's no way to tell who hung up with the new structure.
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
951 * I'm commenting this out until this is resolved.
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
952 */
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
953 #if 0
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
954 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
955 0, PURPLE_MEDIA_STATE_CHANGED_END,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
956 NULL, NULL);
24995
8dba34f5f21a Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24993
diff changeset
957 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
958 g_signal_emit(media, purple_media_signals[GOT_HANGUP], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
959 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
960
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
961 void
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
962 purple_media_got_accept(PurpleMedia *media)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
963 {
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
964 GList *sessions;
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
965 GList *streams;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
966
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
967 g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
968
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
969 sessions = g_hash_table_get_values(media->priv->sessions);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
970
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
971 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
972 PurpleMediaSession *session = sessions->data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
973 session->accepted = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
974 }
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
975
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
976 streams = media->priv->streams;
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
977
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
978 for (; streams; streams = g_list_next(streams)) {
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
979 purple_media_set_remote_candidates(streams->data);
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
980 }
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
981 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
982
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
983 GList*
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
984 purple_media_get_devices(const gchar *plugin)
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
985 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
986 GObjectClass *klass;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
987 GstPropertyProbe *probe;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
988 const GParamSpec *pspec;
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
989 GstElement *element = gst_element_factory_make(plugin, NULL);
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
990 GstElementFactory *factory;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
991 const gchar *longname = NULL;
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
992 GList *ret = NULL;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
993
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
994 if (element == NULL)
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
995 return NULL;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
996
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
997 factory = gst_element_get_factory(element);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
998
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
999 longname = gst_element_factory_get_longname(factory);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1000 klass = G_OBJECT_GET_CLASS(element);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1001
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1002 if (!g_object_class_find_property (klass, "device") ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1003 !GST_IS_PROPERTY_PROBE (element) ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1004 !(probe = GST_PROPERTY_PROBE (element)) ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1005 !(pspec = gst_property_probe_get_property (probe, "device"))) {
23799
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
1006 purple_debug_info("media", "Found source '%s' (%s) - no device\n",
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1007 longname, GST_PLUGIN_FEATURE (factory)->name);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1008 } else {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1009 gint n;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1010 gchar *name;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1011 GValueArray *array;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1012
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1013 purple_debug_info("media", "Found devices\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1014
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1015 /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1016 if (g_object_class_find_property (klass, "autoprobe")) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1017 g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1018 if (g_object_class_find_property (klass, "autoprobe-fps")) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1019 g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1020 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1021 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1022
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1023 array = gst_property_probe_probe_and_get_values (probe, pspec);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1024 if (array != NULL) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1025 for (n = 0 ; n < array->n_values ; n++) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1026 GValue *device = g_value_array_get_nth (array, n);
23919
4b8c64deac5e Simplify device API. Use gchar* instead of GValue.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23918
diff changeset
1027
4b8c64deac5e Simplify device API. Use gchar* instead of GValue.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23918
diff changeset
1028 ret = g_list_append(ret, g_value_dup_string(device));
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1029
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
1030 g_object_set(G_OBJECT(element), "device",
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
1031 g_value_get_string(device), NULL);
24931
943a09762d95 Removed several PurpleMedia functions that now seem unnecessary:
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24929
diff changeset
1032 g_object_get(G_OBJECT(element), "device-name", &name, NULL);
23799
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
1033 purple_debug_info("media", "Found source '%s' (%s) - device '%s' (%s)\n",
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
1034 longname, GST_PLUGIN_FEATURE (factory)->name,
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
1035 name, g_value_get_string(device));
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
1036 g_free(name);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1037 }
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1038 g_value_array_free(array);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1039 }
23916
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1040
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1041 /* Restore autoprobe[-fps] to TRUE. */
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1042 if (g_object_class_find_property (klass, "autoprobe")) {
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1043 g_object_set (G_OBJECT (element), "autoprobe", TRUE, NULL);
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1044 if (g_object_class_find_property (klass, "autoprobe-fps")) {
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1045 g_object_set (G_OBJECT (element), "autoprobe-fps", TRUE, NULL);
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1046 }
9104d46df299 Restore autoprobe property when finished probing for devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1047 }
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1048 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1049
24935
e8b8c6b14196 Simplified purple_media_get_devices.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24934
diff changeset
1050 gst_object_unref(element);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1051 return ret;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1052 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1053
23919
4b8c64deac5e Simplify device API. Use gchar* instead of GValue.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23918
diff changeset
1054 gchar *
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1055 purple_media_element_get_device(GstElement *element)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1056 {
23919
4b8c64deac5e Simplify device API. Use gchar* instead of GValue.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23918
diff changeset
1057 gchar *device;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1058 g_object_get(G_OBJECT(element), "device", &device, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1059 return device;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1060 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1061
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1062 void
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1063 purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1064 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1065 GstElement *src;
23863
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1066 GstElement *volume;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1067 GstPad *pad;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1068 GstPad *ghost;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1069 const gchar *audio_device = purple_prefs_get_string("/purple/media/audio/device");
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1070 double input_volume = purple_prefs_get_int("/purple/media/audio/volume/input")/10.0;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1071
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1072 purple_debug_info("media", "purple_media_audio_init_src\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1073
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
1074 *sendbin = gst_bin_new("purplesendaudiobin");
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1075 src = gst_element_factory_make("alsasrc", "asrc");
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1076 volume = gst_element_factory_make("volume", "purpleaudioinputvolume");
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1077 g_object_set(volume, "volume", input_volume, NULL);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1078 *sendlevel = gst_element_factory_make("level", "sendlevel");
23863
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1079 gst_bin_add_many(GST_BIN(*sendbin), src, volume, *sendlevel, NULL);
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1080 gst_element_link(src, volume);
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1081 gst_element_link(volume, *sendlevel);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1082 pad = gst_element_get_pad(*sendlevel, "src");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1083 ghost = gst_ghost_pad_new("ghostsrc", pad);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1084 gst_element_add_pad(*sendbin, ghost);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1085 g_object_set(G_OBJECT(*sendlevel), "message", TRUE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1086
24931
943a09762d95 Removed several PurpleMedia functions that now seem unnecessary:
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24929
diff changeset
1087 if (audio_device != NULL && strcmp(audio_device, ""))
943a09762d95 Removed several PurpleMedia functions that now seem unnecessary:
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24929
diff changeset
1088 g_object_set(G_OBJECT(src), "device", audio_device, NULL);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1089 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1090
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1091 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
1092 purple_media_video_init_src(GstElement **sendbin)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1093 {
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1094 GstElement *src, *tee, *queue, *local_sink;
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
1095 GstPad *pad;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1096 GstPad *ghost;
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1097 const gchar *video_plugin = purple_prefs_get_string(
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1098 "/purple/media/video/plugin");
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1099 const gchar *video_device = purple_prefs_get_string(
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1100 "/purple/media/video/device");
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
1101
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1102 purple_debug_info("media", "purple_media_video_init_src\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
1103
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1104 *sendbin = gst_bin_new("purplesendvideobin");
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1105 src = gst_element_factory_make(video_plugin, "purplevideosource");
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
1106 gst_bin_add(GST_BIN(*sendbin), 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
1107
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
1108 tee = gst_element_factory_make("tee", "purplevideosrctee");
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1109 gst_bin_add(GST_BIN(*sendbin), tee);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1110 gst_element_link(src, tee);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1111
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1112 queue = gst_element_factory_make("queue", NULL);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1113 gst_bin_add(GST_BIN(*sendbin), queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1114 gst_element_link(tee, queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1115
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
1116 if (!strcmp(video_plugin, "videotestsrc")) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1117 /* unless is-live is set to true it doesn't throttle videotestsrc */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1118 g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1119 }
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1120
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
1121 pad = gst_element_get_static_pad(queue, "src");
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
1122 ghost = gst_ghost_pad_new("ghostsrc", pad);
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
1123 gst_object_unref(pad);
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 gst_element_add_pad(*sendbin, ghost);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1125
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
1126 queue = gst_element_factory_make("queue", "purplelocalvideoqueue");
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1127 gst_bin_add(GST_BIN(*sendbin), queue);
24951
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24948
diff changeset
1128 gst_element_link(tee, queue);
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1129
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1130 local_sink = gst_element_factory_make("autovideosink", "purplelocalvideosink");
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1131 gst_bin_add(GST_BIN(*sendbin), local_sink);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1132 gst_element_link(queue, local_sink);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
1133
24931
943a09762d95 Removed several PurpleMedia functions that now seem unnecessary:
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24929
diff changeset
1134 if (video_device != NULL && strcmp(video_device, ""))
943a09762d95 Removed several PurpleMedia functions that now seem unnecessary:
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24929
diff changeset
1135 g_object_set(G_OBJECT(src), "device", video_device, 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
1136 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1137
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1138 void
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1139 purple_media_audio_init_recv(GstElement **recvbin, GstElement **recvlevel)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1140 {
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1141 GstElement *sink, *volume;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1142 GstPad *pad, *ghost;
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1143 double output_volume = purple_prefs_get_int(
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1144 "/purple/media/audio/volume/output")/10.0;
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1145
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1146 purple_debug_info("media", "purple_media_audio_init_recv\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1147
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
1148 *recvbin = gst_bin_new("pidginrecvaudiobin");
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1149 sink = gst_element_factory_make("alsasink", "asink");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1150 g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1151 volume = gst_element_factory_make("volume", "purpleaudiooutputvolume");
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1152 g_object_set(volume, "volume", output_volume, NULL);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1153 *recvlevel = gst_element_factory_make("level", "recvlevel");
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1154 gst_bin_add_many(GST_BIN(*recvbin), sink, volume, *recvlevel, NULL);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1155 gst_element_link(*recvlevel, sink);
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1156 gst_element_link(volume, *recvlevel);
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1157 pad = gst_element_get_pad(volume, "sink");
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1158 ghost = gst_ghost_pad_new("ghostsink", pad);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1159 gst_element_add_pad(*recvbin, ghost);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1160 g_object_set(G_OBJECT(*recvlevel), "message", TRUE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1161
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1162 purple_debug_info("media", "purple_media_audio_init_recv end\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1163 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
1164
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
1165 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
1166 purple_media_video_init_recv(GstElement **recvbin)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1167 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1168 GstElement *sink;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1169 GstPad *pad, *ghost;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1170
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1171 purple_debug_info("media", "purple_media_video_init_recv\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
1172
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1173 *recvbin = gst_bin_new("pidginrecvvideobin");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1174 sink = gst_element_factory_make("autovideosink", "purplevideosink");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1175 gst_bin_add(GST_BIN(*recvbin), sink);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1176 pad = gst_element_get_pad(sink, "sink");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1177 ghost = gst_ghost_pad_new("ghostsink", pad);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1178 gst_element_add_pad(*recvbin, ghost);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1179
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1180 purple_debug_info("media", "purple_media_video_init_recv end\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
1181 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1182
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1183 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
1184 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
1185 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
1186 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
1187 {
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
1188 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
1189 FsParticipant *participant;
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1190 FsCandidate *candidate;
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1191 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
1192 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
1193 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
1194 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
1195
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1196 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
1197
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1198 candidate = fs_candidate_copy(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
1199 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
1200 0, session->id, name, candidate);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1201 fs_candidate_destroy(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
1202
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1203 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
1204 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1205
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1206 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
1207 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
1208 {
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
1209 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
1210 FsParticipant *participant;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1211 PurpleMediaStream *stream_data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1212
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
1213 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
1214 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
1215 g_object_unref(participant);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1216
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1217 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
1218 stream_data->candidates_prepared = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1219
24938
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24937
diff changeset
1220 g_signal_emit(session->media, purple_media_signals[CANDIDATES_PREPARED],
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24937
diff changeset
1221 0, session->id, name);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1222
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
1223 purple_media_emit_ready(session->media, session, name);
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
1224 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
1225 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1226
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1227 /* 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
1228 * 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
1229 static void
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1230 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
1231 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
1232 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
1233 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
1234 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1235 gchar *name;
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1236 FsParticipant *participant;
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1237 FsCandidate *local = fs_candidate_copy(native_candidate);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1238 FsCandidate *remote = fs_candidate_copy(remote_candidate);
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1239 PurpleMediaStream *stream;
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1240
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1241 g_object_get(fsstream, "participant", &participant, NULL);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1242 g_object_get(participant, "cname", &name, NULL);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1243 g_object_unref(participant);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1244
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1245 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
1246
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1247 stream->local_candidate = fs_candidate_copy(native_candidate);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1248 stream->remote_candidate = 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
1249
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1250 purple_debug_info("media", "candidate pair established\n");
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
1251 g_signal_emit(session->media, purple_media_signals[CANDIDATE_PAIR], 0,
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1252 local, remote);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1253
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1254 fs_candidate_destroy(local);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1255 fs_candidate_destroy(remote);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1256 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1257
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1258 static void
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1259 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
1260 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
1261 {
24951
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24948
diff changeset
1262 PurpleMediaSessionType type = purple_media_from_fs(codec->media_type, FS_DIRECTION_RECV);
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24948
diff changeset
1263 GstPad *sinkpad = NULL;
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1264
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1265 stream->sink = purple_media_manager_get_element(
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1266 purple_media_manager_get(), type);
24951
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24948
diff changeset
1267
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1268 gst_bin_add(GST_BIN(purple_media_get_pipeline(stream->session->media)),
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1269 stream->sink);
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1270 sinkpad = gst_element_get_static_pad(stream->sink, "ghostsink");
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1271 purple_debug_info("media", "connecting new src pad: %s\n",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1272 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK ? "success" : "failure");
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1273 gst_element_set_state(stream->sink, GST_STATE_PLAYING);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1274
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1275 g_signal_emit(stream->session->media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1276 0, PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1277 stream->session->id, stream->participant);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1278 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1279
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1280 static gchar *
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1281 purple_media_get_stun_pref_ip()
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1282 {
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1283 const gchar *stun_pref =
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1284 purple_prefs_get_string("/purple/network/stun_server");
26013
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1285 struct hostent *host;
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1286
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1287 if ((host = gethostbyname(stun_pref)) && host->h_addr) {
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1288 gchar *stun_ip = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1289 host->h_addr[0], host->h_addr[1],
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1290 host->h_addr[2], host->h_addr[3]);
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1291 purple_debug_info("media", "IP address for %s found: %s\n",
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1292 stun_pref, stun_ip);
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1293 return stun_ip;
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1294 } else {
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1295 purple_debug_info("media", "Unable to resolve %s IP address\n",
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1296 stun_pref);
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1297 return NULL;
8b54456cba97 disapproval of revision '106c6ba87b3a431f8ec3adad7e4e569f3d008f83'
Marcus Lundblad <ml@update.uu.se>
parents: 26012
diff changeset
1298 }
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1299 }
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1300
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1301 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
1302 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
1303 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
1304 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
1305 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
1306 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
1307 {
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
1308 PurpleMediaSession *session = purple_media_get_session(media, 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
1309 FsParticipant *participant = NULL;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1310 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
1311 FsStreamDirection *direction = NULL;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1312
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
1313 if (!session) {
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1314 GError *err = NULL;
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1315 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
1316 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
1317
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1318 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
1319
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1320 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
1321
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1322 if (err != NULL) {
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
1323 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
1324 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
1325 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
1326 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1327 }
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1328
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
1329 /* 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
1330 #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
1331 /* 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
1332 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
1333 "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
1334 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
1335 "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
1336 #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
1337
24948
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1338 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
1339 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
1340 g_free(filename);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1341
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1342 if (err != NULL) {
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1343 purple_debug_error("media", "Error reading codec configuration file: %s\n", err->message);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1344 g_error_free(err);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1345 }
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
1346
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1347 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
1348
24980
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
1349 /*
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
1350 * 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
1351 * 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
1352 * 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
1353 */
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
1354 if (!strcmp(transmitter, "nice") || !strcmp(transmitter, "rawudp"))
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
1355 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
1356 "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
1357
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
1358 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
1359
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1360 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
1361 session->media = media;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1362 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
1363
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually 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
1364 purple_media_add_session(media, session);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1365 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1366 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1367 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
1368 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1369
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1370 if (!(participant = purple_media_add_participant(media, who))) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1371 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1372 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1373 return FALSE;
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1374 } else {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1375 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1376 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1377 NULL, who);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1378 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1379
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1380 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
1381
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1382 if (!stream) {
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1383 GError *err = NULL;
26018
81e34828a9da disapproval of revision '1fa05b8b4d069723f0cba486203a2a00c3baf096'
Marcus Lundblad <ml@update.uu.se>
parents: 26015
diff changeset
1384 gchar *stun_ip = NULL;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1385 FsStream *fsstream = NULL;
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1386
26018
81e34828a9da disapproval of revision '1fa05b8b4d069723f0cba486203a2a00c3baf096'
Marcus Lundblad <ml@update.uu.se>
parents: 26015
diff changeset
1387 if ((stun_ip = purple_media_get_stun_pref_ip())) {
81e34828a9da disapproval of revision '1fa05b8b4d069723f0cba486203a2a00c3baf096'
Marcus Lundblad <ml@update.uu.se>
parents: 26015
diff changeset
1388 GParameter *param = g_new0(GParameter, num_params+1);
24933
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
1389 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
1390
24933
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
1391 param[num_params].name = "stun-ip";
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
1392 g_value_init(&param[num_params].value, G_TYPE_STRING);
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
1393 g_value_take_string(&param[num_params].value, stun_ip);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1394
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1395 fsstream = fs_session_new_stream(session->session,
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1396 participant, type_direction,
26018
81e34828a9da disapproval of revision '1fa05b8b4d069723f0cba486203a2a00c3baf096'
Marcus Lundblad <ml@update.uu.se>
parents: 26015
diff changeset
1397 transmitter, num_params+1, 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
1398 g_free(param);
26018
81e34828a9da disapproval of revision '1fa05b8b4d069723f0cba486203a2a00c3baf096'
Marcus Lundblad <ml@update.uu.se>
parents: 26015
diff changeset
1399 g_free(stun_ip);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1400 } else {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1401 fsstream = fs_session_new_stream(session->session,
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
1402 participant, 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
1403 transmitter, 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
1404 }
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1405
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1406 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1407 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
1408 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1409 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1410 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
1411 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
1412 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1413 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1414 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1415 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1416
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1417 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
1418
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1419 /* 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
1420 g_signal_connect(G_OBJECT(fsstream),
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1421 "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
1422
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1423 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1424 0, PURPLE_MEDIA_STATE_CHANGED_NEW,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1425 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
1426 } 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
1427 /* change direction */
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1428 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
1429 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1430
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1431 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
1432 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1433
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1434 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
1435 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
1436 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
1437 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
1438 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
1439 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1440 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
1441
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1442 if (type & PURPLE_MEDIA_AUDIO) {
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1443 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
1444
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
1445 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
1446 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
1447 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
1448 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1449 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1450 }
24934
3b4b9795f987 purple_media_add_stream should only add a stream to one session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24933
diff changeset
1451 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
1452 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
1453
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
1454 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
1455 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
1456 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
1457 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1458 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1459 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1460 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
1461 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1462
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1463 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
1464 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
1465 {
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1466 /* 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
1467 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1468
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
1469 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
1470 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
1471 {
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
1472 PurpleMediaSession *session = purple_media_get_session(media, 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
1473 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
1474 }
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1475 /* 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
1476 GList *
24960
a5f1804fcb4b Combine get_*_codecs functions to mirror Farsight 2.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24951
diff changeset
1477 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
1478 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1479 GList *codecs;
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
1480 g_object_get(G_OBJECT(purple_media_get_session(media, sess_id)->session),
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1481 "codecs", &codecs, 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
1482 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
1483 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1484
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1485 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
1486 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
1487 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1488 PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1489 return fs_candidate_list_copy(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
1490 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1491
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1492 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
1493 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
1494 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
1495 {
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
1496 PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
1497 stream->remote_candidates = g_list_concat(stream->remote_candidates,
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
1498 fs_candidate_list_copy(remote_candidates));
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1499
26004
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
1500 if (stream->session->accepted == TRUE) {
2d76bee4a98c Wait to send media until both sides have accepted.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25000
diff changeset
1501 purple_media_set_remote_candidates(stream);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1502 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1503 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1504
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1505 FsCandidate *
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
1506 purple_media_get_local_candidate(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
1507 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1508 return purple_media_get_stream(media, sess_id, name)->local_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
1509 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1510
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1511 FsCandidate *
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
1512 purple_media_get_remote_candidate(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
1513 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1514 return purple_media_get_stream(media, sess_id, name)->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
1515 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1516
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1517 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
1518 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
1519 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1520 FsStream *stream = purple_media_get_stream(media, sess_id, name)->stream;
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1521 GError *err = NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1522
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1523 fs_stream_set_remote_codecs(stream, codecs, &err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1524
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1525 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1526 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
1527 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1528 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1529 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1530 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1531 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
1532 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1533
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1534 gboolean
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1535 purple_media_candidates_prepared(PurpleMedia *media, const gchar *name)
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1536 {
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1537 GList *sessions = purple_media_get_session_names(media);
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1538
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1539 for (; sessions; sessions = sessions->next) {
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1540 const gchar *session = sessions->data;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1541 if (!purple_media_get_local_candidate(media, session, name) ||
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1542 !purple_media_get_remote_candidate(media, session, name))
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1543 return FALSE;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1544 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1545
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1546 return TRUE;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1547 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1548
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1549 gboolean
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1550 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, FsCodec *codec)
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1551 {
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1552 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1553 GError *err = NULL;
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1554
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1555 fs_session_set_send_codec(session->session, codec, &err);
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1556
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1557 if (err) {
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1558 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
1559 g_error_free(err);
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1560 return FALSE;
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1561 }
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1562 return TRUE;
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1563 }
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1564
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
1565 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
1566 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
1567 {
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
1568 PurpleMediaSession *session = purple_media_get_session(media, 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
1569 gboolean 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
1570 g_object_get(session->session, "codecs-ready", &ret, NULL);
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
1571 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
1572 }
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
1573
23863
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1574 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
1575 {
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1576 GList *sessions = g_hash_table_get_values(media->priv->sessions);
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1577 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
1578
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1579 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
1580 PurpleMediaSession *session = sessions->data;
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1581 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
1582 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
1583 GST_BIN(session->src),
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
1584 "purpleaudioinputvolume");
23863
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1585 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
1586 }
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1587 }
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1588 }
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23862
diff changeset
1589
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1590 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
1591 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
1592 {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1593 GList *sessions;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1594
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1595 if (session_id == NULL)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1596 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
1597 else
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1598 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
1599 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
1600
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1601 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
1602 PurpleMediaSession *session = sessions->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1603
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1604 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
1605 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
1606 GST_BIN(session->src),
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1607 "purpleaudioinputvolume");
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1608 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
1609 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1610 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1611 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1612
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1613 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
1614 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
1615 double level)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1616 {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1617 GList *streams = purple_media_get_streams(media,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1618 session_id, participant);
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1619
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1620 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
1621 PurpleMediaStream *stream = streams->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1622
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1623 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO) {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1624 GstElement *volume = gst_bin_get_by_name(
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1625 GST_BIN(stream->sink),
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1626 "purpleaudiooutputvolume");
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1627 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
1628 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1629 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1630 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1631
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
1632 #endif /* USE_VV */