Mercurial > pidgin
annotate pidgin/gtkmedia.c @ 24937:5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
This will make codecs that need extra configuration, such as THEORA and
H264, work consistently.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 05 Sep 2008 02:18:15 +0000 |
parents | ba609f368dc8 |
children | bd598b606ca4 |
rev | line source |
---|---|
23764 | 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> | |
23828
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
27 #include "debug.h" |
23764 | 28 #include "internal.h" |
29 #include "connection.h" | |
30 #include "media.h" | |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
31 #include "pidgin.h" |
23764 | 32 |
33 #include "gtkmedia.h" | |
34 | |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23801
diff
changeset
|
35 #ifdef USE_VV |
23764 | 36 |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
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:
23829
diff
changeset
|
38 |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
39 typedef enum |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
40 { |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
41 /* Waiting for response */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
42 PIDGIN_MEDIA_WAITING = 1, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
43 /* Got request */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
44 PIDGIN_MEDIA_REQUESTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
45 /* Accepted call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
46 PIDGIN_MEDIA_ACCEPTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
47 /* Rejected call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
48 PIDGIN_MEDIA_REJECTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
49 } PidginMediaState; |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
50 |
23764 | 51 struct _PidginMediaPrivate |
52 { | |
53 PurpleMedia *media; | |
54 GstElement *send_level; | |
55 GstElement *recv_level; | |
56 | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
57 GtkWidget *calling; |
23764 | 58 GtkWidget *accept; |
59 GtkWidget *reject; | |
60 GtkWidget *hangup; | |
23863
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
61 GtkWidget *mute; |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
62 |
23764 | 63 GtkWidget *send_progress; |
64 GtkWidget *recv_progress; | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
65 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
66 PidginMediaState state; |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
67 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
68 GtkWidget *display; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
69 GtkWidget *local_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
70 GtkWidget *remote_video; |
23764 | 71 }; |
72 | |
73 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
74 | |
75 static void pidgin_media_class_init (PidginMediaClass *klass); | |
76 static void pidgin_media_init (PidginMedia *media); | |
77 static void pidgin_media_finalize (GObject *object); | |
78 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
79 static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
80 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
23764 | 81 |
82 static GtkHBoxClass *parent_class = NULL; | |
83 | |
84 | |
85 | |
86 enum { | |
87 MESSAGE, | |
88 LAST_SIGNAL | |
89 }; | |
90 static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
91 | |
92 enum { | |
93 PROP_0, | |
94 PROP_MEDIA, | |
95 PROP_SEND_LEVEL, | |
96 PROP_RECV_LEVEL | |
97 }; | |
98 | |
99 GType | |
23784
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
100 pidgin_media_get_type(void) |
23764 | 101 { |
102 static GType type = 0; | |
103 | |
104 if (type == 0) { | |
105 static const GTypeInfo info = { | |
106 sizeof(PidginMediaClass), | |
107 NULL, | |
108 NULL, | |
109 (GClassInitFunc) pidgin_media_class_init, | |
110 NULL, | |
111 NULL, | |
112 sizeof(PidginMedia), | |
113 0, | |
23773
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23764
diff
changeset
|
114 (GInstanceInitFunc) pidgin_media_init, |
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23764
diff
changeset
|
115 NULL |
23764 | 116 }; |
117 type = g_type_register_static(GTK_TYPE_HBOX, "PidginMedia", &info, 0); | |
118 } | |
119 return type; | |
120 } | |
121 | |
122 | |
123 static void | |
124 pidgin_media_class_init (PidginMediaClass *klass) | |
125 { | |
126 GObjectClass *gobject_class = (GObjectClass*)klass; | |
23829 | 127 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
23764 | 128 parent_class = g_type_class_peek_parent(klass); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
129 |
23764 | 130 gobject_class->finalize = pidgin_media_finalize; |
131 gobject_class->set_property = pidgin_media_set_property; | |
132 gobject_class->get_property = pidgin_media_get_property; | |
133 | |
134 g_object_class_install_property(gobject_class, PROP_MEDIA, | |
135 g_param_spec_object("media", | |
136 "PurpleMedia", | |
137 "The PurpleMedia associated with this media.", | |
138 PURPLE_TYPE_MEDIA, | |
139 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
140 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL, | |
141 g_param_spec_object("send-level", | |
142 "Send level", | |
143 "The GstElement of this media's send 'level'", | |
144 GST_TYPE_ELEMENT, | |
23821
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:
23804
diff
changeset
|
145 G_PARAM_READWRITE)); |
23764 | 146 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL, |
147 g_param_spec_object("recv-level", | |
148 "Receive level", | |
149 "The GstElement of this media's recv 'level'", | |
150 GST_TYPE_ELEMENT, | |
23821
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:
23804
diff
changeset
|
151 G_PARAM_READWRITE)); |
23764 | 152 |
153 pidgin_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass), | |
154 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
155 g_cclosure_marshal_VOID__STRING, | |
156 G_TYPE_NONE, 1, G_TYPE_STRING); | |
157 | |
158 g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
159 } | |
160 | |
23863
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
161 static void |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
162 pidgin_media_mute_toggled(GtkToggleButton *toggle, PidginMedia *media) |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
163 { |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
164 purple_media_mute(media->priv->media, |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
165 gtk_toggle_button_get_active(toggle)); |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
166 } |
23764 | 167 |
168 static void | |
169 pidgin_media_init (PidginMedia *media) | |
170 { | |
171 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
172 media->priv->calling = gtk_label_new_with_mnemonic("Calling..."); |
23764 | 173 media->priv->hangup = gtk_button_new_with_label("Hangup"); |
174 media->priv->accept = gtk_button_new_with_label("Accept"); | |
175 media->priv->reject = gtk_button_new_with_label("Reject"); | |
23863
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
176 media->priv->mute = gtk_toggle_button_new_with_label("Mute"); |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
177 |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
178 g_signal_connect(media->priv->mute, "toggled", |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
179 G_CALLBACK(pidgin_media_mute_toggled), media); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
180 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
181 gtk_box_pack_start(GTK_BOX(media), media->priv->calling, FALSE, FALSE, 0); |
23764 | 182 gtk_box_pack_start(GTK_BOX(media), media->priv->hangup, FALSE, FALSE, 0); |
183 gtk_box_pack_start(GTK_BOX(media), media->priv->accept, FALSE, FALSE, 0); | |
184 gtk_box_pack_start(GTK_BOX(media), media->priv->reject, FALSE, FALSE, 0); | |
23863
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
185 gtk_box_pack_end(GTK_BOX(media), media->priv->mute, FALSE, FALSE, 0); |
23764 | 186 |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
187 gtk_widget_show_all(media->priv->accept); |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
188 gtk_widget_show_all(media->priv->reject); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
189 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
190 media->priv->display = gtk_vbox_new(TRUE, PIDGIN_HIG_BOX_SPACE); |
23764 | 191 } |
192 | |
193 static gboolean | |
194 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) | |
195 { | |
196 const GstStructure *s; | |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
197 gchar *name; |
23764 | 198 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
199 gdouble rms_db; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
200 gdouble percent; |
23764 | 201 const GValue *list; |
202 const GValue *value; | |
23784
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
203 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
204 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(message)); |
23764 | 205 |
206 if (message->type != GST_MESSAGE_ELEMENT) | |
207 return TRUE; | |
208 | |
209 s = gst_message_get_structure(message); | |
210 | |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
211 if (strcmp(gst_structure_get_name(s), "level")) |
23764 | 212 return TRUE; |
213 | |
214 list = gst_structure_get_value(s, "rms"); | |
215 | |
216 /* Only bother with the first channel. */ | |
217 value = gst_value_list_get_value(list, 0); | |
218 rms_db = g_value_get_double(value); | |
219 | |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
220 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:
23793
diff
changeset
|
221 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
222 if(percent > 1.0) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
223 percent = 1.0; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
224 |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
225 name = gst_element_get_name(src); |
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
226 if (!strcmp(name, "sendlevel")) |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
227 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress), percent); |
23764 | 228 else |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
229 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress), percent); |
23764 | 230 |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
231 g_free(name); |
23764 | 232 return TRUE; |
233 } | |
234 | |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
235 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
236 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
237 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:
23793
diff
changeset
|
238 { |
23821
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:
23804
diff
changeset
|
239 GstElement *element = purple_media_get_pipeline(media); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
240 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:
23793
diff
changeset
|
241 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:
23793
diff
changeset
|
242 NULL, G_CALLBACK(level_message_cb), gtkmedia); |
23801
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
243 if (handler_id) |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
244 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:
23797
diff
changeset
|
245 handler_id); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
246 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
247 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
248 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
249 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:
23793
diff
changeset
|
250 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
251 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:
23793
diff
changeset
|
252 if (gtkmedia->priv->media) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
253 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:
23793
diff
changeset
|
254 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:
23793
diff
changeset
|
255 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
256 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:
23793
diff
changeset
|
257 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:
23793
diff
changeset
|
258 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:
23793
diff
changeset
|
259 gst_object_unref(gtkmedia->priv->recv_level); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
260 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:
23829
diff
changeset
|
261 gtk_widget_destroy(gtkmedia->priv->display); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
262 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
263 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
264 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
265 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:
23793
diff
changeset
|
266 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
267 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:
23793
diff
changeset
|
268 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23793
diff
changeset
|
269 |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
270 GtkWidget * |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
271 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:
23829
diff
changeset
|
272 { |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
273 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:
23829
diff
changeset
|
274 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
275 |
23828
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
276 static gboolean |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
277 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:
23829
diff
changeset
|
278 { |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
279 char *name; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
280 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
281 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:
23829
diff
changeset
|
282 return TRUE; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
283 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
284 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:
23829
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:
23829
diff
changeset
|
286 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
287 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:
23829
diff
changeset
|
288 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:
23829
diff
changeset
|
289 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
290 /* 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:
23829
diff
changeset
|
291 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:
23829
diff
changeset
|
292 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:
23829
diff
changeset
|
293 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:
23829
diff
changeset
|
294 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:
23829
diff
changeset
|
295 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:
23829
diff
changeset
|
296 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:
23829
diff
changeset
|
297 g_free(name); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
298 return TRUE; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
299 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
300 |
23764 | 301 static void |
302 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia) | |
303 { | |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
304 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:
23829
diff
changeset
|
305 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:
23829
diff
changeset
|
306 GstElement *videosendbin = NULL; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
307 GstElement *videorecvbin = NULL; |
23821
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:
23804
diff
changeset
|
308 |
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:
23804
diff
changeset
|
309 GList *sessions = purple_media_get_session_names(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:
23804
diff
changeset
|
310 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23844
diff
changeset
|
311 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
312 PurpleMediaSessionType type = purple_media_get_session_type(media, sessions->data); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
313 if (type & PURPLE_MEDIA_AUDIO) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
314 if (!audiosendbin && (type & PURPLE_MEDIA_SEND_AUDIO)) { |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
315 purple_media_audio_init_src(&audiosendbin, &audiosendlevel); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
316 purple_media_set_src(media, sessions->data, audiosendbin); |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
317 gst_element_set_state(audiosendbin, GST_STATE_PLAYING); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
318 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
319 if (!audiorecvbin && (type & PURPLE_MEDIA_RECV_AUDIO)) { |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
320 purple_media_audio_init_recv(&audiorecvbin, &audiorecvlevel); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
321 purple_media_set_sink(media, sessions->data, audiorecvbin); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
322 gst_element_set_state(audiorecvbin, GST_STATE_READY); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
323 } |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
324 } else if (type & PURPLE_MEDIA_VIDEO) { |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
325 if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) { |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
326 purple_media_video_init_src(&videosendbin); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
327 purple_media_set_src(media, sessions->data, videosendbin); |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
328 gst_element_set_state(videosendbin, GST_STATE_PLAYING); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
329 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
330 if (!videorecvbin && (type & PURPLE_MEDIA_RECV_VIDEO)) { |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
331 purple_media_video_init_recv(&videorecvbin); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
332 purple_media_set_sink(media, sessions->data, videorecvbin); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
333 gst_element_set_state(videorecvbin, GST_STATE_READY); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
334 } |
23821
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:
23804
diff
changeset
|
335 } |
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:
23804
diff
changeset
|
336 } |
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:
23804
diff
changeset
|
337 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
338 if (audiosendlevel || audiorecvlevel) { |
23821
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:
23804
diff
changeset
|
339 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:
23804
diff
changeset
|
340 "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:
23804
diff
changeset
|
341 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:
23804
diff
changeset
|
342 } |
23844
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
343 } |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
344 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
345 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:
23843
diff
changeset
|
346 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:
23843
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:
23843
diff
changeset
|
348 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:
23843
diff
changeset
|
349 } |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
350 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
351 /* 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:
23843
diff
changeset
|
352 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:
23843
diff
changeset
|
353 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:
23843
diff
changeset
|
354 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:
23843
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:
23843
diff
changeset
|
356 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:
23843
diff
changeset
|
357 |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
358 GstElement *pipeline = purple_media_get_pipeline(media); |
23844
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
359 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:
23843
diff
changeset
|
360 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:
23843
diff
changeset
|
361 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:
23843
diff
changeset
|
362 GstElement *videorecvbin = NULL; |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
363 GstBus *bus; |
23844
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
364 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
365 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:
23843
diff
changeset
|
366 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:
23843
diff
changeset
|
367 |
72e738dac5f7
Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23843
diff
changeset
|
368 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:
23843
diff
changeset
|
369 &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:
23843
diff
changeset
|
370 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
371 if (videorecvbin || audiorecvbin) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
372 recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
373 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
374 recv_widget, TRUE, TRUE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
375 gtk_widget_show(recv_widget); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
376 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
377 if (videosendbin || audiosendbin) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
378 send_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
379 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
380 send_widget, TRUE, TRUE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
381 gtk_widget_show(send_widget); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
382 } |
23838
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
383 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
384 if (videorecvbin) { |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
385 GtkWidget *aspect; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
386 GtkWidget *remote_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
387 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
388 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:
23829
diff
changeset
|
389 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
23843
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23842
diff
changeset
|
390 gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
391 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
392 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:
23829
diff
changeset
|
393 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:
23829
diff
changeset
|
394 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:
23829
diff
changeset
|
395 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:
23829
diff
changeset
|
396 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:
23829
diff
changeset
|
397 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
398 gtkmedia->priv->remote_video = remote_video; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
399 gst_element_set_state(videorecvbin, GST_STATE_PLAYING); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
400 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
401 if (videosendbin) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
402 GtkWidget *aspect; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
403 GtkWidget *local_video; |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
404 GstElement *tee, *queue; |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
405 |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
406 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:
23829
diff
changeset
|
407 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
23843
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23842
diff
changeset
|
408 gtk_box_pack_start(GTK_BOX(send_widget), aspect, TRUE, TRUE, 0); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
409 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
410 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:
23829
diff
changeset
|
411 gtk_container_add(GTK_CONTAINER(aspect), local_video); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
412 gtk_widget_set_size_request (GTK_WIDGET(local_video), 100, -1); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
413 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:
23829
diff
changeset
|
414 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:
23829
diff
changeset
|
415 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
416 gtkmedia->priv->local_video = local_video; |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
417 |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
418 tee = gst_bin_get_by_name(GST_BIN(videosendbin), "purplevideosrctee"); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
419 queue = gst_bin_get_by_name(GST_BIN(videosendbin), "purplelocalvideoqueue"); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
420 gst_element_link(tee, queue); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
421 gst_object_unref(tee); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23913
diff
changeset
|
422 gst_object_unref(queue); |
23836
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
423 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23829
diff
changeset
|
424 |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
425 if (audiorecvbin) { |
23838
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
426 gtkmedia->priv->recv_progress = gtk_progress_bar_new(); |
23839
c17d26b6f236
Widened the vertical audio levels.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23838
diff
changeset
|
427 gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 10, 70); |
23838
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
428 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:
23837
diff
changeset
|
429 GTK_PROGRESS_BOTTOM_TO_TOP); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
430 gtk_box_pack_end(GTK_BOX(recv_widget), |
23838
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
431 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:
23837
diff
changeset
|
432 gtk_widget_show(gtkmedia->priv->recv_progress); |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
433 gst_element_set_state(audiorecvbin, GST_STATE_PLAYING); |
23838
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
434 } |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
435 if (audiosendbin) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
436 gtkmedia->priv->send_progress = gtk_progress_bar_new(); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
437 gtk_widget_set_size_request(gtkmedia->priv->send_progress, 10, 70); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
438 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress), |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
439 GTK_PROGRESS_BOTTOM_TO_TOP); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
440 gtk_box_pack_end(GTK_BOX(send_widget), |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
441 gtkmedia->priv->send_progress, FALSE, FALSE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
442 gtk_widget_show(gtkmedia->priv->send_progress); |
23875
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
443 |
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
444 gtk_widget_show(gtkmedia->priv->mute); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
445 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
446 |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
447 if (audiorecvbin || audiosendbin || videorecvbin || videosendbin) |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
448 gtk_widget_show(gtkmedia->priv->display); |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
449 |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
450 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
23913
ba609f368dc8
Fix GStreamer assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23877
diff
changeset
|
451 if (audiorecvbin || audiosendbin) |
ba609f368dc8
Fix GStreamer assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23877
diff
changeset
|
452 g_signal_connect(G_OBJECT(bus), "message::element", |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
453 G_CALLBACK(level_message_cb), gtkmedia); |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
454 if (videorecvbin || videosendbin) |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
455 gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia); |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
456 gst_object_unref(bus); |
23764 | 457 } |
458 | |
459 static void | |
460 pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia) | |
461 { | |
462 pidgin_media_emit_message(gtkmedia, _("You have ended the call.")); | |
23773
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23764
diff
changeset
|
463 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
23764 | 464 } |
465 | |
466 static void | |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
467 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:
23836
diff
changeset
|
468 { |
23869
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23863
diff
changeset
|
469 PurpleMediaSessionType type = purple_media_get_overall_type(media); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
470 gchar *message; |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
471 gchar *name = purple_media_get_screenname(media); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
472 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
473 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:
23836
diff
changeset
|
474 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
475 name); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
476 } 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:
23836
diff
changeset
|
477 message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
478 name); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
479 } 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:
23836
diff
changeset
|
480 message = g_strdup_printf(_("%s wishes to start a video session with you."), |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
481 name); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
482 } else { |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
483 g_free(name); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
484 return; |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
485 } |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
486 |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23875
diff
changeset
|
487 g_free(name); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
488 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:
23836
diff
changeset
|
489 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:
23836
diff
changeset
|
490 } |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
491 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
492 static void |
23784
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
493 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:
23773
diff
changeset
|
494 { |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
495 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:
23773
diff
changeset
|
496 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
497 } |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
498 |
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
499 static void |
23764 | 500 pidgin_media_reject_cb(PurpleMedia *media, PidginMedia *gtkmedia) |
501 { | |
502 pidgin_media_emit_message(gtkmedia, _("You have rejected the call.")); | |
23773
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23764
diff
changeset
|
503 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
23764 | 504 } |
505 | |
506 static void | |
507 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | |
508 { | |
509 PidginMedia *media; | |
510 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
23784
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
511 |
23764 | 512 media = PIDGIN_MEDIA(object); |
513 switch (prop_id) { | |
514 case PROP_MEDIA: | |
515 if (media->priv->media) | |
516 g_object_unref(media->priv->media); | |
517 media->priv->media = g_value_get_object(value); | |
518 g_object_ref(media->priv->media); | |
519 g_signal_connect_swapped(G_OBJECT(media->priv->accept), "clicked", | |
520 G_CALLBACK(purple_media_accept), media->priv->media); | |
521 g_signal_connect_swapped(G_OBJECT(media->priv->reject), "clicked", | |
522 G_CALLBACK(purple_media_reject), media->priv->media); | |
523 g_signal_connect_swapped(G_OBJECT(media->priv->hangup), "clicked", | |
524 G_CALLBACK(purple_media_hangup), media->priv->media); | |
525 | |
526 g_signal_connect(G_OBJECT(media->priv->media), "accepted", | |
527 G_CALLBACK(pidgin_media_accept_cb), media); | |
528 g_signal_connect(G_OBJECT(media->priv->media) ,"ready", | |
529 G_CALLBACK(pidgin_media_ready_cb), media); | |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
530 g_signal_connect(G_OBJECT(media->priv->media) ,"wait", |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
531 G_CALLBACK(pidgin_media_wait_cb), media); |
23764 | 532 g_signal_connect(G_OBJECT(media->priv->media), "hangup", |
533 G_CALLBACK(pidgin_media_hangup_cb), media); | |
534 g_signal_connect(G_OBJECT(media->priv->media), "reject", | |
535 G_CALLBACK(pidgin_media_reject_cb), media); | |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23836
diff
changeset
|
536 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:
23836
diff
changeset
|
537 G_CALLBACK(pidgin_media_got_request_cb), media); |
23784
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23773
diff
changeset
|
538 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:
23773
diff
changeset
|
539 G_CALLBACK(pidgin_media_got_hangup_cb), media); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
540 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:
23784
diff
changeset
|
541 G_CALLBACK(pidgin_media_accept_cb), media); |
23764 | 542 break; |
543 case PROP_SEND_LEVEL: | |
544 if (media->priv->send_level) | |
545 gst_object_unref(media->priv->send_level); | |
546 media->priv->send_level = g_value_get_object(value); | |
547 g_object_ref(media->priv->send_level); | |
548 break; | |
549 case PROP_RECV_LEVEL: | |
550 if (media->priv->recv_level) | |
551 gst_object_unref(media->priv->recv_level); | |
552 media->priv->recv_level = g_value_get_object(value); | |
553 g_object_ref(media->priv->recv_level); | |
554 break; | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
555 default: |
23764 | 556 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
557 break; | |
558 } | |
559 } | |
560 | |
561 static void | |
562 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
563 { | |
564 PidginMedia *media; | |
565 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
566 |
23764 | 567 media = PIDGIN_MEDIA(object); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
568 |
23764 | 569 switch (prop_id) { |
570 case PROP_MEDIA: | |
571 g_value_set_object(value, media->priv->media); | |
572 break; | |
573 case PROP_SEND_LEVEL: | |
574 g_value_set_object(value, media->priv->send_level); | |
575 break; | |
576 case PROP_RECV_LEVEL: | |
577 g_value_set_object(value, media->priv->recv_level); | |
578 break; | |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
579 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
580 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
23764 | 581 break; |
582 } | |
583 } | |
584 | |
585 GtkWidget * | |
23821
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:
23804
diff
changeset
|
586 pidgin_media_new(PurpleMedia *media) |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
587 { |
23821
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:
23804
diff
changeset
|
588 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:
23804
diff
changeset
|
589 "media", media, NULL); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
590 return GTK_WIDGET(gtkmedia); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
591 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
592 |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
593 static void |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
594 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
23764 | 595 { |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
596 gtkmedia->priv->state = state; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
597 switch (state) { |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
598 case PIDGIN_MEDIA_WAITING: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
599 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:
23784
diff
changeset
|
600 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:
23784
diff
changeset
|
601 gtk_widget_hide(gtkmedia->priv->reject); |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
602 gtk_widget_show(gtkmedia->priv->hangup); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
603 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
604 case PIDGIN_MEDIA_REQUESTED: |
23793
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23787
diff
changeset
|
605 gtk_widget_hide(gtkmedia->priv->calling); |
23787
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
606 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:
23784
diff
changeset
|
607 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:
23784
diff
changeset
|
608 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:
23784
diff
changeset
|
609 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
610 case PIDGIN_MEDIA_ACCEPTED: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
611 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:
23784
diff
changeset
|
612 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:
23784
diff
changeset
|
613 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:
23784
diff
changeset
|
614 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:
23784
diff
changeset
|
615 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
616 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
617 break; |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23784
diff
changeset
|
618 } |
23764 | 619 } |
620 | |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23801
diff
changeset
|
621 #endif /* USE_VV */ |