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