annotate libpurple/mediamanager.c @ 23804:cbe97caec684

Use USE_VV instead of USE_FARSIGHT.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 28 May 2008 21:00:40 +0000
parents 43b3b9ff6028
children 1c68f78414b7
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
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * purple
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
26 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
27
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "connection.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "mediamanager.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "media.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
32 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
34 #include <gst/farsight/fs-conference-iface.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 struct _PurpleMediaManagerPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 GList *medias;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #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
42
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 static void purple_media_manager_init (PurpleMediaManager *media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 static void purple_media_manager_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 enum {
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
52 INIT_MEDIA,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 static guint purple_media_manager_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 PROP_0,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 PROP_FARSIGHT_SESSION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 PROP_NAME,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 PROP_CONNECTION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 PROP_MIC_ELEMENT,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 PROP_SPEAKER_ELEMENT,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 purple_media_manager_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 sizeof(PurpleMediaManagerClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 (GClassInitFunc) purple_media_manager_class_init,
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 sizeof(PurpleMediaManager),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
81 (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
82 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 return type;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 purple_media_manager_class_init (PurpleMediaManagerClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 parent_class = g_type_class_peek_parent(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 gobject_class->finalize = purple_media_manager_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
98 purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media",
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 G_TYPE_FROM_CLASS (klass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 G_SIGNAL_RUN_LAST,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 0, NULL, NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 g_cclosure_marshal_VOID__OBJECT,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 G_TYPE_NONE, 1, PURPLE_TYPE_MEDIA);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
104 g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 purple_media_manager_init (PurpleMediaManager *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
23761
2fda71133800 Some UI ;)
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
111 media->priv->medias = NULL;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 purple_media_manager_finalize (GObject *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 parent_class->finalize(media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 PurpleMediaManager *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 purple_media_manager_get()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 static PurpleMediaManager *manager = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 if (manager == NULL)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 return manager;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
130 PurpleMedia *
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
131 purple_media_manager_create_media(PurpleMediaManager *manager,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 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
133 const char *conference_type,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23772
diff changeset
134 const char *remote_user)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 {
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
136 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
137 FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL));
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
138 GstStateChangeReturn ret = gst_element_set_state(GST_ELEMENT(conference), GST_STATE_READY);
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
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
140 if (ret == GST_STATE_CHANGE_FAILURE) {
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
141 purple_conv_present_error(remote_user,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
142 purple_connection_get_account(gc),
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
143 _("Error creating conference."));
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
144 return NULL;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
145 }
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
146
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
147 media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
148 "screenname", remote_user,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
149 "connection", gc,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
150 "farsight-conference", conference,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
151 NULL));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 manager->priv->medias = g_list_append(manager->priv->medias, media);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23761
diff changeset
153 g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 return media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
157 #endif /* USE_VV */