libpurple/media.c

Sat, 09 Aug 2008 03:51:42 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Sat, 09 Aug 2008 03:51:42 +0000
branch
soc.2008.vv
changeset 26108
8d0fd2f195aa
parent 26105
7647c0dcf202
child 26112
3c2d389fcad1
permissions
-rw-r--r--

Changed PurpleMediaStreamType to PurpleMediaSessionType.

19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /**
19889
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
2 * @file media.c Media API
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 * @ingroup core
26105
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
4 */
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
5
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
6 /* purple
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * source distribution.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * (at your option) any later version.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 * GNU General Public License for more details.
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 *
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 */
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
27 #include <string.h>
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
28
19889
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
29 #include "internal.h"
defa6a4f45cc Cosmetics.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19885
diff changeset
30
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31 #include "connection.h"
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
32 #include "media.h"
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
33 #include "marshallers.h"
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
34
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
35 #include "debug.h"
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
36
23704
9b88c9b23aed Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents: 23701
diff changeset
37 #ifdef USE_VV
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
38
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
39 #include <gst/interfaces/propertyprobe.h>
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
40 #include <gst/farsight/fs-conference-iface.h>
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
41
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
42 struct _PurpleMediaSession
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
43 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
44 gchar *id;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
45 PurpleMedia *media;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
46 GstElement *src;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
47 GstElement *sink;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
48 FsSession *session;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
49 GHashTable *streams; /* FsStream list map to participant's name */
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
50 PurpleMediaSessionType type;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
51 GHashTable *local_candidates; /* map to participant's name? */
23746
e51b7f60acbb Clarify the scope of two variables.
Michael Ruprecht <maiku@pidgin.im>
parents: 23745
diff changeset
52
e51b7f60acbb Clarify the scope of two variables.
Michael Ruprecht <maiku@pidgin.im>
parents: 23745
diff changeset
53 /*
e51b7f60acbb Clarify the scope of two variables.
Michael Ruprecht <maiku@pidgin.im>
parents: 23745
diff changeset
54 * These will need to be per stream when sessions with multiple
e51b7f60acbb Clarify the scope of two variables.
Michael Ruprecht <maiku@pidgin.im>
parents: 23745
diff changeset
55 * streams are supported.
e51b7f60acbb Clarify the scope of two variables.
Michael Ruprecht <maiku@pidgin.im>
parents: 23745
diff changeset
56 */
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
57 FsCandidate *local_candidate;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
58 FsCandidate *remote_candidate;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
59 };
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
60
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
61 struct _PurpleMediaPrivate
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
62 {
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
63 FsConference *conference;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
64
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
65 char *name;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
66 PurpleConnection *connection;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
67
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
68 GHashTable *sessions; /* PurpleMediaSession table */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
69 GHashTable *participants; /* FsParticipant table */
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
70
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
71 GstElement *pipeline;
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
72 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
73
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
74 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
75
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
76 static void purple_media_class_init (PurpleMediaClass *klass);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
77 static void purple_media_init (PurpleMedia *media);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
78 static void purple_media_finalize (GObject *object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
79 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
80 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
81
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
82 static GObjectClass *parent_class = NULL;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
83
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
86 enum {
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
87 READY,
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
88 WAIT,
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
89 ACCEPTED,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
90 HANGUP,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
91 REJECT,
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
92 GOT_REQUEST,
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
93 GOT_HANGUP,
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
94 GOT_ACCEPT,
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
95 NEW_CANDIDATE,
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
96 CANDIDATES_PREPARED,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
97 CANDIDATE_PAIR,
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
98 LAST_SIGNAL
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
99 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
100 static guint purple_media_signals[LAST_SIGNAL] = {0};
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
101
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
102 enum {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 PROP_0,
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
104 PROP_FS_CONFERENCE,
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105 PROP_NAME,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106 PROP_CONNECTION,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
107 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
108
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
109 GType
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110 purple_media_get_type()
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
111 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112 static GType type = 0;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
114 if (type == 0) {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115 static const GTypeInfo info = {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
116 sizeof(PurpleMediaClass),
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
118 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
119 (GClassInitFunc) purple_media_class_init,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
120 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
121 NULL,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
122 sizeof(PurpleMedia),
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
123 0,
22071
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19889
diff changeset
124 (GInstanceInitFunc) purple_media_init,
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19889
diff changeset
125 NULL
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
126 };
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
127 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
128 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129 return type;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
131
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
132 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
133 purple_media_class_init (PurpleMediaClass *klass)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
135 GObjectClass *gobject_class = (GObjectClass*)klass;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
136 parent_class = g_type_class_peek_parent(klass);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
137
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
138 gobject_class->finalize = purple_media_finalize;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
139 gobject_class->set_property = purple_media_set_property;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
140 gobject_class->get_property = purple_media_get_property;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
142 g_object_class_install_property(gobject_class, PROP_FS_CONFERENCE,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
143 g_param_spec_object("farsight-conference",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
144 "Farsight conference",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
145 "The FsConference associated with this media.",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
146 FS_TYPE_CONFERENCE,
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
147 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
149 g_object_class_install_property(gobject_class, PROP_NAME,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 g_param_spec_string("screenname",
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
151 "Screenname",
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
152 "The screenname of the remote user",
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
153 NULL,
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
154 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
155
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
156 g_object_class_install_property(gobject_class, PROP_CONNECTION,
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
157 g_param_spec_pointer("connection",
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
158 "Connection",
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
159 "The PurpleConnection associated with this session",
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
160 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
161
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
162 purple_media_signals[READY] = g_signal_new("ready", G_TYPE_FROM_CLASS(klass),
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
163 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
164 g_cclosure_marshal_VOID__VOID,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
165 G_TYPE_NONE, 0);
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
166 purple_media_signals[WAIT] = g_signal_new("wait", G_TYPE_FROM_CLASS(klass),
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
167 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
168 g_cclosure_marshal_VOID__VOID,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
169 G_TYPE_NONE, 0);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
170 purple_media_signals[ACCEPTED] = g_signal_new("accepted", G_TYPE_FROM_CLASS(klass),
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
171 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
172 g_cclosure_marshal_VOID__VOID,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
173 G_TYPE_NONE, 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
174 purple_media_signals[HANGUP] = g_signal_new("hangup", G_TYPE_FROM_CLASS(klass),
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
175 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
176 g_cclosure_marshal_VOID__VOID,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
177 G_TYPE_NONE, 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
178 purple_media_signals[REJECT] = g_signal_new("reject", G_TYPE_FROM_CLASS(klass),
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
179 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
180 g_cclosure_marshal_VOID__VOID,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
181 G_TYPE_NONE, 0);
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
182 purple_media_signals[GOT_REQUEST] = g_signal_new("got-request", G_TYPE_FROM_CLASS(klass),
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
183 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
184 g_cclosure_marshal_VOID__VOID,
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
185 G_TYPE_NONE, 0);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
186 purple_media_signals[GOT_HANGUP] = g_signal_new("got-hangup", G_TYPE_FROM_CLASS(klass),
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
187 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
188 g_cclosure_marshal_VOID__VOID,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
189 G_TYPE_NONE, 0);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
190 purple_media_signals[GOT_ACCEPT] = g_signal_new("got-accept", G_TYPE_FROM_CLASS(klass),
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
191 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
192 g_cclosure_marshal_VOID__VOID,
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
193 G_TYPE_NONE, 0);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
194 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
195 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
196 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
197 G_TYPE_NONE, 3, G_TYPE_POINTER,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
198 G_TYPE_POINTER, FS_TYPE_CANDIDATE);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
199 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
200 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
201 g_cclosure_marshal_VOID__VOID,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
202 G_TYPE_NONE, 0);
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
203 purple_media_signals[CANDIDATE_PAIR] = g_signal_new("candidate-pair", G_TYPE_FROM_CLASS(klass),
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
204 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
205 purple_smarshal_VOID__BOXED_BOXED,
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
206 G_TYPE_NONE, 2, FS_TYPE_CANDIDATE, FS_TYPE_CANDIDATE);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
207
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
208 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
209 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
211
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
212 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
213 purple_media_init (PurpleMedia *media)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
215 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
216 memset(media->priv, 0, sizeof(media->priv));
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
219 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 purple_media_finalize (GObject *media)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
221 {
23711
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
222 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
26096
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
223 GList *sessions = g_hash_table_get_values(priv->sessions);
23711
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
224 purple_debug_info("media","purple_media_finalize\n");
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
225
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
226 g_free(priv->name);
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
227
26096
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
228 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
229 PurpleMediaSession *session = sessions->data;
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
230 GList *streams = g_hash_table_get_values(session->streams);
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
231
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
232 for (; streams; streams = g_list_delete_link(streams, streams)) {
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
233 g_object_unref(streams->data);
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
234 }
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
235
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
236 g_object_unref(session->session);
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
237 }
7249fdfc2eab Set the media pipeline to PLAYING immediately after initialization
Michael Ruprecht <maiku@pidgin.im>
parents: 23752
diff changeset
238
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
239 if (priv->pipeline) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
240 gst_element_set_state(priv->pipeline, GST_STATE_NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
241 gst_object_unref(priv->pipeline);
23711
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
242 }
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
243
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
244 gst_object_unref(priv->conference);
c5058fc31d26 Free the PurpleMedia object when the media session ends and fix ending
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
245
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
246 parent_class->finalize(media);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
247 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
248
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
249 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
250 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
251 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
252 PurpleMedia *media;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
253 g_return_if_fail(PURPLE_IS_MEDIA(object));
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
254
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
255 media = PURPLE_MEDIA(object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
256
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
257 switch (prop_id) {
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
258 case PROP_FS_CONFERENCE:
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
259 if (media->priv->conference)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
260 g_object_unref(media->priv->conference);
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
261 media->priv->conference = g_value_get_object(value);
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
262 g_object_ref(media->priv->conference);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
264 case PROP_NAME:
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
265 g_free(media->priv->name);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
266 media->priv->name = g_value_dup_string(value);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
268 case PROP_CONNECTION:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
269 media->priv->connection = g_value_get_pointer(value);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
270 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
271 default:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
272 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
273 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
274 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
275 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
276
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
277 static void
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
278 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
279 {
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
280 PurpleMedia *media;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
281 g_return_if_fail(PURPLE_IS_MEDIA(object));
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
282
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
283 media = PURPLE_MEDIA(object);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
284
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
285 switch (prop_id) {
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
286 case PROP_FS_CONFERENCE:
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
287 g_value_set_object(value, media->priv->conference);
19883
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
288 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
289 case PROP_NAME:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
290 g_value_set_string(value, media->priv->name);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
291 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
292 case PROP_CONNECTION:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
293 g_value_set_pointer(value, media->priv->connection);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
294 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295 default:
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
296 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
297 break;
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
298 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
299
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
300 }
2b59550f211d Missed files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
301
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
302 FsMediaType
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
303 purple_media_to_fs_media_type(PurpleMediaSessionType type)
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
304 {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
305 if (type & PURPLE_MEDIA_AUDIO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
306 return FS_MEDIA_TYPE_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
307 else if (type & PURPLE_MEDIA_VIDEO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
308 return FS_MEDIA_TYPE_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
309 else
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
310 return FS_MEDIA_TYPE_APPLICATION;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
311 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
312
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
313 FsStreamDirection
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
314 purple_media_to_fs_stream_direction(PurpleMediaSessionType type)
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
315 {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
316 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
317 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
318 return FS_DIRECTION_BOTH;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
319 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
320 (type & PURPLE_MEDIA_SEND_VIDEO))
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
321 return FS_DIRECTION_SEND;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
322 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
323 (type & PURPLE_MEDIA_RECV_VIDEO))
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
324 return FS_DIRECTION_RECV;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
325 else
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
326 return FS_DIRECTION_NONE;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
327 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
328
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
329 PurpleMediaSessionType
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
330 purple_media_from_fs(FsMediaType type, FsStreamDirection direction)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
331 {
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
332 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
333 if (type == FS_MEDIA_TYPE_AUDIO) {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
334 if (direction & FS_DIRECTION_SEND)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
335 result |= PURPLE_MEDIA_SEND_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
336 if (direction & FS_DIRECTION_RECV)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
337 result |= PURPLE_MEDIA_RECV_AUDIO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
338 } else if (type == FS_MEDIA_TYPE_VIDEO) {
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
339 if (direction & FS_DIRECTION_SEND)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
340 result |= PURPLE_MEDIA_SEND_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
341 if (direction & FS_DIRECTION_RECV)
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
342 result |= PURPLE_MEDIA_RECV_VIDEO;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
343 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
344 return result;
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
345 }
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
346
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
347 PurpleMediaSessionType
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
348 purple_media_get_overall_type(PurpleMedia *media)
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
349 {
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
350 GList *values = g_hash_table_get_values(media->priv->sessions);
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
351 PurpleMediaSessionType type = PURPLE_MEDIA_NONE;
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
352
23752
d573c980437e Fixed some memory leak issues involving GLists.
Michael Ruprecht <maiku@pidgin.im>
parents: 23746
diff changeset
353 for (; values; values = g_list_delete_link(values, values)) {
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
354 PurpleMediaSession *session = values->data;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
355 type |= session->type;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
356 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
357
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
358 return type;
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
359 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
360
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
361 static PurpleMediaSession*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
362 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
363 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
364 return (PurpleMediaSession*) (media->priv->sessions) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
365 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
366 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
367
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
368 static FsParticipant*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
369 purple_media_get_participant(PurpleMedia *media, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
370 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
371 return (FsParticipant*) (media->priv->participants) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
372 g_hash_table_lookup(media->priv->participants, name) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
373 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
374
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
375 static FsStream*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
376 purple_media_session_get_stream(PurpleMediaSession *session, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
377 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
378 return (FsStream*) (session->streams) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
379 g_hash_table_lookup(session->streams, name) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
380 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
381
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
382 static GList*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
383 purple_media_session_get_local_candidates(PurpleMediaSession *session, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
384 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
385 return (GList*) (session->local_candidates) ?
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
386 g_hash_table_lookup(session->local_candidates, name) : NULL;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
387 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
388
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
389 static void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
390 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
391 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
392 if (!media->priv->sessions) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
393 purple_debug_info("media", "Creating hash table for sessions\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
394 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
395 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
396 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
397 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
398
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
399 static gboolean
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
400 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
401 {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
402 return g_hash_table_remove(media->priv->sessions, session->id);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
403 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
404
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
405 static FsParticipant *
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
406 purple_media_add_participant(PurpleMedia *media, const gchar *name)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
407 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
408 FsParticipant *participant = purple_media_get_participant(media, name);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
409 GError *err = NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
410
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
411 if (participant)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
412 return participant;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
413
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
414 participant = fs_conference_new_participant(media->priv->conference,
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
415 g_strdup(name), &err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
416
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
417 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
418 purple_debug_error("media", "Error creating participant: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
419 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
420 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
421 return NULL;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
422 }
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
423
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
424 if (!media->priv->participants) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
425 purple_debug_info("media", "Creating hash table for participants\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
426 media->priv->participants = g_hash_table_new(g_str_hash, g_str_equal);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
427 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
428
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
429 g_hash_table_insert(media->priv->participants, g_strdup(name), participant);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
430
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
431 return participant;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
432 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
433
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
434 static void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
435 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
436 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
437 if (!session->streams) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
438 purple_debug_info("media", "Creating hash table for streams\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
439 session->streams = g_hash_table_new(g_str_hash, g_str_equal);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
440 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
441
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
442 g_hash_table_insert(session->streams, g_strdup(name), stream);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
443 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
444
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
445 static void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
446 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
447 FsCandidate *candidate)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
448 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
449 GList *candidates = purple_media_session_get_local_candidates(session, name);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
450
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
451 candidates = g_list_append(candidates, candidate);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
452
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
453 if (!session->local_candidates) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
454 purple_debug_info("media", "Creating hash table for local candidates\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
455 session->local_candidates = g_hash_table_new(g_str_hash, g_str_equal);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
456 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
457
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
458 g_hash_table_insert(session->local_candidates, g_strdup(name), candidates);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
459 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
460
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
461 GList *
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
462 purple_media_get_session_names(PurpleMedia *media)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
463 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
464 return g_hash_table_get_keys(media->priv->sessions);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
465 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
466
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
467 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
468 purple_media_get_elements(PurpleMedia *media, GstElement **audio_src, GstElement **audio_sink,
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
469 GstElement **video_src, GstElement **video_sink)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
470 {
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
471 GList *values = g_hash_table_get_values(media->priv->sessions);
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
472
23752
d573c980437e Fixed some memory leak issues involving GLists.
Michael Ruprecht <maiku@pidgin.im>
parents: 23746
diff changeset
473 for (; values; values = g_list_delete_link(values, values)) {
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
474 PurpleMediaSession *session = (PurpleMediaSession*)values->data;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
475
23744
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
476 if (session->type & PURPLE_MEDIA_SEND_AUDIO && audio_src)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
477 *audio_src = session->src;
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
478 if (session->type & PURPLE_MEDIA_RECV_AUDIO && audio_sink)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
479 *audio_sink = session->sink;
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
480 if (session->type & PURPLE_MEDIA_SEND_VIDEO && video_src)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
481 *video_src = session->src;
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
482 if (session->type & PURPLE_MEDIA_RECV_VIDEO && video_sink)
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
483 *video_sink = session->sink;
7b6b91b7e862 Wait to set up the voice and video GUI until the responder has accepted the session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
484 }
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
485 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
486
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
487 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
488 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
489 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
490 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
491 GstPad *sinkpad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
492 GstPad *srcpad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
493
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
494 if (session->src)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
495 gst_object_unref(session->src);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
496 session->src = src;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
497 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
498 session->src);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
499
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
500 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
501 srcpad = gst_element_get_static_pad(src, "ghostsrc");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
502 purple_debug_info("media", "connecting pad: %s\n",
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
503 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
504 ? "success" : "failure");
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
505 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
506
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
507 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
508 purple_media_set_sink(PurpleMedia *media, const gchar *sess_id, GstElement *sink)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
509 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
510 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
511 if (session->sink)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
512 gst_object_unref(session->sink);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
513 session->sink = sink;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
514 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
515 session->sink);
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
516 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
517
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
518 GstElement *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
519 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
520 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
521 return purple_media_get_session(media, sess_id)->src;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
522 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
523
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
524 GstElement *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
525 purple_media_get_sink(PurpleMedia *media, const gchar *sess_id)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
526 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
527 return purple_media_get_session(media, sess_id)->src;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
528 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
529
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
530 static gboolean
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
531 media_bus_call(GstBus *bus, GstMessage *msg, gpointer media)
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
532 {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
533 switch(GST_MESSAGE_TYPE(msg)) {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
534 case GST_MESSAGE_EOS:
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
535 purple_debug_info("media", "End of Stream\n");
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
536 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
537 case GST_MESSAGE_ERROR: {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
538 gchar *debug = NULL;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
539 GError *err = NULL;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
540
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
541 gst_message_parse_error(msg, &err, &debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
542
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
543 purple_debug_error("media", "gst pipeline error: %s\n", err->message);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
544 g_error_free(err);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
545
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
546 if (debug) {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
547 purple_debug_error("media", "Debug details: %s\n", debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
548 g_free (debug);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
549 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
550 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
551 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
552 case GST_MESSAGE_ELEMENT: {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
553 if (gst_structure_has_name(msg->structure, "farsight-error")) {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
554 gint error_no;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
555 gst_structure_get_int(msg->structure, "error-no", &error_no);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
556 purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
557 gst_structure_get_string(msg->structure, "error-msg"));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
558 } else {
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
559 gchar *name, *str;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
560 name = gst_object_get_name(GST_MESSAGE_SRC (msg));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
561 purple_debug_info("media", "element name: %s\n", name);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
562 g_free(name);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
563
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
564 str = gst_structure_to_string(msg->structure);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
565 purple_debug_info("media", "structure: %s\n", str);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
566 g_free(str);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
567 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
568 break;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
569 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
570 default:
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
571 purple_debug_info("media", "gst message type: %s\n",
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
572 GST_MESSAGE_TYPE_NAME(msg));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
573 return TRUE;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
574 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
575
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
576 return TRUE;
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
577 }
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
578
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
579 GstElement *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
580 purple_media_get_pipeline(PurpleMedia *media)
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
581 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
582 if (!media->priv->pipeline) {
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
583 GstBus *bus;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
584 media->priv->pipeline = gst_pipeline_new(media->priv->name);
23742
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
585 bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
586 gst_bus_add_signal_watch(GST_BUS(bus));
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
587 gst_bus_add_watch(bus, media_bus_call, media);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
588 gst_object_unref(bus);
a3eda57d01b5 Move the main voice and video pipeline into media.c and display more debug info.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
589
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
590 gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(media->priv->conference));
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
591 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
592
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
593 return media->priv->pipeline;
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
594 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
595
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
596 PurpleConnection *
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
597 purple_media_get_connection(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
598 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
599 PurpleConnection *gc;
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
600 g_object_get(G_OBJECT(media), "connection", &gc, NULL);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
601 return gc;
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
602 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
603
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
604 const char *
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
605 purple_media_get_screenname(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
606 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
607 const char *ret;
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
608 g_object_get(G_OBJECT(media), "screenname", &ret, NULL);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
609 return ret;
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
610 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
611
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
612 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
613 purple_media_ready(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
614 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
615 g_signal_emit(media, purple_media_signals[READY], 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
616 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
617
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
618 void
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
619 purple_media_wait(PurpleMedia *media)
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
620 {
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
621 g_signal_emit(media, purple_media_signals[WAIT], 0);
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
622 }
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
623
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
624 void
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
625 purple_media_accept(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
626 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
627 g_signal_emit(media, purple_media_signals[ACCEPTED], 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
628 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
629
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
630 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
631 purple_media_hangup(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
632 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
633 g_signal_emit(media, purple_media_signals[HANGUP], 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
634 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
635
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
636 void
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
637 purple_media_reject(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
638 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
639 g_signal_emit(media, purple_media_signals[REJECT], 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
640 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
641
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
642 void
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
643 purple_media_got_request(PurpleMedia *media)
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
644 {
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
645 g_signal_emit(media, purple_media_signals[GOT_REQUEST], 0);
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
646 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
647
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
648 void
19885
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
649 purple_media_got_hangup(PurpleMedia *media)
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
650 {
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
651 g_signal_emit(media, purple_media_signals[GOT_HANGUP], 0);
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
652 }
593613a22e57 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents: 19883
diff changeset
653
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
654 void
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
655 purple_media_got_accept(PurpleMedia *media)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
656 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
657 g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
658 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
659
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
660 gchar*
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
661 purple_media_get_device_name(GstElement *element, GValue *device)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
662 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
663 gchar *name;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
664
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
665 GstElementFactory *factory = gst_element_get_factory(element);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
666 GstElement *temp = gst_element_factory_create(factory, "tmp_src");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
667
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
668 g_object_set_property (G_OBJECT (temp), "device", device);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
669 g_object_get (G_OBJECT (temp), "device-name", &name, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
670 gst_object_unref(temp);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
671
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
672 return name;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
673 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
674
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
675 GList*
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
676 purple_media_get_devices(GstElement *element)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
677 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
678 GObjectClass *klass;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
679 GstPropertyProbe *probe;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
680 const GParamSpec *pspec;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
681
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
682 const gchar *longname = NULL;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
683
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
684 GstElementFactory *factory =
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
685 gst_element_get_factory(element);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
686
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
687 GList *ret = NULL;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
688
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
689 longname = gst_element_factory_get_longname(factory);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
690 klass = G_OBJECT_GET_CLASS(element);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
691
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
692 if (!g_object_class_find_property (klass, "device") ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
693 !GST_IS_PROPERTY_PROBE (element) ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
694 !(probe = GST_PROPERTY_PROBE (element)) ||
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
695 !(pspec = gst_property_probe_get_property (probe, "device"))) {
23699
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
696 purple_debug_info("media", "Found source '%s' (%s) - no device\n",
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
697 longname, GST_PLUGIN_FEATURE (factory)->name);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
698 } else {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
699 gint n;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
700 gchar *name;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
701 GValueArray *array;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
702
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
703 purple_debug_info("media", "Found devices\n");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
704
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
705 /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
706 if (g_object_class_find_property (klass, "autoprobe")) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
707 g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
708 if (g_object_class_find_property (klass, "autoprobe-fps")) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
709 g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
710 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
711 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
712
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
713 array = gst_property_probe_probe_and_get_values (probe, pspec);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
714 if (array != NULL) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
715
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
716 for (n = 0 ; n < array->n_values ; n++) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
717 GValue *device = g_value_array_get_nth (array, n);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
718 gst_element_set_state (element, GST_STATE_NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
719
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
720 ret = g_list_append(ret, device);
23699
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
721
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
722 name = purple_media_get_device_name(GST_ELEMENT(element), device);
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
723 purple_debug_info("media", "Found source '%s' (%s) - device '%s' (%s)\n",
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
724 longname, GST_PLUGIN_FEATURE (factory)->name,
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
725 name, g_value_get_string(device));
f21b7382aecb Fix video plugin/device preference and preview.
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
726 g_free(name);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
727 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
728 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
729 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
730
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
731 return ret;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
732 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
733
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
734 void
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
735 purple_media_element_set_device(GstElement *element, GValue *device)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
736 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
737 g_object_set_property(G_OBJECT(element), "device", device);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
738 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
739
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
740 GValue *
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
741 purple_media_element_get_device(GstElement *element)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
742 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
743 GValue *device;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
744 g_object_get(G_OBJECT(element), "device", &device, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
745 return device;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
746 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
747
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
748 GstElement *
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
749 purple_media_get_element(const gchar *factory_name)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
750 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
751 GstElementFactory *factory = gst_element_factory_find(factory_name);
26105
7647c0dcf202 * Added documentation to media.h and mediamanager.h
Michael Ruprecht <maiku@pidgin.im>
parents: 26103
diff changeset
752 GstElement *element = gst_element_factory_create(factory, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
753 gst_object_unref(factory);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
754 return element;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
755 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
756
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
757 void
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
758 purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
759 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
760 GstElement *src;
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
761 GstElement *volume;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
762 GstPad *pad;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
763 GstPad *ghost;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
764 const gchar *audio_device = purple_prefs_get_string("/purple/media/audio/device");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
765
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
766 purple_debug_info("media", "purple_media_audio_init_src\n");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
767
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
768 *sendbin = gst_bin_new("purplesendaudiobin");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
769 src = gst_element_factory_make("alsasrc", "asrc");
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
770 volume = gst_element_factory_make("volume", "purpleaudiovolume");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
771 *sendlevel = gst_element_factory_make("level", "sendlevel");
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
772 gst_bin_add_many(GST_BIN(*sendbin), src, volume, *sendlevel, NULL);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
773 gst_element_link(src, volume);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
774 gst_element_link(volume, *sendlevel);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
775 pad = gst_element_get_pad(*sendlevel, "src");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
776 ghost = gst_ghost_pad_new("ghostsrc", pad);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
777 gst_element_add_pad(*sendbin, ghost);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
778 g_object_set(G_OBJECT(*sendlevel), "message", TRUE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
779
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
780 /* set current audio device on "src"... */
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
781 if (audio_device) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
782 GList *devices = purple_media_get_devices(src);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
783 GList *dev = devices;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
784 purple_debug_info("media", "Setting device of GstElement src to %s\n",
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
785 audio_device);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
786 for (; dev ; dev = dev->next) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
787 GValue *device = (GValue *) dev->data;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
788 char *name = purple_media_get_device_name(src, device);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
789 if (strcmp(name, audio_device) == 0) {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
790 purple_media_element_set_device(src, device);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
791 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
792 g_free(name);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
793 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
794 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
795 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
796
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
797 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
798 purple_media_video_init_src(GstElement **sendbin)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
799 {
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
800 GstElement *src, *tee, *queue, *local_sink;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
801 GstPad *pad;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
802 GstPad *ghost;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
803 const gchar *video_plugin = purple_prefs_get_string("/purple/media/video/plugin");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
804 const gchar *video_device = purple_prefs_get_string("/purple/media/video/device");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
805
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
806 purple_debug_info("media", "purple_media_video_init_src\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
807
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
808 *sendbin = gst_bin_new("purplesendvideobin");
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
809 src = gst_element_factory_make(video_plugin, "purplevideosource");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
810 gst_bin_add(GST_BIN(*sendbin), src);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
811
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
812 tee = gst_element_factory_make("tee", NULL);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
813 gst_bin_add(GST_BIN(*sendbin), tee);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
814 gst_element_link(src, tee);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
815
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
816 queue = gst_element_factory_make("queue", NULL);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
817 gst_bin_add(GST_BIN(*sendbin), queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
818 gst_element_link(tee, queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
819
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
820 if (!strcmp(video_plugin, "videotestsrc")) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
821 /* unless is-live is set to true it doesn't throttle videotestsrc */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
822 g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
823 }
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
824
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
825 pad = gst_element_get_pad(queue, "src");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
826 ghost = gst_ghost_pad_new("ghostsrc", pad);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
827 gst_element_add_pad(*sendbin, ghost);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
828
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
829 queue = gst_element_factory_make("queue", NULL);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
830 gst_bin_add(GST_BIN(*sendbin), queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
831 gst_element_link(tee, queue);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
832
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
833 local_sink = gst_element_factory_make("autovideosink", "purplelocalvideosink");
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
834 gst_bin_add(GST_BIN(*sendbin), local_sink);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
835 gst_element_link(queue, local_sink);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23730
diff changeset
836
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
837 /* set current video device on "src"... */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
838 if (video_device) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
839 GList *devices = purple_media_get_devices(src);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
840 GList *dev = devices;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
841 purple_debug_info("media", "Setting device of GstElement src to %s\n",
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
842 video_device);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
843 for (; dev ; dev = dev->next) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
844 GValue *device = (GValue *) dev->data;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
845 char *name = purple_media_get_device_name(src, device);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
846 if (strcmp(name, video_device) == 0) {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
847 purple_media_element_set_device(src, device);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
848 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
849 g_free(name);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
850 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
851 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
852 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
853
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
854 void
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
855 purple_media_audio_init_recv(GstElement **recvbin, GstElement **recvlevel)
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
856 {
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
857 GstElement *sink;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
858 GstPad *pad, *ghost;
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
859
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
860 purple_debug_info("media", "purple_media_audio_init_recv\n");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
861
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
862 *recvbin = gst_bin_new("pidginrecvaudiobin");
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
863 sink = gst_element_factory_make("alsasink", "asink");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
864 g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
865 *recvlevel = gst_element_factory_make("level", "recvlevel");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
866 gst_bin_add_many(GST_BIN(*recvbin), sink, *recvlevel, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
867 gst_element_link(*recvlevel, sink);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
868 pad = gst_element_get_pad(*recvlevel, "sink");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
869 ghost = gst_ghost_pad_new("ghostsink", pad);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
870 gst_element_add_pad(*recvbin, ghost);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
871 g_object_set(G_OBJECT(*recvlevel), "message", TRUE, NULL);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
872
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
873 purple_debug_info("media", "purple_media_audio_init_recv end\n");
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
874 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22071
diff changeset
875
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
876 void
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
877 purple_media_video_init_recv(GstElement **recvbin)
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
878 {
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
879 GstElement *sink;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
880 GstPad *pad, *ghost;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
881
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
882 purple_debug_info("media", "purple_media_video_init_recv\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
883
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
884 *recvbin = gst_bin_new("pidginrecvvideobin");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
885 sink = gst_element_factory_make("autovideosink", "purplevideosink");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
886 gst_bin_add(GST_BIN(*recvbin), sink);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
887 pad = gst_element_get_pad(sink, "sink");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
888 ghost = gst_ghost_pad_new("ghostsink", pad);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
889 gst_element_add_pad(*recvbin, ghost);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
890
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
891 purple_debug_info("media", "purple_media_video_init_recv end\n");
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
892 }
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
893
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
894 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
895 purple_media_new_local_candidate_cb(FsStream *stream,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
896 FsCandidate *local_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
897 PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
898 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
899 gchar *name;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
900 FsParticipant *participant;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
901 purple_debug_info("media", "got new local candidate: %s\n", local_candidate->candidate_id);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
902 g_object_get(stream, "participant", &participant, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
903 g_object_get(participant, "cname", &name, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
904 g_object_unref(participant);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
905
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
906 purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
907
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
908 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
909 0, session->id, name, fs_candidate_copy(local_candidate));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
910
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
911 g_free(name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
912 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
913
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
914 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
915 purple_media_candidates_prepared_cb(FsStream *stream, PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
916 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
917 gchar *name;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
918 FsParticipant *participant;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
919 g_object_get(stream, "participant", &participant, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
920 g_object_get(participant, "cname", &name, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
921 g_object_unref(participant);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
922 g_signal_emit(session->media, purple_media_signals[CANDIDATES_PREPARED], 0);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
923 g_free(name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
924 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
925
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
926 /* callback called when a pair of transport candidates (local and remote)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
927 * has been established */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
928 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
929 purple_media_candidate_pair_established_cb(FsStream *stream,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
930 FsCandidate *native_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
931 FsCandidate *remote_candidate,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
932 PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
933 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
934 session->local_candidate = fs_candidate_copy(native_candidate);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
935 session->remote_candidate = fs_candidate_copy(remote_candidate);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
936
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
937 purple_debug_info("media", "candidate pair established\n");
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
938 g_signal_emit(session->media, purple_media_signals[CANDIDATE_PAIR], 0,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
939 session->local_candidate,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
940 session->remote_candidate);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
941 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
942
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
943 static void
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
944 purple_media_src_pad_added_cb(FsStream *stream, GstPad *srcpad,
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
945 FsCodec *codec, PurpleMediaSession *session)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
946 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
947 GstPad *sinkpad = gst_element_get_static_pad(session->sink, "ghostsink");
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
948 purple_debug_info("media", "connecting new src pad: %s\n",
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
949 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK ? "success" : "failure");
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
950 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
951
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
952 static gchar *
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
953 purple_media_get_stun_pref_ip()
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
954 {
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
955 const gchar *stun_pref =
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
956 purple_prefs_get_string("/purple/network/stun_server");
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
957 struct hostent *host;
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
958
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
959 if ((host = gethostbyname(stun_pref)) && host->h_addr) {
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
960 gchar *stun_ip = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
961 host->h_addr[0], host->h_addr[1],
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
962 host->h_addr[2], host->h_addr[3]);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
963 purple_debug_info("media", "IP address for %s found: %s\n",
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
964 stun_pref, stun_ip);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
965 return stun_ip;
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
966 } else {
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
967 purple_debug_info("media", "Unable to resolve %s IP address\n",
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
968 stun_pref);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
969 return NULL;
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
970 }
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
971 }
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
972
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
973 static gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
974 purple_media_add_stream_internal(PurpleMedia *media, const gchar *sess_id,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
975 const gchar *who, FsMediaType type,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
976 FsStreamDirection type_direction,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
977 const gchar *transmitter)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
978 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
979 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
980 FsParticipant *participant = NULL;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
981 FsStream *stream = NULL;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
982 FsStreamDirection *direction = NULL;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
983
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
984 if (!session) {
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
985 GError *err = NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
986 GList *codec_conf;
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
987
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
988 session = g_new0(PurpleMediaSession, 1);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
989
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
990 session->session = fs_conference_new_session(media->priv->conference, type, &err);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
991
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
992 if (err != NULL) {
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
993 purple_debug_error("media", "Error creating session: %s\n", err->message);
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
994 g_error_free(err);
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
995 purple_conv_present_error(who,
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
996 purple_connection_get_account(purple_media_get_connection(media)),
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
997 _("Error creating session."));
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
998 g_free(session);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
999 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1000 }
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1001
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1002 /*
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1003 * None of these three worked for me. THEORA is known to
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1004 * not work as of at least Farsight2 0.0.2
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1005 */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1006 codec_conf = g_list_prepend(NULL, fs_codec_new(FS_CODEC_ID_DISABLE,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1007 "THEORA", FS_MEDIA_TYPE_VIDEO, 90000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1008 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_DISABLE,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1009 "MPV", FS_MEDIA_TYPE_VIDEO, 90000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1010 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_DISABLE,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1011 "H264", FS_MEDIA_TYPE_VIDEO, 90000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1012
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1013 /* XXX: SPEEX has a latency of 5 or 6 seconds for me */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1014 #if 0
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1015 /* SPEEX is added through the configuration */
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1016 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1017 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1018 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1019 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1020 #endif
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1021
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1022 g_object_set(G_OBJECT(session->session), "local-codecs-config",
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1023 codec_conf, NULL);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1024
23726
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1025 /*
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1026 * Temporary fix to remove a 5-7 second delay before
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1027 * receiving the src-pad-added signal.
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1028 * Only works for one-to-one sessions.
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1029 * Specific to FsRtpSession.
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1030 */
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1031 g_object_set(G_OBJECT(session->session), "no-rtcp-timeout", 0, NULL);
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1032
43a5e1a3131d Temporary fix to remove a 5-7 second delay when initiating a media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
1033
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1034 fs_codec_list_destroy(codec_conf);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1035
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1036 session->id = g_strdup(sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1037 session->media = media;
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1038 session->type = purple_media_from_fs(type, type_direction);
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1039
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1040 purple_media_add_session(media, session);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1041 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1042
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1043 if (!(participant = purple_media_add_participant(media, who))) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1044 purple_media_remove_session(media, session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1045 g_free(session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1046 return FALSE;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1047 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1048
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1049 stream = purple_media_session_get_stream(session, who);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1050
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1051 if (!stream) {
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1052 GError *err = NULL;
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1053 gchar *stun_ip = NULL;
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1054
26097
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1055 if (!strcmp(transmitter, "rawudp") &&
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1056 (stun_ip = purple_media_get_stun_pref_ip())) {
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1057 GParameter param[2];
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1058 memset(param, 0, sizeof(GParameter) * 2);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1059
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1060 param[0].name = "stun-ip";
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1061 g_value_init(&param[0].value, G_TYPE_STRING);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1062 g_value_set_string(&param[0].value, stun_ip);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1063
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1064 g_free(stun_ip);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1065
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1066 param[1].name = "stun-timeout";
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1067 g_value_init(&param[1].value, G_TYPE_UINT);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1068 g_value_set_uint(&param[1].value, 5);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1069
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1070 stream = fs_session_new_stream(session->session,
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1071 participant, type_direction,
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1072 transmitter, 2, param, &err);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1073 } else {
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1074 stream = fs_session_new_stream(session->session,
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1075 participant, type_direction,
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1076 transmitter, 0, NULL, &err);
0d34ffa7c5a9 Use the purple STUN server preference with the rawudp Farsight transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
1077 }
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1078
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1079 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1080 purple_debug_error("media", "Error creating stream: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1081 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1082 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1083 g_object_unref(participant);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1084 purple_media_remove_session(media, session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1085 g_free(session);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1086 return FALSE;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1087 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1088
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1089 purple_media_insert_stream(session, who, stream);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1090 /* callback for new local candidate (new local candidate retreived) */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1091 g_signal_connect(G_OBJECT(stream),
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1092 "new-local-candidate", G_CALLBACK(purple_media_new_local_candidate_cb), session);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1093 /* callback for source pad added (new stream source ready) */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1094 g_signal_connect(G_OBJECT(stream),
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1095 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), session);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1096 /* callback for local candidates prepared (local candidates ready to send) */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1097 g_signal_connect(G_OBJECT(stream),
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1098 "local-candidates-prepared",
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1099 G_CALLBACK(purple_media_candidates_prepared_cb), session);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1100 /* callback for new active candidate pair (established connection) */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1101 g_signal_connect(G_OBJECT(stream),
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1102 "new-active-candidate-pair",
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1103 G_CALLBACK(purple_media_candidate_pair_established_cb), session);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1104 } else if (*direction != type_direction) {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1105 /* change direction */
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1106 g_object_set(stream, "direction", type_direction, NULL);
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1107 }
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1108
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1109 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1110 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1111
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1112 gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1113 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
1114 PurpleMediaSessionType type,
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1115 const gchar *transmitter)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1116 {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1117 FsStreamDirection type_direction;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1118
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1119 if (type & PURPLE_MEDIA_AUDIO) {
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1120 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_AUDIO);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1121
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1122 if (!purple_media_add_stream_internal(media, sess_id, who,
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1123 FS_MEDIA_TYPE_AUDIO, type_direction,
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1124 transmitter)) {
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1125 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1126 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1127 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1128 if (type & PURPLE_MEDIA_VIDEO) {
23724
5d3300ffacad Added some utility functions to convert PurpleMediaStreamType
Michael Ruprecht <maiku@pidgin.im>
parents: 23721
diff changeset
1129 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_VIDEO);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1130
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1131 if (!purple_media_add_stream_internal(media, sess_id, who,
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1132 FS_MEDIA_TYPE_VIDEO, type_direction,
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1133 transmitter)) {
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1134 return FALSE;
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1135 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1136 }
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23699
diff changeset
1137 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1138 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1139
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1140 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1141 purple_media_remove_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1142 {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1143
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1144 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1145
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26105
diff changeset
1146 PurpleMediaSessionType
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1147 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1148 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1149 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1150 return session->type;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1151 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1152
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1153 GList *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1154 purple_media_get_local_codecs(PurpleMedia *media, const gchar *sess_id)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1155 {
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1156 GList *codecs;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1157 g_object_get(G_OBJECT(purple_media_get_session(media, sess_id)->session),
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1158 "local-codecs", &codecs, NULL);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1159 return codecs;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1160 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1161
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1162 GList *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1163 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1164 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1165 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1166 return purple_media_session_get_local_candidates(session, name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1167 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1168
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1169 GList *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1170 purple_media_get_negotiated_codecs(PurpleMedia *media, const gchar *sess_id)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1171 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1172 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1173 GList *codec_intersection;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1174 g_object_get(session->session, "negotiated-codecs", &codec_intersection, NULL);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1175 return codec_intersection;
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1176 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1177
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1178 void
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1179 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1180 const gchar *name, GList *remote_candidates)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1181 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1182 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1183 FsStream *stream = purple_media_session_get_stream(session, name);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1184 GList *candidates = remote_candidates;
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1185 for (; candidates; candidates = candidates->next) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1186 GError *err = NULL;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1187 fs_stream_add_remote_candidate(stream, candidates->data, &err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1188
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1189 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1190 purple_debug_error("media", "Error adding remote candidate: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1191 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1192 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1193 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1194 }
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1195 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1196
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1197 FsCandidate *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1198 purple_media_get_local_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1199 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1200 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1201 return session->local_candidate;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1202 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1203
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1204 FsCandidate *
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1205 purple_media_get_remote_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1206 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1207 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1208 return session->remote_candidate;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1209 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1210
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1211 gboolean
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1212 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1213 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1214 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23711
diff changeset
1215 FsStream *stream = purple_media_session_get_stream(session, name);
23745
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1216 GError *err = NULL;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1217
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1218 fs_stream_set_remote_codecs(stream, codecs, &err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1219
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1220 if (err) {
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1221 purple_debug_error("media", "Error setting remote codecs: %s\n",
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1222 err->message);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1223 g_error_free(err);
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1224 return FALSE;
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1225 }
091a506a7018 Added better Farsight error handling.
Michael Ruprecht <maiku@pidgin.im>
parents: 23744
diff changeset
1226 return TRUE;
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1227 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
1228
23730
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1229 gboolean
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1230 purple_media_candidates_prepared(PurpleMedia *media, const gchar *name)
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1231 {
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1232 GList *sessions = purple_media_get_session_names(media);
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1233
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1234 for (; sessions; sessions = sessions->next) {
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1235 const gchar *session = sessions->data;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1236 if (!purple_media_get_local_candidate(media, session, name) ||
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1237 !purple_media_get_remote_candidate(media, session, name))
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1238 return FALSE;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1239 }
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1240
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1241 return TRUE;
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1242 }
ed15b42da75c Jingle sessions now keep track of their transaction state to a degree.
Michael Ruprecht <maiku@pidgin.im>
parents: 23726
diff changeset
1243
26102
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1244 gboolean
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1245 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, FsCodec *codec)
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1246 {
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1247 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1248 GError *err = NULL;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1249
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1250 fs_session_set_send_codec(session->session, codec, &err);
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1251
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1252 if (err) {
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1253 purple_debug_error("media", "Error setting send codec\n");
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1254 g_error_free(err);
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1255 return FALSE;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1256 }
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1257 return TRUE;
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1258 }
881a436d77eb Set the proper send codec in Farsight.
Michael Ruprecht <maiku@pidgin.im>
parents: 26097
diff changeset
1259
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1260 void purple_media_mute(PurpleMedia *media, gboolean active)
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1261 {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1262 GList *sessions = g_hash_table_get_values(media->priv->sessions);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1263 purple_debug_info("media", "Turning mute %s\n", active ? "on" : "off");
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1264
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1265 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1266 PurpleMediaSession *session = sessions->data;
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1267 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1268 GstElement *volume = gst_bin_get_by_name(
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1269 GST_BIN(session->src),
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1270 "purpleaudiovolume");
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1271 g_object_set(volume, "mute", active, NULL);
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1272 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1273 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1274 }
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26102
diff changeset
1275
23704
9b88c9b23aed Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents: 23701
diff changeset
1276 #endif /* USE_VV */

mercurial