annotate libpurple/mediamanager.c @ 26002:9a8876493f3f

Fix crash on exit during media session.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 07 Jan 2009 05:23:58 +0000
parents c7d4b67b3332
children 7be8c88d630c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
2 * @file mediamanager.c Media Manager API
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup core
23865
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
4 */
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
5
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
6 /* purple
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
27 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
28
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "connection.h"
24930
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
30 #include "debug.h"
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
31 #include "marshallers.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "mediamanager.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "media.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
35 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
37 #include <gst/farsight/fs-conference-iface.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 struct _PurpleMediaManagerPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 GList *medias;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate))
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 static void purple_media_manager_init (PurpleMediaManager *media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 static void purple_media_manager_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 enum {
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
55 INIT_MEDIA,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 static guint purple_media_manager_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 PROP_0,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 PROP_FARSIGHT_SESSION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 PROP_NAME,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 PROP_CONNECTION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 PROP_MIC_ELEMENT,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 PROP_SPEAKER_ELEMENT,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 purple_media_manager_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 sizeof(PurpleMediaManagerClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 (GClassInitFunc) purple_media_manager_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 sizeof(PurpleMediaManager),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
84 (GInstanceInitFunc) purple_media_manager_init,
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
85 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 return type;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 purple_media_manager_class_init (PurpleMediaManagerClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 gobject_class->finalize = purple_media_manager_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
101 purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media",
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 G_TYPE_FROM_CLASS (klass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 G_SIGNAL_RUN_LAST,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 0, NULL, NULL,
24983
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
105 purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
106 G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA,
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
107 G_TYPE_POINTER, G_TYPE_STRING);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
108 g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 purple_media_manager_init (PurpleMediaManager *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
115 media->priv->medias = NULL;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 purple_media_manager_finalize (GObject *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 {
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
121 PurpleMediaManagerPrivate *priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
122 for (; priv->medias; priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
123 g_list_delete_link(priv->medias, priv->medias)) {
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
124 g_object_unref(priv->medias->data);
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
125 }
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 parent_class->finalize(media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 PurpleMediaManager *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 purple_media_manager_get()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 static PurpleMediaManager *manager = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 if (manager == NULL)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 return manager;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
139 PurpleMedia *
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
140 purple_media_manager_create_media(PurpleMediaManager *manager,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 PurpleConnection *gc,
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
142 const char *conference_type,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
143 const char *remote_user,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
144 gboolean initiator)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 {
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
146 PurpleMedia *media;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
147 FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL));
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
148 GstStateChangeReturn ret;
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
149 gboolean signal_ret;
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
150
24930
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
151 if (conference == NULL) {
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
152 purple_conv_present_error(remote_user,
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
153 purple_connection_get_account(gc),
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
154 _("Error creating conference."));
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
155 purple_debug_error("media", "Conference == NULL\n");
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
156 return NULL;
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
157 }
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
158
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
159 media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
160 "conference", conference,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
161 "initiator", initiator,
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
162 NULL));
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
163
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
164 ret = gst_element_set_state(purple_media_get_pipeline(media), GST_STATE_PLAYING);
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
165
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
166 if (ret == GST_STATE_CHANGE_FAILURE) {
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
167 purple_conv_present_error(remote_user,
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
168 purple_connection_get_account(gc),
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
169 _("Error creating conference."));
24930
0baeafee93be Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
170 purple_debug_error("media", "Failed to start conference.\n");
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
171 g_object_unref(media);
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
172 return NULL;
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
173 }
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
174
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
175 g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0,
24983
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24950
diff changeset
176 media, gc, remote_user, &signal_ret);
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
177
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
178 if (signal_ret == FALSE) {
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
179 g_object_unref(media);
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
180 return NULL;
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
181 }
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
182
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 manager->priv->medias = g_list_append(manager->priv->medias, media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 return media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
187 GList *
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
188 purple_media_manager_get_media(PurpleMediaManager *manager)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
189 {
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
190 return manager->priv->medias;
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
191 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
192
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
193 void
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
194 purple_media_manager_remove_media(PurpleMediaManager *manager,
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
195 PurpleMedia *media)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
196 {
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
197 GList *list = g_list_find(manager->priv->medias, media);
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
198 if (list)
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
199 manager->priv->medias =
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
200 g_list_delete_link(manager->priv->medias, list);
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
201 }
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
202
24950
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
203 GstElement *
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
204 purple_media_manager_get_element(PurpleMediaManager *manager,
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
205 PurpleMediaSessionType type)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
206 {
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
207 GstElement *ret = NULL;
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
208 GstElement *level = NULL;
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
209
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
210 /* TODO: If src, retrieve current src */
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
211 /* TODO: Send a signal here to allow for overriding the source/sink */
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
212
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
213 if (type & PURPLE_MEDIA_SEND_AUDIO)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
214 purple_media_audio_init_src(&ret, &level);
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
215 else if (type & PURPLE_MEDIA_RECV_AUDIO)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
216 purple_media_audio_init_recv(&ret, &level);
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
217 else if (type & PURPLE_MEDIA_SEND_VIDEO)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
218 purple_media_video_init_src(&ret);
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
219 else if (type & PURPLE_MEDIA_RECV_VIDEO)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
220 purple_media_video_init_recv(&ret);
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
221
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
222 if (ret == NULL)
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
223 purple_debug_error("media", "Error creating source or sink\n");
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
224
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
225 return ret;
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
226 }
431c59a6959d Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24930
diff changeset
227
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
228 #endif /* USE_VV */