Mercurial > pidgin.yaz
annotate pidgin/gtkmedia.c @ 25694:72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 27 Jun 2008 18:44:49 +0000 |
parents | b8e0a56cd6cf |
children | a1a1f44cdecc |
rev | line source |
---|---|
25550 | 1 /** |
2 * @file media.c Account API | |
3 * @ingroup core | |
4 * | |
5 * Pidgin | |
6 * | |
7 * Pidgin is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 | |
26 #include <string.h> | |
25678
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25674
diff
changeset
|
27 #include "debug.h" |
25550 | 28 #include "internal.h" |
29 #include "connection.h" | |
30 #include "media.h" | |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
31 #include "pidgin.h" |
25550 | 32 |
33 #include "gtkmedia.h" | |
34 | |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
35 #ifdef USE_VV |
25550 | 36 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
37 #include <gst/interfaces/xoverlay.h> |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
38 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
39 typedef enum |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
40 { |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
41 /* Waiting for response */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
42 PIDGIN_MEDIA_WAITING = 1, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
43 /* Got request */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
44 PIDGIN_MEDIA_REQUESTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
45 /* Accepted call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
46 PIDGIN_MEDIA_ACCEPTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
47 /* Rejected call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
48 PIDGIN_MEDIA_REJECTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
49 } PidginMediaState; |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
50 |
25550 | 51 struct _PidginMediaPrivate |
52 { | |
53 PurpleMedia *media; | |
54 GstElement *send_level; | |
55 GstElement *recv_level; | |
56 | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
57 GtkWidget *calling; |
25550 | 58 GtkWidget *accept; |
59 GtkWidget *reject; | |
60 GtkWidget *hangup; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
61 |
25550 | 62 GtkWidget *send_progress; |
63 GtkWidget *recv_progress; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
64 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
65 PidginMediaState state; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
66 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
67 GtkWidget *display; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
68 GtkWidget *local_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
69 GtkWidget *remote_video; |
25550 | 70 }; |
71 | |
72 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
73 | |
74 static void pidgin_media_class_init (PidginMediaClass *klass); | |
75 static void pidgin_media_init (PidginMedia *media); | |
76 static void pidgin_media_finalize (GObject *object); | |
77 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
78 static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
79 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
25550 | 80 |
81 static GtkHBoxClass *parent_class = NULL; | |
82 | |
83 | |
84 | |
85 enum { | |
86 MESSAGE, | |
87 LAST_SIGNAL | |
88 }; | |
89 static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
90 | |
91 enum { | |
92 PROP_0, | |
93 PROP_MEDIA, | |
94 PROP_SEND_LEVEL, | |
95 PROP_RECV_LEVEL | |
96 }; | |
97 | |
98 GType | |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
99 pidgin_media_get_type(void) |
25550 | 100 { |
101 static GType type = 0; | |
102 | |
103 if (type == 0) { | |
104 static const GTypeInfo info = { | |
105 sizeof(PidginMediaClass), | |
106 NULL, | |
107 NULL, | |
108 (GClassInitFunc) pidgin_media_class_init, | |
109 NULL, | |
110 NULL, | |
111 sizeof(PidginMedia), | |
112 0, | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
113 (GInstanceInitFunc) pidgin_media_init, |
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
114 NULL |
25550 | 115 }; |
116 type = g_type_register_static(GTK_TYPE_HBOX, "PidginMedia", &info, 0); | |
117 } | |
118 return type; | |
119 } | |
120 | |
121 | |
122 static void | |
123 pidgin_media_class_init (PidginMediaClass *klass) | |
124 { | |
125 GObjectClass *gobject_class = (GObjectClass*)klass; | |
25679 | 126 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
25550 | 127 parent_class = g_type_class_peek_parent(klass); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
128 |
25550 | 129 gobject_class->finalize = pidgin_media_finalize; |
130 gobject_class->set_property = pidgin_media_set_property; | |
131 gobject_class->get_property = pidgin_media_get_property; | |
132 | |
133 g_object_class_install_property(gobject_class, PROP_MEDIA, | |
134 g_param_spec_object("media", | |
135 "PurpleMedia", | |
136 "The PurpleMedia associated with this media.", | |
137 PURPLE_TYPE_MEDIA, | |
138 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
139 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL, | |
140 g_param_spec_object("send-level", | |
141 "Send level", | |
142 "The GstElement of this media's send 'level'", | |
143 GST_TYPE_ELEMENT, | |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
144 G_PARAM_READWRITE)); |
25550 | 145 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL, |
146 g_param_spec_object("recv-level", | |
147 "Receive level", | |
148 "The GstElement of this media's recv 'level'", | |
149 GST_TYPE_ELEMENT, | |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
150 G_PARAM_READWRITE)); |
25550 | 151 |
152 pidgin_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass), | |
153 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
154 g_cclosure_marshal_VOID__STRING, | |
155 G_TYPE_NONE, 1, G_TYPE_STRING); | |
156 | |
157 g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
158 } | |
159 | |
160 | |
161 static void | |
162 pidgin_media_init (PidginMedia *media) | |
163 { | |
164 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
165 media->priv->calling = gtk_label_new_with_mnemonic("Calling..."); |
25550 | 166 media->priv->hangup = gtk_button_new_with_label("Hangup"); |
167 media->priv->accept = gtk_button_new_with_label("Accept"); | |
168 media->priv->reject = gtk_button_new_with_label("Reject"); | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
169 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
170 gtk_box_pack_start(GTK_BOX(media), media->priv->calling, FALSE, FALSE, 0); |
25550 | 171 gtk_box_pack_start(GTK_BOX(media), media->priv->hangup, FALSE, FALSE, 0); |
172 gtk_box_pack_start(GTK_BOX(media), media->priv->accept, FALSE, FALSE, 0); | |
173 gtk_box_pack_start(GTK_BOX(media), media->priv->reject, FALSE, FALSE, 0); | |
174 | |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
175 gtk_widget_show_all(media->priv->accept); |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
176 gtk_widget_show_all(media->priv->reject); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
177 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
178 media->priv->display = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25550 | 179 } |
180 | |
181 static gboolean | |
182 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) | |
183 { | |
184 const GstStructure *s; | |
185 const gchar *name; | |
186 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
187 gdouble rms_db; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
188 gdouble percent; |
25550 | 189 const GValue *list; |
190 const GValue *value; | |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
191 |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
192 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(message)); |
25550 | 193 |
194 if (message->type != GST_MESSAGE_ELEMENT) | |
195 return TRUE; | |
196 | |
197 s = gst_message_get_structure(message); | |
198 name = gst_structure_get_name(s); | |
199 | |
200 if (strcmp(name, "level")) | |
201 return TRUE; | |
202 | |
203 list = gst_structure_get_value(s, "rms"); | |
204 | |
205 /* Only bother with the first channel. */ | |
206 value = gst_value_list_get_value(list, 0); | |
207 rms_db = g_value_get_double(value); | |
208 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
209 percent = pow(10, rms_db / 20) * 5; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
210 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
211 if(percent > 1.0) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
212 percent = 1.0; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
213 |
25550 | 214 if (!strcmp(gst_element_get_name(src), "sendlevel")) |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
215 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress), percent); |
25550 | 216 else |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
217 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress), percent); |
25550 | 218 |
219 return TRUE; | |
220 } | |
221 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
222 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
223 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
224 pidgin_media_disconnect_levels(PurpleMedia *media, PidginMedia *gtkmedia) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
225 { |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
226 GstElement *element = purple_media_get_pipeline(media); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
227 gulong handler_id = g_signal_handler_find(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
228 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
229 NULL, G_CALLBACK(level_message_cb), gtkmedia); |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
230 if (handler_id) |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
231 g_signal_handler_disconnect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
232 handler_id); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
233 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
234 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
235 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
236 pidgin_media_finalize (GObject *media) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
237 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
238 PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
239 if (gtkmedia->priv->media) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
240 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
241 g_object_unref(gtkmedia->priv->media); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
242 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
243 if (gtkmedia->priv->send_level) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
244 gst_object_unref(gtkmedia->priv->send_level); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
245 if (gtkmedia->priv->recv_level) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
246 gst_object_unref(gtkmedia->priv->recv_level); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
247 if (gtkmedia->priv->display) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
248 gtk_widget_destroy(gtkmedia->priv->display); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
249 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
250 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
251 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
252 pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
253 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
254 g_signal_emit(gtkmedia, pidgin_media_signals[MESSAGE], 0, msg); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
255 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
256 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
257 GtkWidget * |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
258 pidgin_media_get_display_widget(GtkWidget *gtkmedia) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
259 { |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
260 return PIDGIN_MEDIA_GET_PRIVATE(gtkmedia)->display; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
261 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
262 |
25678
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25674
diff
changeset
|
263 static gboolean |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
264 create_window (GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
265 { |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
266 char *name; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
267 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
268 if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_ELEMENT) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
269 return TRUE; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
270 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
271 if (!gst_structure_has_name(message->structure, "prepare-xwindow-id")) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
272 return TRUE; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
273 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
274 name = gst_object_get_name(GST_MESSAGE_SRC (message)); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
275 purple_debug_info("gtkmedia", "prepare-xwindow-id object name: %s\n", name); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
276 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
277 /* The XOverlay's name is the sink's name with a suffix */ |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
278 if (!strncmp(name, "purplevideosink", strlen("purplevideosink"))) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
279 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
280 GDK_WINDOW_XWINDOW(gtkmedia->priv->remote_video->window)); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
281 else if (!strncmp(name, "purplelocalvideosink", strlen("purplelocalvideosink"))) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
282 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
283 GDK_WINDOW_XWINDOW(gtkmedia->priv->local_video->window)); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
284 g_free(name); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
285 return TRUE; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
286 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
287 |
25550 | 288 static void |
289 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia) | |
290 { | |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
291 GstElement *element = purple_media_get_pipeline(media); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
292 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
293 GstElement *audiosendbin = NULL, *audiosendlevel = NULL; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
294 GstElement *audiorecvbin = NULL, *audiorecvlevel = NULL; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
295 GstElement *videosendbin = NULL; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
296 GstElement *videorecvbin = NULL; |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
297 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
298 GList *sessions = purple_media_get_session_names(media); |
25678
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25674
diff
changeset
|
299 GstBus *bus; |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
300 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
301 for (; sessions; sessions = sessions->next) { |
25674
bfaad8393463
Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25671
diff
changeset
|
302 if (purple_media_get_session_type(media, sessions->data) & PURPLE_MEDIA_AUDIO) { |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
303 if (!audiosendbin) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
304 purple_media_audio_init_src(&audiosendbin, &audiosendlevel); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
305 if (!audiorecvbin) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
306 purple_media_audio_init_recv(&audiorecvbin, &audiorecvlevel); |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
307 purple_media_set_src(media, sessions->data, audiosendbin); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
308 purple_media_set_sink(media, sessions->data, audiorecvbin); |
25674
bfaad8393463
Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25671
diff
changeset
|
309 } else if (purple_media_get_session_type(media, sessions->data) & PURPLE_MEDIA_VIDEO) { |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
310 if (!videosendbin) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
311 purple_media_video_init_src(&videosendbin); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
312 if (!videorecvbin) |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
313 purple_media_video_init_recv(&videorecvbin); |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
314 purple_media_set_src(media, sessions->data, videosendbin); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
315 purple_media_set_sink(media, sessions->data, videorecvbin); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
316 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
317 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
318 g_list_free(sessions); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
319 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
320 if (audiosendlevel && audiorecvlevel) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
321 g_object_set(gtkmedia, "send-level", audiosendlevel, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
322 "recv-level", audiorecvlevel, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
323 NULL); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
324 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
325 |
25694
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
326 bus = gst_pipeline_get_bus(GST_PIPELINE(element)); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
327 gst_bus_add_signal_watch(GST_BUS(bus)); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
328 g_signal_connect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
329 "message", G_CALLBACK(level_message_cb), gtkmedia); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
330 if (videorecvbin || videosendbin) |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
331 gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
332 gst_object_unref(bus); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
333 } |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
334 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
335 static void |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
336 pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
337 { |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
338 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
339 } |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
340 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
341 /* maybe we should have different callbacks for when we received the accept |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
342 and we accepted ourselves */ |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
343 static void |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
344 pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
345 { |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
346 GtkWidget *send_widget = NULL, *recv_widget = NULL; |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
347 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
348 GstElement *audiosendbin = NULL; |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
349 GstElement *audiorecvbin = NULL; |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
350 GstElement *videosendbin = NULL; |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
351 GstElement *videorecvbin = NULL; |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
352 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
353 pidgin_media_emit_message(gtkmedia, _("Call in progress.")); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
354 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
355 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
356 purple_media_get_elements(media, &audiosendbin, &audiorecvbin, |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
357 &videosendbin, &videorecvbin); |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25693
diff
changeset
|
358 |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
359 recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25691
b4696e229c6d
Add proper padding to the voice conference audio levels.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25689
diff
changeset
|
360 send_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
361 |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
362 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), recv_widget, TRUE, TRUE, 0); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
363 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), send_widget, TRUE, TRUE, 0); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
364 |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
365 gtk_widget_show(recv_widget); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
366 gtk_widget_show(send_widget); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
367 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
368 if (videorecvbin || videosendbin) { |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
369 GtkWidget *aspect; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
370 GtkWidget *remote_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
371 GtkWidget *local_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
372 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
373 gtk_widget_show(gtkmedia->priv->display); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
374 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
375 aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
376 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
377 gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
378 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
379 remote_video = gtk_drawing_area_new(); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
380 gtk_container_add(GTK_CONTAINER(aspect), remote_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
381 gtk_widget_set_size_request (GTK_WIDGET(remote_video), 100, -1); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
382 gtk_widget_show(remote_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
383 gtk_widget_show(aspect); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
384 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
385 aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
386 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
387 gtk_box_pack_start(GTK_BOX(send_widget), aspect, TRUE, TRUE, 0); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
388 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
389 local_video = gtk_drawing_area_new(); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
390 gtk_container_add(GTK_CONTAINER(aspect), local_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
391 gtk_widget_show(local_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
392 gtk_widget_show(aspect); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
393 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
394 gtkmedia->priv->local_video = local_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
395 gtkmedia->priv->remote_video = remote_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
396 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
397 |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
398 if (audiorecvbin || audiosendbin) { |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
399 gtk_widget_show(gtkmedia->priv->display); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
400 |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
401 gtkmedia->priv->send_progress = gtk_progress_bar_new(); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
402 gtkmedia->priv->recv_progress = gtk_progress_bar_new(); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
403 |
25689
c17d26b6f236
Widened the vertical audio levels.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25688
diff
changeset
|
404 gtk_widget_set_size_request(gtkmedia->priv->send_progress, 10, 70); |
c17d26b6f236
Widened the vertical audio levels.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25688
diff
changeset
|
405 gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 10, 70); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
406 |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
407 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress), |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
408 GTK_PROGRESS_BOTTOM_TO_TOP); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
409 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress), |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
410 GTK_PROGRESS_BOTTOM_TO_TOP); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
411 |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
412 gtk_box_pack_start(GTK_BOX(send_widget), |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
413 gtkmedia->priv->send_progress, FALSE, FALSE, 0); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
414 gtk_box_pack_start(GTK_BOX(recv_widget), |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
415 gtkmedia->priv->recv_progress, FALSE, FALSE, 0); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
416 |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
417 gtk_widget_show(gtkmedia->priv->send_progress); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
418 gtk_widget_show(gtkmedia->priv->recv_progress); |
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
419 } |
25550 | 420 } |
421 | |
422 static void | |
423 pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia) | |
424 { | |
425 pidgin_media_emit_message(gtkmedia, _("You have ended the call.")); | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
426 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
25550 | 427 } |
428 | |
429 static void | |
25687
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
430 pidgin_media_got_request_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
431 { |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
432 PurpleMediaStreamType type = purple_media_get_overall_type(media); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
433 gchar *message; |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
434 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
435 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
436 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
437 purple_media_get_screenname(media)); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
438 } else if (type & PURPLE_MEDIA_AUDIO) { |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
439 message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
440 purple_media_get_screenname(media)); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
441 } else if (type & PURPLE_MEDIA_VIDEO) { |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
442 message = g_strdup_printf(_("%s wishes to start a video session with you."), |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
443 purple_media_get_screenname(media)); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
444 } else { |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
445 return; |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
446 } |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
447 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
448 pidgin_media_emit_message(gtkmedia, message); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
449 g_free(message); |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
450 } |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
451 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
452 static void |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
453 pidgin_media_got_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
454 { |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
455 pidgin_media_emit_message(gtkmedia, _("The call has been terminated.")); |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
456 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
457 } |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
458 |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
459 static void |
25550 | 460 pidgin_media_reject_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
461 { | |
462 pidgin_media_emit_message(gtkmedia, _("You have rejected the call.")); | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
463 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
25550 | 464 } |
465 | |
466 static void | |
467 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | |
468 { | |
469 PidginMedia *media; | |
470 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
471 |
25550 | 472 media = PIDGIN_MEDIA(object); |
473 switch (prop_id) { | |
474 case PROP_MEDIA: | |
475 if (media->priv->media) | |
476 g_object_unref(media->priv->media); | |
477 media->priv->media = g_value_get_object(value); | |
478 g_object_ref(media->priv->media); | |
479 g_signal_connect_swapped(G_OBJECT(media->priv->accept), "clicked", | |
480 G_CALLBACK(purple_media_accept), media->priv->media); | |
481 g_signal_connect_swapped(G_OBJECT(media->priv->reject), "clicked", | |
482 G_CALLBACK(purple_media_reject), media->priv->media); | |
483 g_signal_connect_swapped(G_OBJECT(media->priv->hangup), "clicked", | |
484 G_CALLBACK(purple_media_hangup), media->priv->media); | |
485 | |
486 g_signal_connect(G_OBJECT(media->priv->media), "accepted", | |
487 G_CALLBACK(pidgin_media_accept_cb), media); | |
488 g_signal_connect(G_OBJECT(media->priv->media) ,"ready", | |
489 G_CALLBACK(pidgin_media_ready_cb), media); | |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
490 g_signal_connect(G_OBJECT(media->priv->media) ,"wait", |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
491 G_CALLBACK(pidgin_media_wait_cb), media); |
25550 | 492 g_signal_connect(G_OBJECT(media->priv->media), "hangup", |
493 G_CALLBACK(pidgin_media_hangup_cb), media); | |
494 g_signal_connect(G_OBJECT(media->priv->media), "reject", | |
495 G_CALLBACK(pidgin_media_reject_cb), media); | |
25687
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
496 g_signal_connect(G_OBJECT(media->priv->media), "got-request", |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
497 G_CALLBACK(pidgin_media_got_request_cb), media); |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
498 g_signal_connect(G_OBJECT(media->priv->media), "got-hangup", |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
499 G_CALLBACK(pidgin_media_got_hangup_cb), media); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
500 g_signal_connect(G_OBJECT(media->priv->media), "got-accept", |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
501 G_CALLBACK(pidgin_media_accept_cb), media); |
25550 | 502 break; |
503 case PROP_SEND_LEVEL: | |
504 if (media->priv->send_level) | |
505 gst_object_unref(media->priv->send_level); | |
506 media->priv->send_level = g_value_get_object(value); | |
507 g_object_ref(media->priv->send_level); | |
508 break; | |
509 case PROP_RECV_LEVEL: | |
510 if (media->priv->recv_level) | |
511 gst_object_unref(media->priv->recv_level); | |
512 media->priv->recv_level = g_value_get_object(value); | |
513 g_object_ref(media->priv->recv_level); | |
514 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
515 default: |
25550 | 516 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
517 break; | |
518 } | |
519 } | |
520 | |
521 static void | |
522 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
523 { | |
524 PidginMedia *media; | |
525 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
526 |
25550 | 527 media = PIDGIN_MEDIA(object); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
528 |
25550 | 529 switch (prop_id) { |
530 case PROP_MEDIA: | |
531 g_value_set_object(value, media->priv->media); | |
532 break; | |
533 case PROP_SEND_LEVEL: | |
534 g_value_set_object(value, media->priv->send_level); | |
535 break; | |
536 case PROP_RECV_LEVEL: | |
537 g_value_set_object(value, media->priv->recv_level); | |
538 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
539 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
540 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
25550 | 541 break; |
542 } | |
543 } | |
544 | |
545 GtkWidget * | |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
546 pidgin_media_new(PurpleMedia *media) |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
547 { |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
548 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
549 "media", media, NULL); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
550 return GTK_WIDGET(gtkmedia); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
551 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
552 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
553 static void |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
554 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
25550 | 555 { |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
556 gtkmedia->priv->state = state; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
557 switch (state) { |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
558 case PIDGIN_MEDIA_WAITING: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
559 gtk_widget_show(gtkmedia->priv->calling); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
560 gtk_widget_hide(gtkmedia->priv->accept); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
561 gtk_widget_hide(gtkmedia->priv->reject); |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
562 gtk_widget_show(gtkmedia->priv->hangup); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
563 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
564 case PIDGIN_MEDIA_REQUESTED: |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
565 gtk_widget_hide(gtkmedia->priv->calling); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
566 gtk_widget_show(gtkmedia->priv->accept); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
567 gtk_widget_show(gtkmedia->priv->reject); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
568 gtk_widget_hide(gtkmedia->priv->hangup); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
569 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
570 case PIDGIN_MEDIA_ACCEPTED: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
571 gtk_widget_show(gtkmedia->priv->hangup); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
572 gtk_widget_hide(gtkmedia->priv->calling); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
573 gtk_widget_hide(gtkmedia->priv->accept); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
574 gtk_widget_hide(gtkmedia->priv->reject); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
575 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
576 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
577 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
578 } |
25550 | 579 } |
580 | |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
581 #endif /* USE_VV */ |